Update settings without needing to refresh
This commit is contained in:
parent
05c6148ff5
commit
e25d6179f3
4 changed files with 32 additions and 16 deletions
|
@ -20,6 +20,7 @@ import the.bytecode.club.bytecodeviewer.api.ClassNodeLoader;
|
|||
import the.bytecode.club.bytecodeviewer.compilers.Compilers;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.DecompilerViewComponent;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.ResourcePanelCompileMode;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourcelist.ResourceListPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI;
|
||||
|
@ -27,6 +28,7 @@ import the.bytecode.club.bytecodeviewer.gui.components.RunOptions;
|
|||
import the.bytecode.club.bytecodeviewer.gui.resourcesearch.SearchBoxPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.SystemErrConsole;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.WorkPaneMainComponent;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
|
||||
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
|
||||
import the.bytecode.club.bytecodeviewer.util.*;
|
||||
|
@ -71,6 +73,8 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
|
|||
* http://the.bytecode.club
|
||||
*
|
||||
* TODO BUGS:
|
||||
* + Removing a tab disrupts the tab order
|
||||
* Tab index orders need to be recounted on removal probably
|
||||
* + Last selected directory isn't set on most file chooser dialogues
|
||||
* + Synchronized scrolling is broken
|
||||
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
|
||||
|
@ -601,6 +605,15 @@ public class BytecodeViewer
|
|||
tempF.mkdir();
|
||||
}
|
||||
|
||||
public static void refreshAllTabTitles()
|
||||
{
|
||||
for(int i = 0; i < BytecodeViewer.viewer.workPane.tabs.getTabCount(); i++)
|
||||
{
|
||||
ResourceViewer viewer = ((TabbedPane) BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i)).resource;
|
||||
viewer.refreshTitle();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the hotkeys
|
||||
*
|
||||
|
|
|
@ -544,10 +544,12 @@ public class MainViewerGUI extends JFrame
|
|||
showFileInTabTitle.addActionListener(arg0 -> {
|
||||
Configuration.displayParentInTab = BytecodeViewer.viewer.showFileInTabTitle.isSelected();
|
||||
Settings.saveSettings();
|
||||
BytecodeViewer.refreshAllTabTitles();
|
||||
});
|
||||
simplifyNameInTabTitle.addActionListener(arg0 -> {
|
||||
Configuration.simplifiedTabNames = BytecodeViewer.viewer.simplifyNameInTabTitle.isSelected();
|
||||
Settings.saveSettings();
|
||||
BytecodeViewer.refreshAllTabTitles();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
|||
import the.bytecode.club.bytecodeviewer.gui.components.ButtonHoverAnimation;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MaxWidthJLabel;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.listeners.MouseClickedListener;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||
import the.bytecode.club.bytecodeviewer.gui.util.DelayTabbedPaneThread;
|
||||
|
||||
/***************************************************************************
|
||||
|
@ -48,17 +49,19 @@ public class TabbedPane extends JPanel
|
|||
private long startedDragging = 0;
|
||||
public final String tabName;
|
||||
public final String fileContainerName;
|
||||
public final ResourceViewer resource;
|
||||
private static long lastMouseClick = System.currentTimeMillis();
|
||||
public final static MouseListener buttonHoverAnimation = new ButtonHoverAnimation();
|
||||
public static final Color BLANK_COLOR = new Color(0, 0, 0, 0);
|
||||
|
||||
public TabbedPane(int tabIndex, String tabWorkingName, String fileContainerName, String name, final JTabbedPane existingTabs)
|
||||
public TabbedPane(int tabIndex, String tabWorkingName, String fileContainerName, String name, final JTabbedPane existingTabs, ResourceViewer resource)
|
||||
{
|
||||
// unset default FlowLayout' gaps
|
||||
super(new FlowLayout(FlowLayout.LEFT, 0, 0));
|
||||
|
||||
this.tabName = name;
|
||||
this.fileContainerName = fileContainerName;
|
||||
this.resource = resource;
|
||||
|
||||
if (existingTabs == null)
|
||||
throw new NullPointerException("TabbedPane is null");
|
||||
|
|
|
@ -14,13 +14,11 @@ import javax.swing.JPopupMenu;
|
|||
import javax.swing.JTabbedPane;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.VisibleComponent;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.FileViewer;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.BLOCK_TAB_MENU;
|
||||
|
||||
|
@ -164,16 +162,16 @@ public class WorkPaneMainComponent extends VisibleComponent
|
|||
|
||||
if (!workingOn.containsKey(workingName))
|
||||
{
|
||||
final ClassViewer tabComp = new ClassViewer(container, name, cn, workingName);
|
||||
tabs.add(tabComp);
|
||||
final int tabIndex = tabs.indexOfComponent(tabComp);
|
||||
final ClassViewer resourceView = new ClassViewer(container, name, cn, workingName);
|
||||
tabs.add(resourceView);
|
||||
final int tabIndex = tabs.indexOfComponent(resourceView);
|
||||
workingOn.put(workingName, tabIndex);
|
||||
|
||||
TabbedPane tabbedPane = new TabbedPane(tabIndex, workingName, container.name, name, tabs);
|
||||
tabComp.tabbedPane = tabbedPane;
|
||||
TabbedPane tabbedPane = new TabbedPane(tabIndex, workingName, container.name, name, tabs, resourceView);
|
||||
resourceView.tabbedPane = tabbedPane;
|
||||
tabs.setTabComponentAt(tabIndex, tabbedPane);
|
||||
tabs.setSelectedIndex(tabIndex);
|
||||
tabComp.refreshTitle();
|
||||
resourceView.refreshTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -196,16 +194,16 @@ public class WorkPaneMainComponent extends VisibleComponent
|
|||
|
||||
if (!workingOn.containsKey(workingName))
|
||||
{
|
||||
final FileViewer tabComp = new FileViewer(container, name, contents, workingName);
|
||||
tabs.add(tabComp);
|
||||
final int tabIndex = tabs.indexOfComponent(tabComp);
|
||||
final FileViewer resourceView = new FileViewer(container, name, contents, workingName);
|
||||
tabs.add(resourceView);
|
||||
final int tabIndex = tabs.indexOfComponent(resourceView);
|
||||
workingOn.put(workingName, tabIndex);
|
||||
|
||||
TabbedPane tabbedPane = new TabbedPane(tabIndex, workingName, container.name, name, tabs);
|
||||
tabComp.tabbedPane = tabbedPane;
|
||||
TabbedPane tabbedPane = new TabbedPane(tabIndex, workingName, container.name, name, tabs, resourceView);
|
||||
resourceView.tabbedPane = tabbedPane;
|
||||
tabs.setTabComponentAt(tabIndex, tabbedPane);
|
||||
tabs.setSelectedIndex(tabIndex);
|
||||
tabComp.refreshTitle();
|
||||
resourceView.refreshTitle();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue