Skip to content

Commit

Permalink
Move around GUI classes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcx committed Apr 30, 2017
1 parent c96d5ce commit ecafc23
Show file tree
Hide file tree
Showing 18 changed files with 181 additions and 148 deletions.
8 changes: 4 additions & 4 deletions src/main/java/the/bytecode/club/jda/JDA.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import the.bytecode.club.jda.api.ExceptionUI;
import the.bytecode.club.jda.api.Plugin;
import the.bytecode.club.jda.api.PluginLoader;
import the.bytecode.club.jda.gui.FileNavigationPane;
import the.bytecode.club.jda.gui.MainViewerGUI;
import the.bytecode.club.jda.gui.navigation.FileNavigationPane;
import the.bytecode.club.jda.settings.Settings;

import javax.swing.*;
Expand Down Expand Up @@ -152,7 +152,7 @@ private static void onExit() {
* @return the currently opened ClassNode
*/
public static ClassNode getCurrentlyOpenedClassNode() {
return viewer.workPane.getCurrentViewer().cn;
return viewer.FileViewerPane.getCurrentViewer().cn;
}

public static FileContainer findContainer(String containerName, String fileName) {
Expand Down Expand Up @@ -702,8 +702,8 @@ public void run() {
};
t.start();
} else if ((e.getKeyCode() == KeyEvent.VK_W) && isCtrlDown(e)) {
if (viewer.workPane.getCurrentViewer() != null)
viewer.workPane.tabs.remove(viewer.workPane.getCurrentViewer());
if (viewer.FileViewerPane.getCurrentViewer() != null)
viewer.FileViewerPane.tabs.remove(viewer.FileViewerPane.getCurrentViewer());
}
}
}
29 changes: 18 additions & 11 deletions src/main/java/the/bytecode/club/jda/gui/MainViewerGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
import the.bytecode.club.jda.api.ExceptionUI;
import the.bytecode.club.jda.decompilers.Decompiler;
import the.bytecode.club.jda.decompilers.Decompilers;
import the.bytecode.club.jda.gui.dialogs.AboutWindow;
import the.bytecode.club.jda.gui.dialogs.FontOptionsDialog;
import the.bytecode.club.jda.gui.dialogs.IntroWindow;
import the.bytecode.club.jda.gui.dialogs.TabbedPane;
import the.bytecode.club.jda.gui.fileviewer.FileViewerPane;
import the.bytecode.club.jda.gui.fileviewer.Viewer;
import the.bytecode.club.jda.gui.navigation.FileNavigationPane;
import the.bytecode.club.jda.settings.DecompilerSettings;
import the.bytecode.club.jda.settings.IPersistentWindow;
import the.bytecode.club.jda.settings.Settings;
Expand Down Expand Up @@ -44,15 +51,15 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier, IPersis

