Improved Tab Titles
This commit is contained in:
parent
357067b8de
commit
f5f510a2e0
24 changed files with 328 additions and 241 deletions
|
@ -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);
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/25/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/21/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* Display an image on a JLabel element
|
||||
*
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* A simple swing JFrame console
|
||||
*
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* A swing console that can print out from PrintStreams
|
||||
*
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/21/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/25/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @author Waterwolf
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* Searching on a JTextArea using swing highlighting
|
||||
*
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* Searching on an RSyntaxTextArea using swing highlighting
|
||||
*
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/25/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/25/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/25/2021
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/24/2021
|
||||
|
|
|
@ -161,11 +161,6 @@ public class WorkPaneMainComponent extends VisibleComponent
|
|||
{
|
||||
String workingName = container.name + ">" + name;
|
||||
|
||||
if (Configuration.simplifiedTabNames)
|
||||
name = MiscUtils.getChildFromPath(name);
|
||||
if (Configuration.displayParentInTab)
|
||||
name = container.name + ">" + name;
|
||||
|
||||
if (!workingOn.containsKey(workingName))
|
||||
{
|
||||
final ClassViewer tabComp = new ClassViewer(container, name, cn, 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))
|
||||
{
|
||||
|
|
|
@ -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,183 +70,6 @@ public class ClassViewer extends ResourceViewer
|
|||
public ClassViewer THIS = this;
|
||||
public List<MethodParser> 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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -386,7 +204,15 @@ 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;
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
{
|
||||
|
@ -126,6 +128,13 @@ 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)
|
||||
|
@ -142,6 +151,8 @@ public class FileViewer extends ResourceViewer
|
|||
mainPanel.add(label, BorderLayout.CENTER);
|
||||
mainPanel.updateUI();
|
||||
|
||||
refreshTitle();
|
||||
|
||||
src.setEnabled(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
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 <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
/**
|
||||
* Allows us to run a background thread
|
||||
*
|
||||
|
|
|
@ -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<String, byte[]> files = new HashMap<>();
|
||||
public ArrayList<ClassNode> classes = new ArrayList<>();
|
||||
|
||||
public ClassNode getClassNode(String name) {
|
||||
public ClassNode getClassNode(String name)
|
||||
{
|
||||
for (ClassNode c : classes)
|
||||
if (c.name.equals(name))
|
||||
return c;
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue