From f5f510a2e006d2ef2c8bd21302cfdbe0477c7bdd Mon Sep 17 00:00:00 2001 From: Konloch Date: Fri, 25 Jun 2021 20:33:06 -0700 Subject: [PATCH] Improved Tab Titles --- .../bytecodeviewer/gui/MainViewerGUI.java | 2 + .../gui/components/ButtonHoverAnimation.java | 18 ++ .../components/DecompilerViewComponent.java | 18 ++ .../gui/components/ImageJLabel.java | 18 ++ .../gui/components/JFrameConsole.java | 18 ++ .../components/JFrameConsolePrintStream.java | 18 ++ .../gui/components/JTextAreaOutputStream.java | 18 ++ .../gui/components/MaxWidthJLabel.java | 18 ++ .../gui/components/MethodsRenderer.java | 18 ++ .../gui/components/SearchableJTextArea.java | 18 ++ .../components/SearchableRSyntaxTextArea.java | 18 ++ .../gui/components/SystemErrConsole.java | 21 -- .../gui/components/VisibleComponent.java | 3 +- .../listeners/MouseClickedListener.java | 18 ++ .../listeners/PressKeyListener.java | 18 ++ .../listeners/ReleaseKeyListener.java | 18 ++ .../gui/resourceviewer/ResourceViewPanel.java | 18 ++ .../resourceviewer/WorkPaneMainComponent.java | 9 +- .../resourceviewer/viewer/ClassViewer.java | 210 ++---------------- .../gui/resourceviewer/viewer/FileViewer.java | 13 +- .../resourceviewer/viewer/ResourceViewer.java | 17 ++ .../gui/util/PaneUpdaterThread.java | 36 +-- .../bytecodeviewer/util/FileContainer.java | 4 +- .../club/bytecodeviewer/util/MiscUtils.java | 2 +- 24 files changed, 328 insertions(+), 241 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 306a5e01..da672166 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -645,6 +645,8 @@ public class MainViewerGUI extends JFrame { showFileInTabTitle.setSelected(false); showClassMethods.setSelected(false); + simplifyNameInTabTitle.setEnabled(true); + moveAllClassesIntoRoot.setEnabled(false); controlFlow.setEnabled(false); junkCode.setEnabled(false); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java index da632c02..6f3f6b7c 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ButtonHoverAnimation.java @@ -5,6 +5,24 @@ import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/25/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java index 8acff12c..135dd78e 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/DecompilerViewComponent.java @@ -4,6 +4,24 @@ import the.bytecode.club.bytecodeviewer.util.RefreshWorkPane; import javax.swing.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/21/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ImageJLabel.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ImageJLabel.java index f318738d..c0b6af70 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ImageJLabel.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/ImageJLabel.java @@ -3,6 +3,24 @@ package the.bytecode.club.bytecodeviewer.gui.components; import javax.swing.*; import java.awt.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * Display an image on a JLabel element * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java index 8907326b..25fcdc07 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsole.java @@ -5,6 +5,24 @@ import the.bytecode.club.bytecodeviewer.Resources; import javax.swing.*; import java.awt.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * A simple swing JFrame console * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsolePrintStream.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsolePrintStream.java index cf17e940..2670afea 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsolePrintStream.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JFrameConsolePrintStream.java @@ -4,6 +4,24 @@ import java.io.PrintStream; import static the.bytecode.club.bytecodeviewer.Constants.nl; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * A swing console that can print out from PrintStreams * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JTextAreaOutputStream.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JTextAreaOutputStream.java index efb5a506..a1182ee2 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JTextAreaOutputStream.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/JTextAreaOutputStream.java @@ -4,6 +4,24 @@ import javax.swing.*; import java.io.IOException; import java.io.OutputStream; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/21/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MaxWidthJLabel.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MaxWidthJLabel.java index 1d440643..e432f6e0 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MaxWidthJLabel.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MaxWidthJLabel.java @@ -3,6 +3,24 @@ package the.bytecode.club.bytecodeviewer.gui.components; import javax.swing.*; import java.awt.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/25/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MethodsRenderer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MethodsRenderer.java index a2720a29..b4000f0d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MethodsRenderer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/MethodsRenderer.java @@ -6,6 +6,24 @@ import the.bytecode.club.bytecodeviewer.util.MethodParser; import javax.swing.*; import java.awt.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @author Waterwolf diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java index 20f02f19..dfa3a531 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableJTextArea.java @@ -10,6 +10,24 @@ import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * Searching on a JTextArea using swing highlighting * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java index c942db67..9bca1013 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SearchableRSyntaxTextArea.java @@ -12,6 +12,24 @@ import javax.swing.*; import java.awt.*; import java.awt.event.KeyEvent; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * Searching on an RSyntaxTextArea using swing highlighting * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SystemErrConsole.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SystemErrConsole.java index 9bbcb6fb..a58e5958 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SystemErrConsole.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/SystemErrConsole.java @@ -1,26 +1,5 @@ package the.bytecode.club.bytecodeviewer.gui.components; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.io.PrintStream; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.text.DefaultHighlighter; -import javax.swing.text.Highlighter; -import javax.swing.text.JTextComponent; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; -import the.bytecode.club.bytecodeviewer.Resources; - -import static the.bytecode.club.bytecodeviewer.Constants.*; - /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java index 127e9286..3fa84da3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/VisibleComponent.java @@ -1,8 +1,6 @@ package the.bytecode.club.bytecodeviewer.gui.components; import javax.swing.JInternalFrame; -import org.objectweb.asm.tree.ClassNode; -import the.bytecode.club.bytecodeviewer.util.FileContainer; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -28,6 +26,7 @@ import the.bytecode.club.bytecodeviewer.util.FileContainer; * @author Konloch * @author WaterWolf */ + public abstract class VisibleComponent extends JInternalFrame { private static final long serialVersionUID = -6453413772343643526L; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/MouseClickedListener.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/MouseClickedListener.java index 498cfd75..16eb7ed5 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/MouseClickedListener.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/MouseClickedListener.java @@ -2,6 +2,24 @@ package the.bytecode.club.bytecodeviewer.gui.components.listeners; import java.awt.event.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/25/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/PressKeyListener.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/PressKeyListener.java index b65897bf..2634928f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/PressKeyListener.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/PressKeyListener.java @@ -3,6 +3,24 @@ package the.bytecode.club.bytecodeviewer.gui.components.listeners; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/25/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/ReleaseKeyListener.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/ReleaseKeyListener.java index b110f22a..4db9b004 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/ReleaseKeyListener.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/components/listeners/ReleaseKeyListener.java @@ -3,6 +3,24 @@ package the.bytecode.club.bytecodeviewer.gui.components.listeners; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/25/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/ResourceViewPanel.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/ResourceViewPanel.java index bcbc9567..febf0a81 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/ResourceViewPanel.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/ResourceViewPanel.java @@ -13,6 +13,24 @@ import the.bytecode.club.bytecodeviewer.gui.util.PaneUpdaterThread; import javax.swing.*; import java.awt.*; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * @author Konloch * @since 6/24/2021 diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java index b19b2525..02036c16 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/WorkPaneMainComponent.java @@ -160,11 +160,6 @@ public class WorkPaneMainComponent extends VisibleComponent public void addWorkingFile(final FileContainer container, String name, final ClassNode cn) { String workingName = container.name + ">" + name; - - if (Configuration.simplifiedTabNames) - name = MiscUtils.getChildFromPath(name); - if (Configuration.displayParentInTab) - name = container.name + ">" + name; if (!workingOn.containsKey(workingName)) { @@ -191,10 +186,10 @@ public class WorkPaneMainComponent extends VisibleComponent final String workingName = container.name + ">" + name; - if (Configuration.simplifiedTabNames) + /*if (Configuration.simplifiedTabNames) name = MiscUtils.getChildFromPath(name); if (Configuration.displayParentInTab) - name = container.name + ">" + name; + name = container.name + ">" + name;*/ if (!workingOn.containsKey(workingName)) { diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java index 84ef8bcf..1bdc1959 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ClassViewer.java @@ -5,8 +5,6 @@ import the.bytecode.club.bytecodeviewer.gui.resourceviewer.ResourceViewPanel; import the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane; import the.bytecode.club.bytecodeviewer.gui.hexviewer.JHexEditor; import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Component; import java.awt.Container; import java.awt.Dimension; import java.awt.Point; @@ -22,12 +20,8 @@ import javax.swing.JSplitPane; import javax.swing.JViewport; import javax.swing.SwingUtilities; import javax.swing.text.BadLocationException; -import javax.swing.text.DefaultHighlighter; -import javax.swing.text.Highlighter; -import javax.swing.text.JTextComponent; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; -import org.fife.ui.rtextarea.RTextScrollPane; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; @@ -65,8 +59,6 @@ import static the.bytecode.club.bytecodeviewer.util.MethodParser.Method; public class ClassViewer extends ResourceViewer { - private static final long serialVersionUID = -8650495368920680024L; - public String name; public JSplitPane sp; public JSplitPane sp2; public TabbedPane tabbedPane; @@ -78,184 +70,7 @@ public class ClassViewer extends ResourceViewer public ClassViewer THIS = this; public List methods = Arrays.asList(new MethodParser(), new MethodParser(), new MethodParser()); public final String workingName; - private final DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(new Color(255, 62, 150)); - /** - * This was really interesting to write. - * - * @author Konloch - */ - public void search(int pane, String search, boolean next) - { - try - { - Component[] com = null; - if (pane == 0) // bytecode - com = resourceViewPanel1.panel.getComponents(); - else if (pane == 1) - com = resourceViewPanel2.panel.getComponents(); - else if (pane == 2) - com = resourceViewPanel3.panel.getComponents(); - - if (com == null) // someone fucked up, lets prevent a nullpointer. - return; - - for (Component c : com) - { - if (c instanceof RTextScrollPane) - { - RSyntaxTextArea area = (RSyntaxTextArea) ((RTextScrollPane) c).getViewport().getComponent(0); - - if (search.isEmpty()) - { - highlight(pane, area, ""); - return; - } - - int startLine = area.getDocument().getDefaultRootElement() - .getElementIndex(area.getCaretPosition()) + 1; - - int currentLine = 1; - boolean canSearch = false; - String[] test = (area.getText().split("\n").length >= 2 - ? area.getText().split("\n") - : area.getText().split("\r")); - - int lastGoodLine = -1; - int firstPos = -1; - boolean found = false; - - if (next) - { - for (String s : test) - { - if (pane == 0 && !resourceViewPanel1.textArea.getCaseSensitiveSearch().isSelected() || - pane == 1 && !resourceViewPanel2.textArea.getCaseSensitiveSearch().isSelected()) - { - //TODO should pane2 be here? - look into this later - s = s.toLowerCase(); - search = search.toLowerCase(); - } - - if (currentLine == startLine) - { - canSearch = true; - } - else if (s.contains(search)) - { - if (canSearch) - { - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(currentLine - 1) - .getStartOffset()); - canSearch = false; - found = true; - } - - if (firstPos == -1) - firstPos = currentLine; - } - - currentLine++; - } - - if (!found && firstPos != -1) - { - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(firstPos - 1).getStartOffset()); - } - } - else - { - canSearch = true; - for (String s : test) - { - if (pane == 0 && !resourceViewPanel1.textArea.getCaseSensitiveSearch().isSelected() || pane == 1 - && !resourceViewPanel2.textArea.getCaseSensitiveSearch().isSelected() || pane == 2 - && !resourceViewPanel3.textArea.getCaseSensitiveSearch().isSelected()) - { - s = s.toLowerCase(); - search = search.toLowerCase(); - } - - if (s.contains(search)) - { - if (lastGoodLine != -1 && canSearch) - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(lastGoodLine - 1) - .getStartOffset()); - - lastGoodLine = currentLine; - - if (currentLine >= startLine) - canSearch = false; - } - currentLine++; - } - - if (lastGoodLine != -1 - && area.getDocument() - .getDefaultRootElement() - .getElementIndex(area.getCaretPosition()) + 1 == startLine) - { - area.setCaretPosition(area.getDocument() - .getDefaultRootElement() - .getElement(lastGoodLine - 1) - .getStartOffset()); - } - } - highlight(pane, area, search); - } - } - } - catch (Exception e) - { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - - public void highlight(int pane, JTextComponent textComp, String pattern) - { - if (pattern.isEmpty()) - { - textComp.getHighlighter().removeAllHighlights(); - return; - } - - try - { - Highlighter hilite = textComp.getHighlighter(); - hilite.removeAllHighlights(); - javax.swing.text.Document doc = textComp.getDocument(); - String text = doc.getText(0, doc.getLength()); - int pos = 0; - - if ((pane == 0 && !resourceViewPanel1.textArea.getCaseSensitiveSearch().isSelected()) || pane == 1 - && !resourceViewPanel2.textArea.getCaseSensitiveSearch().isSelected() || pane == 2 - && !resourceViewPanel3.textArea.getCaseSensitiveSearch().isSelected()) - { - pattern = pattern.toLowerCase(); - text = text.toLowerCase(); - } - - // Search for pattern - while ((pos = text.indexOf(pattern, pos)) >= 0) - { - // Create highlighter using private painter and apply around - // pattern - hilite.addHighlight(pos, pos + pattern.length(), painter); - pos += pattern.length(); - } - } - catch (Exception e) - { - new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); - } - } - public ClassViewer(final FileContainer container, final String name, final ClassNode cn, String workingName) { this.workingName = workingName; @@ -285,7 +100,8 @@ public class ClassViewer extends ResourceViewer }); } - public void resetDivider() { + public void resetDivider() + { SwingUtilities.invokeLater(() -> { sp.setResizeWeight(0.5); @@ -323,6 +139,8 @@ public class ClassViewer extends ResourceViewer this.cn = BytecodeViewer.getClassNode(container, cn.name); //update the classnode setPanes(); + refreshTitle(); + resourceViewPanel1.createPane(this); resourceViewPanel2.createPane(this); resourceViewPanel3.createPane(this); @@ -385,8 +203,16 @@ public class ClassViewer extends ResourceViewer } } } - - public Object[] getSmali() { + + @Override + public void refreshTitle() + { + if(tabbedPane != null) + tabbedPane.label.setText(getTabName()); + } + + public Object[] getSmali() + { if (resourceViewPanel1.compileMode == ResourcePanelCompileMode.SMALI_ASSEMBLY) return new Object[]{cn, resourceViewPanel1.textArea.getText()}; if (resourceViewPanel2.compileMode == ResourcePanelCompileMode.SMALI_ASSEMBLY) @@ -397,7 +223,8 @@ public class ClassViewer extends ResourceViewer return null; } - public Object[] getKrakatau() { + public Object[] getKrakatau() + { if (resourceViewPanel1.compileMode == ResourcePanelCompileMode.KRAKATAU_ASSEMBLY) return new Object[]{cn, resourceViewPanel1.textArea.getText()}; if (resourceViewPanel2.compileMode == ResourcePanelCompileMode.KRAKATAU_ASSEMBLY) @@ -408,7 +235,8 @@ public class ClassViewer extends ResourceViewer return null; } - public Object[] getJava() { + public Object[] getJava() + { if (resourceViewPanel1.textArea != null) return new Object[]{cn, resourceViewPanel1.textArea.getText()}; if (resourceViewPanel2.textArea != null) @@ -566,4 +394,6 @@ public class ClassViewer extends ResourceViewer area.setCaretPosition(area.getLineStartOffset(line)); } catch (BadLocationException ignored) { } } + + private static final long serialVersionUID = -8650495368920680024L; } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java index 38d59464..54fba386 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/FileViewer.java @@ -82,6 +82,8 @@ public class FileViewer extends ResourceViewer final String nameLowerCase = this.name.toLowerCase(); final String contentsAsString = new String(contents); + refreshTitle(); + //image viewer if (!MiscUtils.isPureAscii(contentsAsString)) { @@ -125,7 +127,14 @@ public class FileViewer extends ResourceViewer mainPanel.add(textArea.getScrollPane()); } - + + @Override + public void refreshTitle() + { + if(tabbedPane != null) + tabbedPane.label.setText(getTabName()); + } + public void refresh(JButton src) { if (!canRefresh) @@ -141,6 +150,8 @@ public class FileViewer extends ResourceViewer JLabel label = new JLabel("", new ImageIcon(image), JLabel.CENTER); mainPanel.add(label, BorderLayout.CENTER); mainPanel.updateUI(); + + refreshTitle(); src.setEnabled(true); } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java index 2fdd70f4..2d0a38fc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/resourceviewer/viewer/ResourceViewer.java @@ -2,7 +2,9 @@ package the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer; import javax.swing.JPanel; import org.objectweb.asm.tree.ClassNode; +import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.util.FileContainer; +import the.bytecode.club.bytecodeviewer.util.MiscUtils; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -25,8 +27,23 @@ import the.bytecode.club.bytecodeviewer.util.FileContainer; public abstract class ResourceViewer extends JPanel { public ClassNode cn; + public String originalName; public String name; public FileContainer container; + + public String getTabName() + { + String tabName = name; + + if (Configuration.simplifiedTabNames) + tabName = MiscUtils.getChildFromPath(tabName); + if (Configuration.displayParentInTab) + tabName = container.name + ">" + tabName; + + return tabName; + } + + public abstract void refreshTitle(); private static final long serialVersionUID = -2965538493489119191L; } \ No newline at end of file diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java b/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java index ca8950a9..2ecb20a8 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/gui/util/PaneUpdaterThread.java @@ -1,23 +1,5 @@ package the.bytecode.club.bytecodeviewer.gui.util; -/*************************************************************************** - * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * - * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - ***************************************************************************/ - import java.awt.BorderLayout; import java.awt.Font; import java.awt.event.InputEvent; @@ -40,6 +22,24 @@ import the.bytecode.club.bytecodeviewer.util.MethodParser; import static the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane.BLANK_COLOR; +/*************************************************************************** + * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * + * Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + /** * Allows us to run a background thread * diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/FileContainer.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/FileContainer.java index 7327dad4..99175ccb 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/FileContainer.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/FileContainer.java @@ -4,6 +4,7 @@ import java.io.File; import java.util.ArrayList; import java.util.HashMap; import org.objectweb.asm.tree.ClassNode; +import the.bytecode.club.bytecodeviewer.Configuration; /*************************************************************************** * Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite * @@ -48,7 +49,8 @@ public class FileContainer { public HashMap files = new HashMap<>(); public ArrayList classes = new ArrayList<>(); - public ClassNode getClassNode(String name) { + public ClassNode getClassNode(String name) + { for (ClassNode c : classes) if (c.name.equals(name)) return c; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java index 58e7bdbf..4edea786 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/MiscUtils.java @@ -216,7 +216,7 @@ public class MiscUtils public static String getChildFromPath(String path) { - if (path.contains("/")) + if (path != null && path.contains("/")) { String[] pathParts = StringUtils.split(path, "/"); return pathParts[pathParts.length-1];