public JDesktopPane desktop;
public FileNavigationPane navigator;
public WorkPane workPane;
public FileViewerPane FileViewerPane;
public static ArrayList<JDAWindow> windows = new ArrayList<>();
private final ActionListener listener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
if (Settings.REFRESH_ON_VIEW_CHANGE.getBool()) {
if (workPane.getCurrentViewer() == null)
if (FileViewerPane.getCurrentViewer() == null)
return;
workPane.refreshClass.doClick();
FileViewerPane.refreshClass.doClick();
}
}
};
Expand Down Expand Up @@ -281,15 +288,15 @@ private void initializeMenubar() {

mnShowContainer.setSelected(Settings.SHOW_CONTAINER_NAME.getBool());
mnShowContainer.addItemListener(e -> {
JTabbedPane tabs = workPane.tabs;
JTabbedPane tabs = FileViewerPane.tabs;
Component[] components = tabs.getComponents();
for (int i = 0; i < components.length; i++) {
Component c = components[i];
if (c instanceof Viewer) {
((Viewer) c).updateName();
int idx = tabs.indexOfComponent(c);
tabs.setTabComponentAt(idx, new TabbedPane(c.getName(), tabs));
workPane.tabs.setTitleAt(idx, c.getName());
FileViewerPane.tabs.setTitleAt(idx, c.getName());
}
}
Settings.SHOW_CONTAINER_NAME.set(mnShowContainer.isSelected());
Expand All @@ -310,17 +317,17 @@ public static <T> T getComponent(final Class<T> clazz) {

private void initializeWindows() {
navigator = new FileNavigationPane(this);
workPane = new WorkPane(this);
FileViewerPane = new FileViewerPane(this);

desktop = new JDesktopPane();
setContentPane(desktop);
desktop.add(navigator);
desktop.add(workPane);
desktop.add(FileViewerPane);
desktop.setDesktopManager(new WorkspaceDesktopManager());
desktop.setBackground(COLOR_DESKTOP_BACKGROUND);

windows.add(navigator);
windows.add(workPane);
windows.add(FileViewerPane);
}

public void resetWindows() {
Expand Down Expand Up @@ -400,7 +407,7 @@ private JMenu generatePane(int id) {

public void closeResources() {
navigator.resetWorkspace();
workPane.resetWorkspace();
FileViewerPane.resetWorkspace();
}

public void setIcon(final boolean busy) {
Expand Down Expand Up @@ -435,7 +442,7 @@ public void openFile(final String name, String container, byte[] content) {
}

public void refreshView() {
workPane.refreshClass.doClick();
FileViewerPane.refreshClass.doClick();
}

public void reloadResources() {
Expand Down Expand Up @@ -525,7 +532,7 @@ private void saveAsRunnableJar() {
}

private void decompileSaveOpenedClasses() {
if (workPane.getCurrentViewer() == null) {
if (FileViewerPane.getCurrentViewer() == null) {
JDA.showMessage("First open a class, jar, or zip file.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.api.ExceptionUI;
import the.bytecode.club.jda.decompilers.Decompiler;
import the.bytecode.club.jda.gui.fileviewer.ClassViewer;
import the.bytecode.club.jda.settings.Settings;

import javax.swing.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import org.apache.commons.io.IOUtils;
import the.bytecode.club.jda.JDA;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.JarUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.api.ExceptionUI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import net.miginfocom.swing.MigLayout;
import the.bytecode.club.jda.settings.Settings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import org.apache.commons.io.IOUtils;
import the.bytecode.club.jda.Resources;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.Resources;
import the.bytecode.club.jda.gui.fileviewer.SearchPanel;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.dialogs;

import javax.swing.*;
import javax.swing.plaf.basic.BasicButtonUI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.fileviewer;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.decompilers.Decompiler;
import the.bytecode.club.jda.gui.PaneUpdaterThread;

import javax.swing.*;
import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.fileviewer;

import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.fileviewer;

import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.jda.FileChangeNotifier;
import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.Resources;
import the.bytecode.club.jda.gui.JDAWindow;
import the.bytecode.club.jda.gui.MainViewerGUI;
import the.bytecode.club.jda.gui.dialogs.TabbedPane;
import the.bytecode.club.jda.gui.navigation.FileNavigationPane;

import javax.swing.*;
import java.awt.*;
Expand All @@ -20,21 +24,21 @@
* @author WaterWolf
*/

public class WorkPane extends JDAWindow implements ActionListener {
public class FileViewerPane extends JDAWindow implements ActionListener {

private static final long serialVersionUID = 6542337997679487946L;

FileChangeNotifier fcn;
public JTabbedPane tabs;

JPanel buttonPanel;
JButton refreshClass;
public JButton refreshClass;

HashMap<String, Integer> workingOn = new HashMap<>();

public static int SyntaxFontHeight = 12;

public WorkPane(final FileChangeNotifier fcn) {
public FileViewerPane(final FileChangeNotifier fcn) {
super("WorkPanel", "Work Space", Resources.fileNavigatorIcon, (MainViewerGUI) fcn);

this.tabs = new JTabbedPane();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.fileviewer;

import the.bytecode.club.jda.JDA;
import the.bytecode.club.jda.Resources;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package the.bytecode.club.jda.gui;
package the.bytecode.club.jda.gui.fileviewer;

import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.jda.settings.Settings;
Expand Down
Loading

0 comments on commit ecafc23

Please sign in to comment.