Skip to content

Commit 7750e75

Browse files
authored
Fix proof task tree forced white background. (#3663)
2 parents 8c09511 + 016d68c commit 7750e75

File tree

2 files changed

+17
-79
lines changed

2 files changed

+17
-79
lines changed

key.ui/src/main/java/de/uka/ilkd/key/gui/MainWindow.java

Lines changed: 12 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.awt.event.MouseEvent;
1111
import java.beans.PropertyChangeEvent;
1212
import java.beans.PropertyChangeListener;
13+
import java.lang.reflect.Field;
1314
import java.lang.reflect.InvocationTargetException;
1415
import java.lang.reflect.Method;
1516
import java.nio.file.Path;
@@ -21,6 +22,7 @@
2122
import java.util.prefs.Preferences;
2223
import java.util.stream.Stream;
2324
import javax.swing.*;
25+
import javax.swing.border.TitledBorder;
2426
import javax.swing.event.ChangeListener;
2527
import javax.swing.event.MenuEvent;
2628
import javax.swing.event.MenuListener;
@@ -52,12 +54,8 @@
5254
import de.uka.ilkd.key.gui.settings.SettingsManager;
5355
import de.uka.ilkd.key.gui.smt.DropdownSelectionButton;
5456
import de.uka.ilkd.key.gui.sourceview.SourceViewFrame;
55-
import de.uka.ilkd.key.gui.utilities.GuiUtilities;
5657
import de.uka.ilkd.key.gui.utilities.LruCached;
57-
import de.uka.ilkd.key.proof.Goal;
58-
import de.uka.ilkd.key.proof.Node;
59-
import de.uka.ilkd.key.proof.Proof;
60-
import de.uka.ilkd.key.proof.ProofEvent;
58+
import de.uka.ilkd.key.proof.*;
6159
import de.uka.ilkd.key.settings.FeatureSettings;
6260
import de.uka.ilkd.key.settings.GeneralSettings;
6361
import de.uka.ilkd.key.settings.ProofIndependentSettings;
@@ -102,7 +100,7 @@ public final class MainWindow extends JFrame {
102100
* Tooltip for auto mode button.
103101
*/
104102
public static final String AUTO_MODE_TEXT = "Start/stop automated proof search";
105-
private static final long serialVersionUID = 5853419918923902636L;
103+
106104
private static final String PARA =
107105
"<p style=\"font-family: lucida;font-size: 12pt;font-weight: bold\">";
108106

@@ -317,11 +315,12 @@ private MainWindow() {
317315
currentGoalView = new CurrentGoalView(this);
318316
emptySequent = new EmptySequent(this);
319317
sequentViewSearchBar = new SequentViewSearchBar(emptySequent);
320-
proofListView = new JScrollPane();
321318
autoModeAction = new AutoModeAction(this);
322319
mainFrame = new MainFrame(this, emptySequent);
323320
sourceViewFrame = new SourceViewFrame(this);
324321
proofList = new TaskTree(mediator);
322+
proofListView = new JScrollPane(proofList);
323+
325324
notificationManager = new NotificationManager(mediator, this);
326325
recentFileMenu = new RecentFileMenu(mediator);
327326

@@ -448,10 +447,6 @@ private static void updateLookAndFeel() {
448447
for (Window w : Window.getWindows()) {
449448
SwingUtilities.updateComponentTreeUI(w);
450449
}
451-
452-
if (instance != null) {
453-
// SwingUtilities.updateComponentTreeUI(instance);
454-
}
455450
}
456451

457452
/**
@@ -484,36 +479,12 @@ public TermLabelVisibilityManager getVisibleTermLabels() {
484479
*/
485480
private void applyGnomeWorkaround() {
486481
Toolkit xToolkit = Toolkit.getDefaultToolkit();
487-
java.lang.reflect.Field awtAppClassNameField;
482+
Field awtAppClassNameField;
488483
try {
489484
awtAppClassNameField = xToolkit.getClass().getDeclaredField("awtAppClassName");
490485
awtAppClassNameField.setAccessible(true);
491486
awtAppClassNameField.set(xToolkit, "KeY");
492-
} catch (Exception e) {
493-
}
494-
}
495-
496-
/**
497-
* Tries to set the configured look and feel if the option is activated.
498-
*/
499-
private void setLaF() {
500-
try {
501-
String className =
502-
ProofIndependentSettings.DEFAULT_INSTANCE.getViewSettings().getLookAndFeel();
503-
// only set look and feel if configured
504-
// (previous KeY versions stored [no value set] as "null")
505-
if (className != null && !className.equals("null")) {
506-
UIManager.setLookAndFeel(className);
507-
508-
// Workarounds for GTK+
509-
// TODO: check whether they apply to other LaFs
510-
UIManager.put("Slider.paintValue", Boolean.FALSE);
511-
UIManager.put("Menu.background", Color.GRAY); // menu background is still white....
512-
513-
SwingUtilities.updateComponentTreeUI(this);
514-
}
515-
} catch (Exception e) {
516-
LOGGER.error("failed to set look and feel ", e);
487+
} catch (Exception ignored) {
517488
}
518489
}
519490

@@ -615,30 +586,11 @@ private void layoutMain() {
615586

616587
getContentPane().add(toolBarPanel, BorderLayout.PAGE_START);
617588

618-
proofListView.setPreferredSize(new java.awt.Dimension(350, 100));
619-
GuiUtilities.paintEmptyViewComponent(proofListView, "Proofs");
589+
proofListView.setPreferredSize(new Dimension(350, 100));
590+
proofListView.setBorder(new TitledBorder("Proofs"));
620591

621-
// JSplitPane leftPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, proofListView,
622-
// mainWindowTabbedPane);
623-
// leftPane.setName("leftPane");
624-
// leftPane.setOneTouchExpandable(true);
625-
626-
// JPanel rightPane = new JPanel();
627-
// rightPane.setLayout(new BorderLayout());
628-
// rightPane.add(mainFrame, BorderLayout.CENTER);
629592
mainFrame.add(sequentViewSearchBar, BorderLayout.SOUTH);
630593

631-
// JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, rightPane, sourceView);
632-
// pane.setResizeWeight(0.5);
633-
// pane.setOneTouchExpandable(true);
634-
// pane.setName("split2");
635-
636-
// JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPane, pane);
637-
// splitPane.setResizeWeight(0); // the right pane is more important
638-
// splitPane.setOneTouchExpandable(true);
639-
// splitPane.setName("splitPane");
640-
// getContentPane().add(splitPane, BorderLayout.CENTER);
641-
642594
dockControl.putProperty(StackDockStation.TAB_PLACEMENT, TabPlacement.TOP_OF_DOCKABLE);
643595

644596
getContentPane().add(dockControl.getContentArea());
@@ -888,7 +840,7 @@ public void makePrettyView() {
888840
SwingUtilities.invokeLater(this::updateSequentView);
889841
}
890842

891-
private void addToProofList(de.uka.ilkd.key.proof.ProofAggregate plist) {
843+
private void addToProofList(ProofAggregate plist) {
892844
proofList.addProof(plist);
893845
// TODO/Check: the code below emulates phantom actions. Check if this can be solved
894846
// differently
@@ -899,9 +851,6 @@ private void addToProofList(de.uka.ilkd.key.proof.ProofAggregate plist) {
899851
for (Proof proof : plist.getProofs()) {
900852
new ProofLoadUserAction(getMediator(), proof).actionPerformed(null);
901853
}
902-
// GUI
903-
proofList.setSize(proofList.getPreferredSize());
904-
proofListView.setViewportView(proofList);
905854
}
906855

907856
/**
@@ -1225,7 +1174,7 @@ public CurrentGoalView getGoalView() {
12251174
return currentGoalView;
12261175
}
12271176

1228-
public void addProblem(final de.uka.ilkd.key.proof.ProofAggregate plist) {
1177+
public void addProblem(final ProofAggregate plist) {
12291178
Runnable guiUpdater = () -> {
12301179
disableCurrentGoalView = true;
12311180
addToProofList(plist);

key.ui/src/main/java/de/uka/ilkd/key/gui/utilities/GuiUtilities.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
* SPDX-License-Identifier: GPL-2.0-only */
44
package de.uka.ilkd.key.gui.utilities;
55

6-
import java.awt.Color;
76
import java.awt.Component;
87
import java.awt.Dimension;
98
import java.awt.Point;
109
import java.awt.Toolkit;
10+
import java.awt.datatransfer.StringSelection;
1111
import java.awt.event.ActionListener;
1212
import java.awt.event.KeyEvent;
1313
import javax.swing.*;
14-
import javax.swing.border.TitledBorder;
1514

1615
import de.uka.ilkd.key.gui.nodeviews.SequentView;
1716
import de.uka.ilkd.key.pp.PosInSequent;
@@ -22,24 +21,14 @@ private GuiUtilities() {
2221
throw new Error("Do not instantiate");
2322
}
2423

25-
/**
26-
* paints empty view with white background.
27-
*/
28-
public static void paintEmptyViewComponent(JComponent pane, String name) {
29-
pane.setBorder(new TitledBorder(name));
30-
pane.setBackground(Color.white);
31-
if (pane instanceof JScrollPane) {
32-
((JScrollPane) pane).getViewport().setBackground(Color.white);
33-
}
34-
pane.setMinimumSize(new java.awt.Dimension(150, 0));
35-
}
36-
24+
/// Copies the content in the bounds of `pos` in the `view` as plain text
25+
/// into the system clipboard. It translates the nbsp into breakable spaces.
3726
public static void copyHighlightToClipboard(SequentView view, PosInSequent pos) {
3827
// Replace nbsp; from html with normal spaces
3928
String s = view.getHighlightedText(pos).replace('\u00A0', ' ');
4029
// now CLIPBOARD
41-
java.awt.datatransfer.StringSelection ss = new java.awt.datatransfer.StringSelection(s);
42-
java.awt.Toolkit toolkit = Toolkit.getDefaultToolkit();
30+
StringSelection ss = new StringSelection(s);
31+
Toolkit toolkit = Toolkit.getDefaultToolkit();
4332
toolkit.getSystemClipboard().setContents(ss, ss);
4433
}
4534

0 commit comments

Comments
 (0)