diff options
Diffstat (limited to 'enigma-swing/src/main')
12 files changed, 57 insertions, 97 deletions
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/ClassSelector.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/ClassSelector.java index 91c9705b..7044106b 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/ClassSelector.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/ClassSelector.java | |||
| @@ -63,8 +63,7 @@ public class ClassSelector extends JTree { | |||
| 63 | if (selectionListener != null && event.getClickCount() == 2) { | 63 | if (selectionListener != null && event.getClickCount() == 2) { |
| 64 | // get the selected node | 64 | // get the selected node |
| 65 | TreePath path = getSelectionPath(); | 65 | TreePath path = getSelectionPath(); |
| 66 | if (path != null && path.getLastPathComponent() instanceof ClassSelectorClassNode) { | 66 | if (path != null && path.getLastPathComponent() instanceof ClassSelectorClassNode node) { |
| 67 | ClassSelectorClassNode node = (ClassSelectorClassNode) path.getLastPathComponent(); | ||
| 68 | selectionListener.onSelectClass(node.getObfEntry()); | 67 | selectionListener.onSelectClass(node.getObfEntry()); |
| 69 | } | 68 | } |
| 70 | } | 69 | } |
| @@ -105,8 +104,7 @@ public class ClassSelector extends JTree { | |||
| 105 | TreePath path = getSelectionPath(); | 104 | TreePath path = getSelectionPath(); |
| 106 | 105 | ||
| 107 | Object realPath = path.getLastPathComponent(); | 106 | Object realPath = path.getLastPathComponent(); |
| 108 | if (realPath != null && realPath instanceof DefaultMutableTreeNode && data != null) { | 107 | if (realPath instanceof DefaultMutableTreeNode node && data != null) { |
| 109 | DefaultMutableTreeNode node = (DefaultMutableTreeNode) realPath; | ||
| 110 | TreeNode parentNode = node.getParent(); | 108 | TreeNode parentNode = node.getParent(); |
| 111 | if (parentNode == null) | 109 | if (parentNode == null) |
| 112 | return; | 110 | return; |
| @@ -251,8 +249,7 @@ public class ClassSelector extends JTree { | |||
| 251 | public ClassEntry getSelectedClass() { | 249 | public ClassEntry getSelectedClass() { |
| 252 | if (!isSelectionEmpty()) { | 250 | if (!isSelectionEmpty()) { |
| 253 | Object selectedNode = getSelectionPath().getLastPathComponent(); | 251 | Object selectedNode = getSelectionPath().getLastPathComponent(); |
| 254 | if (selectedNode instanceof ClassSelectorClassNode) { | 252 | if (selectedNode instanceof ClassSelectorClassNode classNode) { |
| 255 | ClassSelectorClassNode classNode = (ClassSelectorClassNode) selectedNode; | ||
| 256 | return classNode.getClassEntry(); | 253 | return classNode.getClassEntry(); |
| 257 | } | 254 | } |
| 258 | } | 255 | } |
| @@ -262,11 +259,9 @@ public class ClassSelector extends JTree { | |||
| 262 | public String getSelectedPackage() { | 259 | public String getSelectedPackage() { |
| 263 | if (!isSelectionEmpty()) { | 260 | if (!isSelectionEmpty()) { |
| 264 | Object selectedNode = getSelectionPath().getLastPathComponent(); | 261 | Object selectedNode = getSelectionPath().getLastPathComponent(); |
| 265 | if (selectedNode instanceof ClassSelectorPackageNode) { | 262 | if (selectedNode instanceof ClassSelectorPackageNode packageNode) { |
| 266 | ClassSelectorPackageNode packageNode = (ClassSelectorPackageNode) selectedNode; | ||
| 267 | return packageNode.getPackageName(); | 263 | return packageNode.getPackageName(); |
| 268 | } else if (selectedNode instanceof ClassSelectorClassNode) { | 264 | } else if (selectedNode instanceof ClassSelectorClassNode classNode) { |
| 269 | ClassSelectorClassNode classNode = (ClassSelectorClassNode) selectedNode; | ||
| 270 | return classNode.getClassEntry().getPackageName(); | 265 | return classNode.getClassEntry().getPackageName(); |
| 271 | } | 266 | } |
| 272 | } | 267 | } |
| @@ -321,12 +316,8 @@ public class ClassSelector extends JTree { | |||
| 321 | 316 | ||
| 322 | for (StateEntry entry : expansionState) { | 317 | for (StateEntry entry : expansionState) { |
| 323 | switch (entry.state) { | 318 | switch (entry.state) { |
| 324 | case SELECTED: | 319 | case SELECTED -> tree.addSelectionPath(entry.path); |
| 325 | tree.addSelectionPath(entry.path); | 320 | case EXPANDED -> tree.expandPath(entry.path); |
| 326 | break; | ||
| 327 | case EXPANDED: | ||
| 328 | tree.expandPath(entry.path); | ||
| 329 | break; | ||
| 330 | } | 321 | } |
| 331 | } | 322 | } |
| 332 | } | 323 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java index aaa04460..8d4fb5be 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/Gui.java | |||
| @@ -216,11 +216,9 @@ public class Gui implements LanguageChangeListener { | |||
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | Object node = path.getLastPathComponent(); | 218 | Object node = path.getLastPathComponent(); |
| 219 | if (node instanceof ClassImplementationsTreeNode) { | 219 | if (node instanceof ClassImplementationsTreeNode classNode) { |
| 220 | ClassImplementationsTreeNode classNode = (ClassImplementationsTreeNode) node; | ||
| 221 | controller.navigateTo(classNode.getClassEntry()); | 220 | controller.navigateTo(classNode.getClassEntry()); |
| 222 | } else if (node instanceof MethodImplementationsTreeNode) { | 221 | } else if (node instanceof MethodImplementationsTreeNode methodNode) { |
| 223 | MethodImplementationsTreeNode methodNode = (MethodImplementationsTreeNode) node; | ||
| 224 | controller.navigateTo(methodNode.getMethodEntry()); | 222 | controller.navigateTo(methodNode.getMethodEntry()); |
| 225 | } | 223 | } |
| 226 | } | 224 | } |
| @@ -248,8 +246,7 @@ public class Gui implements LanguageChangeListener { | |||
| 248 | } | 246 | } |
| 249 | 247 | ||
| 250 | Object node = path.getLastPathComponent(); | 248 | Object node = path.getLastPathComponent(); |
| 251 | if (node instanceof ReferenceTreeNode) { | 249 | if (node instanceof ReferenceTreeNode referenceNode) { |
| 252 | ReferenceTreeNode<Entry<?>, Entry<?>> referenceNode = ((ReferenceTreeNode<Entry<?>, Entry<?>>) node); | ||
| 253 | if (referenceNode.getReference() != null) { | 250 | if (referenceNode.getReference() != null) { |
| 254 | controller.navigateTo(referenceNode.getReference()); | 251 | controller.navigateTo(referenceNode.getReference()); |
| 255 | } else { | 252 | } else { |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java index f990f98c..aeee242f 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/GuiController.java | |||
| @@ -21,7 +21,6 @@ import java.util.List; | |||
| 21 | import java.util.Set; | 21 | import java.util.Set; |
| 22 | import java.util.concurrent.CompletableFuture; | 22 | import java.util.concurrent.CompletableFuture; |
| 23 | import java.util.concurrent.ExecutionException; | 23 | import java.util.concurrent.ExecutionException; |
| 24 | import java.util.stream.Collectors; | ||
| 25 | import java.util.stream.Stream; | 24 | import java.util.stream.Stream; |
| 26 | 25 | ||
| 27 | import javax.swing.JOptionPane; | 26 | import javax.swing.JOptionPane; |
| @@ -311,7 +310,7 @@ public class GuiController implements ClientPacketHandler { | |||
| 311 | return mapper.getObfResolver().resolveReference(reference, ResolutionStrategy.RESOLVE_CLOSEST) | 310 | return mapper.getObfResolver().resolveReference(reference, ResolutionStrategy.RESOLVE_CLOSEST) |
| 312 | .stream() | 311 | .stream() |
| 313 | .flatMap(r -> index.getReferenceTokens(r).stream()) | 312 | .flatMap(r -> index.getReferenceTokens(r).stream()) |
| 314 | .collect(Collectors.toList()); | 313 | .toList(); |
| 315 | } | 314 | } |
| 316 | 315 | ||
| 317 | public void openPreviousReference() { | 316 | public void openPreviousReference() { |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java index ab9fa2a0..cec3fa1e 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/LookAndFeel.java | |||
| @@ -40,20 +40,11 @@ public enum LookAndFeel { | |||
| 40 | 40 | ||
| 41 | try { | 41 | try { |
| 42 | switch (this) { | 42 | switch (this) { |
| 43 | case NONE: | 43 | case NONE -> UIManager.setLookAndFeel(NONE_LAF); |
| 44 | UIManager.setLookAndFeel(NONE_LAF); | 44 | case DEFAULT -> UIManager.setLookAndFeel(new FlatLightLaf()); |
| 45 | break; | 45 | case METAL -> UIManager.setLookAndFeel(new MetalLookAndFeel()); |
| 46 | case DEFAULT: | 46 | case DARCULA -> UIManager.setLookAndFeel(new FlatDarkLaf()); |
| 47 | UIManager.setLookAndFeel(new FlatLightLaf()); | 47 | case SYSTEM -> UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
| 48 | break; | ||
| 49 | case METAL: | ||
| 50 | UIManager.setLookAndFeel(new MetalLookAndFeel()); | ||
| 51 | break; | ||
| 52 | case DARCULA: | ||
| 53 | UIManager.setLookAndFeel(new FlatDarkLaf()); | ||
| 54 | break; | ||
| 55 | case SYSTEM: | ||
| 56 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | ||
| 57 | } | 48 | } |
| 58 | } catch (Exception e) { | 49 | } catch (Exception e) { |
| 59 | throw new Error("Failed to set global look and feel", e); | 50 | throw new Error("Failed to set global look and feel", e); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/FontDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/FontDialog.java index 1db8aea2..4e02a666 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/FontDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/FontDialog.java | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | package cuchaz.enigma.gui.dialog; | 1 | package cuchaz.enigma.gui.dialog; |
| 2 | 2 | ||
| 3 | import java.awt.*; | 3 | import java.awt.*; |
| 4 | import java.util.Arrays; | ||
| 5 | import java.util.List; | 4 | import java.util.List; |
| 6 | 5 | ||
| 7 | import javax.swing.JButton; | 6 | import javax.swing.JButton; |
| @@ -18,14 +17,14 @@ import cuchaz.enigma.utils.I18n; | |||
| 18 | 17 | ||
| 19 | public class FontDialog extends JDialog { | 18 | public class FontDialog extends JDialog { |
| 20 | 19 | ||
| 21 | private static final List<String> CATEGORIES = Arrays.asList( | 20 | private static final List<String> CATEGORIES = List.of( |
| 22 | "Default", | 21 | "Default", |
| 23 | "Default 2", | 22 | "Default 2", |
| 24 | "Small", | 23 | "Small", |
| 25 | "Editor" | 24 | "Editor" |
| 26 | ); | 25 | ); |
| 27 | 26 | ||
| 28 | private static final List<String> CATEGORY_TEXTS = Arrays.asList( | 27 | private static final List<String> CATEGORY_TEXTS = List.of( |
| 29 | "fonts.cat.default", | 28 | "fonts.cat.default", |
| 30 | "fonts.cat.default2", | 29 | "fonts.cat.default2", |
| 31 | "fonts.cat.small", | 30 | "fonts.cat.small", |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java index 7110fc86..5f6dbdb5 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/ProgressDialog.java | |||
| @@ -93,13 +93,10 @@ public class ProgressDialog implements ProgressListener, AutoCloseable { | |||
| 93 | 93 | ||
| 94 | return progress; | 94 | return progress; |
| 95 | }, SwingUtilities::invokeLater).thenAcceptAsync(progress -> { | 95 | }, SwingUtilities::invokeLater).thenAcceptAsync(progress -> { |
| 96 | // TODO use "try (progress)" with Java 9 | 96 | try (progress) { |
| 97 | try { | ||
| 98 | runnable.run(progress); | 97 | runnable.run(progress); |
| 99 | } catch (Exception e) { | 98 | } catch (Exception e) { |
| 100 | throw new RuntimeException(e); | 99 | throw new RuntimeException(e); |
| 101 | } finally { | ||
| 102 | progress.close(); | ||
| 103 | } | 100 | } |
| 104 | }); | 101 | }); |
| 105 | } | 102 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java index 9ed7339c..053adad8 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/SearchDialog.java | |||
| @@ -142,30 +142,23 @@ public class SearchDialog { | |||
| 142 | final EntryIndex entryIndex = parent.getController().project.getJarIndex().getEntryIndex(); | 142 | final EntryIndex entryIndex = parent.getController().project.getJarIndex().getEntryIndex(); |
| 143 | 143 | ||
| 144 | switch (type) { | 144 | switch (type) { |
| 145 | default: | 145 | case CLASS -> entryIndex.getClasses().parallelStream() |
| 146 | case CLASS: | 146 | .filter(e -> !e.isInnerClass()) |
| 147 | entryIndex.getClasses().parallelStream() | 147 | .map(e -> SearchEntryImpl.from(e, parent.getController())) |
| 148 | .filter(e -> !e.isInnerClass()) | 148 | .map(SearchUtil.Entry::from) |
| 149 | .map(e -> SearchEntryImpl.from(e, parent.getController())) | 149 | .sequential() |
| 150 | .map(SearchUtil.Entry::from) | 150 | .forEach(su::add); |
| 151 | .sequential() | 151 | case METHOD -> entryIndex.getMethods().parallelStream() |
| 152 | .forEach(su::add); | 152 | .filter(e -> !e.isConstructor() && !entryIndex.getMethodAccess(e).isSynthetic()) |
| 153 | break; | 153 | .map(e -> SearchEntryImpl.from(e, parent.getController())) |
| 154 | case METHOD: | 154 | .map(SearchUtil.Entry::from) |
| 155 | entryIndex.getMethods().parallelStream() | 155 | .sequential() |
| 156 | .filter(e -> !e.isConstructor() && !entryIndex.getMethodAccess(e).isSynthetic()) | 156 | .forEach(su::add); |
| 157 | .map(e -> SearchEntryImpl.from(e, parent.getController())) | 157 | case FIELD -> entryIndex.getFields().parallelStream() |
| 158 | .map(SearchUtil.Entry::from) | 158 | .map(e -> SearchEntryImpl.from(e, parent.getController())) |
| 159 | .sequential() | 159 | .map(SearchUtil.Entry::from) |
| 160 | .forEach(su::add); | 160 | .sequential() |
| 161 | break; | 161 | .forEach(su::add); |
| 162 | case FIELD: | ||
| 163 | entryIndex.getFields().parallelStream() | ||
| 164 | .map(e -> SearchEntryImpl.from(e, parent.getController())) | ||
| 165 | .map(SearchUtil.Entry::from) | ||
| 166 | .sequential() | ||
| 167 | .forEach(su::add); | ||
| 168 | break; | ||
| 169 | } | 162 | } |
| 170 | 163 | ||
| 171 | updateList(); | 164 | updateList(); |
| @@ -290,10 +283,10 @@ public class SearchDialog { | |||
| 290 | secondaryName.setToolTipText(value.obf.getFullName()); | 283 | secondaryName.setToolTipText(value.obf.getFullName()); |
| 291 | } | 284 | } |
| 292 | 285 | ||
| 293 | if (value.obf instanceof ClassEntry) { | 286 | if (value.obf instanceof ClassEntry classEntry) { |
| 294 | mainName.setIcon(GuiUtil.getClassIcon(gui, (ClassEntry) value.obf)); | 287 | mainName.setIcon(GuiUtil.getClassIcon(gui, classEntry)); |
| 295 | } else if (value.obf instanceof MethodEntry) { | 288 | } else if (value.obf instanceof MethodEntry methodEntry) { |
| 296 | mainName.setIcon(GuiUtil.getMethodIcon((MethodEntry) value.obf)); | 289 | mainName.setIcon(GuiUtil.getMethodIcon(methodEntry)); |
| 297 | } else if (value.obf instanceof FieldEntry) { | 290 | } else if (value.obf instanceof FieldEntry) { |
| 298 | mainName.setIcon(GuiUtil.FIELD_ICON); | 291 | mainName.setIcon(GuiUtil.FIELD_ICON); |
| 299 | } | 292 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java index 8f020b8a..f6564f59 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/EditorPanel.java | |||
| @@ -305,17 +305,10 @@ public class EditorPanel { | |||
| 305 | 305 | ||
| 306 | public void displayError(ClassHandleError t) { | 306 | public void displayError(ClassHandleError t) { |
| 307 | this.setDisplayMode(DisplayMode.ERRORED); | 307 | this.setDisplayMode(DisplayMode.ERRORED); |
| 308 | String str; | 308 | String str = switch (t.type) { |
| 309 | switch (t.type) { | 309 | case DECOMPILE -> "editor.decompile_error"; |
| 310 | case DECOMPILE: | 310 | case REMAP -> "editor.remap_error"; |
| 311 | str = "editor.decompile_error"; | 311 | }; |
| 312 | break; | ||
| 313 | case REMAP: | ||
| 314 | str = "editor.remap_error"; | ||
| 315 | break; | ||
| 316 | default: | ||
| 317 | throw new IllegalStateException("unreachable"); | ||
| 318 | } | ||
| 319 | this.errorLabel.setText(I18n.translate(str)); | 312 | this.errorLabel.setText(I18n.translate(str)); |
| 320 | this.errorTextArea.setText(t.getStackTrace()); | 313 | this.errorTextArea.setText(t.getStackTrace()); |
| 321 | this.errorTextArea.setCaretPosition(0); | 314 | this.errorTextArea.setCaretPosition(0); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/StructurePanel.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/StructurePanel.java index d8c46614..d6f7e5a7 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/StructurePanel.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/panels/StructurePanel.java | |||
| @@ -89,10 +89,10 @@ public class StructurePanel extends JPanel { | |||
| 89 | Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); | 89 | Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); |
| 90 | ParentedEntry<?> entry = ((StructureTreeNode) value).getEntry(); | 90 | ParentedEntry<?> entry = ((StructureTreeNode) value).getEntry(); |
| 91 | 91 | ||
| 92 | if (entry instanceof ClassEntry) { | 92 | if (entry instanceof ClassEntry classEntry) { |
| 93 | this.setIcon(GuiUtil.getClassIcon(gui, (ClassEntry) entry)); | 93 | this.setIcon(GuiUtil.getClassIcon(gui, classEntry)); |
| 94 | } else if (entry instanceof MethodEntry) { | 94 | } else if (entry instanceof MethodEntry methodEntry) { |
| 95 | this.setIcon(GuiUtil.getMethodIcon((MethodEntry) entry)); | 95 | this.setIcon(GuiUtil.getMethodIcon(methodEntry)); |
| 96 | } else if (entry instanceof FieldEntry) { | 96 | } else if (entry instanceof FieldEntry) { |
| 97 | this.setIcon(GuiUtil.FIELD_ICON); | 97 | this.setIcon(GuiUtil.FIELD_ICON); |
| 98 | } | 98 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/CallsTreeCellRenderer.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/CallsTreeCellRenderer.java index d5cfdab8..0aa6510c 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/CallsTreeCellRenderer.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/CallsTreeCellRenderer.java | |||
| @@ -31,10 +31,10 @@ public class CallsTreeCellRenderer extends DefaultTreeCellRenderer { | |||
| 31 | } | 31 | } |
| 32 | // if the node represents the called entry | 32 | // if the node represents the called entry |
| 33 | } else { | 33 | } else { |
| 34 | if (value instanceof ClassReferenceTreeNode) { | 34 | if (value instanceof ClassReferenceTreeNode node) { |
| 35 | this.setIcon(GuiUtil.getClassIcon(this.gui, ((ClassReferenceTreeNode) value).getEntry())); | 35 | this.setIcon(GuiUtil.getClassIcon(this.gui, node.getEntry())); |
| 36 | } else if (value instanceof MethodReferenceTreeNode) { | 36 | } else if (value instanceof MethodReferenceTreeNode node) { |
| 37 | this.setIcon(GuiUtil.getMethodIcon(((MethodReferenceTreeNode) value).getEntry())); | 37 | this.setIcon(GuiUtil.getMethodIcon(node.getEntry())); |
| 38 | } else if (value instanceof FieldReferenceTreeNode) { | 38 | } else if (value instanceof FieldReferenceTreeNode) { |
| 39 | this.setIcon(GuiUtil.FIELD_ICON); | 39 | this.setIcon(GuiUtil.FIELD_ICON); |
| 40 | } | 40 | } |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/ImplementationsTreeCellRenderer.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/ImplementationsTreeCellRenderer.java index 2eb7efc4..7bf39005 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/ImplementationsTreeCellRenderer.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/ImplementationsTreeCellRenderer.java | |||
| @@ -23,10 +23,10 @@ public class ImplementationsTreeCellRenderer extends DefaultTreeCellRenderer { | |||
| 23 | 23 | ||
| 24 | this.setForeground(UiConfig.getTextColor()); | 24 | this.setForeground(UiConfig.getTextColor()); |
| 25 | 25 | ||
| 26 | if (value instanceof ClassImplementationsTreeNode) { | 26 | if (value instanceof ClassImplementationsTreeNode node) { |
| 27 | this.setIcon(GuiUtil.getClassIcon(this.gui, ((ClassImplementationsTreeNode) value).getClassEntry())); | 27 | this.setIcon(GuiUtil.getClassIcon(this.gui, node.getClassEntry())); |
| 28 | } else if (value instanceof MethodImplementationsTreeNode) { | 28 | } else if (value instanceof MethodImplementationsTreeNode node) { |
| 29 | this.setIcon(GuiUtil.getMethodIcon(((MethodImplementationsTreeNode) value).getMethodEntry())); | 29 | this.setIcon(GuiUtil.getMethodIcon(node.getMethodEntry())); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | return c; | 32 | return c; |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/InheritanceTreeCellRenderer.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/InheritanceTreeCellRenderer.java index e377b9a3..a1025531 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/InheritanceTreeCellRenderer.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/renderer/InheritanceTreeCellRenderer.java | |||
| @@ -34,7 +34,7 @@ public class InheritanceTreeCellRenderer extends DefaultTreeCellRenderer { | |||
| 34 | public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { | 34 | public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { |
| 35 | Component ret = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); | 35 | Component ret = super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); |
| 36 | 36 | ||
| 37 | if (!(value instanceof MethodInheritanceTreeNode) || ((MethodInheritanceTreeNode) value).isImplemented()) { | 37 | if (!(value instanceof MethodInheritanceTreeNode node) || node.isImplemented()) { |
| 38 | ret.setForeground(UiConfig.getTextColor()); | 38 | ret.setForeground(UiConfig.getTextColor()); |
| 39 | ret.setFont(ret.getFont().deriveFont(Font.PLAIN)); | 39 | ret.setFont(ret.getFont().deriveFont(Font.PLAIN)); |
| 40 | if (value instanceof ClassInheritanceTreeNode) { | 40 | if (value instanceof ClassInheritanceTreeNode) { |