Resource Refreshing
This commit is contained in:
parent
33ec3f3fdb
commit
3df104c86b
7 changed files with 62 additions and 16 deletions
|
@ -17,6 +17,8 @@ import the.bytecode.club.bytecodeviewer.gui.resourcelist.ResourceListPane;
|
|||
import the.bytecode.club.bytecodeviewer.gui.resourcesearch.SearchBoxPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.DecompilerSelectionPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.WorkPaneMainComponent;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ClassViewer;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer;
|
||||
import the.bytecode.club.bytecodeviewer.gui.theme.LAFTheme;
|
||||
import the.bytecode.club.bytecodeviewer.gui.theme.RSTATheme;
|
||||
import the.bytecode.club.bytecodeviewer.obfuscators.rename.RenameClasses;
|
||||
|
@ -27,7 +29,7 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginTemplate;
|
|||
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.*;
|
||||
import the.bytecode.club.bytecodeviewer.resources.ExternalResources;
|
||||
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
|
||||
import the.bytecode.club.bytecodeviewer.resources.Resources;
|
||||
import the.bytecode.club.bytecodeviewer.resources.IconResources;
|
||||
import the.bytecode.club.bytecodeviewer.resources.exporting.Export;
|
||||
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJCheckBoxMenuItem;
|
||||
import the.bytecode.club.bytecodeviewer.translation.components.TranslatedJRadioButtonMenuItem;
|
||||
|
@ -119,6 +121,7 @@ public class MainViewerGUI extends JFrame
|
|||
public final JMenuItem zStringArrayDecrypter = new TranslatedJMenuItem("ZStringArray Decrypter", Translation.ZSTRINGARRAY_DECRYPTER);
|
||||
public final JMenuItem viewAPKAndroidPermissions = new JMenuItem("View Android Permissions");
|
||||
public final JMenuItem viewManifest = new JMenuItem("View Manifest");
|
||||
public final JMenuItem changeClassFileVersions = new JMenuItem("Change ClassFile Versions");
|
||||
|
||||
//all of the settings main menu components
|
||||
public final ButtonGroup apkConversionGroup = new ButtonGroup();
|
||||
|
@ -259,7 +262,7 @@ public class MainViewerGUI extends JFrame
|
|||
|
||||
public MainViewerGUI()
|
||||
{
|
||||
setIconImages(Resources.iconList);
|
||||
setIconImages(IconResources.iconList);
|
||||
setSize(new Dimension(800, 488));
|
||||
|
||||
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||
|
@ -405,6 +408,7 @@ public class MainViewerGUI extends JFrame
|
|||
Configuration.rstaTheme = t;
|
||||
item.setSelected(true);
|
||||
SettingsSerializer.saveSettingsAsync();
|
||||
updateTabTheme();
|
||||
});
|
||||
|
||||
rstaThemes.put(t, item);
|
||||
|
@ -431,7 +435,7 @@ public class MainViewerGUI extends JFrame
|
|||
try
|
||||
{
|
||||
theme.setLAF();
|
||||
SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer);
|
||||
updateTabTheme();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -600,6 +604,7 @@ public class MainViewerGUI extends JFrame
|
|||
pluginsMainMenu.add(showAllStrings);
|
||||
pluginsMainMenu.add(replaceStrings);
|
||||
pluginsMainMenu.add(stackFramesRemover);
|
||||
pluginsMainMenu.add(changeClassFileVersions);
|
||||
|
||||
//allatori is disabled since they are just placeholders
|
||||
//ZKM and ZStringArray decrypter are disabled until deobfuscation has been extended
|
||||
|
@ -621,6 +626,7 @@ public class MainViewerGUI extends JFrame
|
|||
zStringArrayDecrypter.addActionListener(arg0 -> PluginManager.runPlugin(new ZStringArrayDecrypter()));
|
||||
viewAPKAndroidPermissions.addActionListener(arg0 -> PluginManager.runPlugin(new ViewAPKAndroidPermissions()));
|
||||
viewManifest.addActionListener(arg0 -> PluginManager.runPlugin(new ViewManifest()));
|
||||
changeClassFileVersions.addActionListener(arg0 -> PluginManager.runPlugin(new ChangeClassFileVersions()));
|
||||
}
|
||||
|
||||
public void buildObfuscateMenu()
|
||||
|
@ -888,5 +894,31 @@ public class MainViewerGUI extends JFrame
|
|||
Configuration.deleteForeignLibraries = deleteForeignOutdatedLibs.isSelected();
|
||||
}
|
||||
|
||||
public void updateTabTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
for(Component viewerComponent : BytecodeViewer.viewer.workPane.tabs.getComponents())
|
||||
{
|
||||
if(!(viewerComponent instanceof ResourceViewer))
|
||||
continue;
|
||||
|
||||
ResourceViewer viewerResource = (ResourceViewer) viewerComponent;
|
||||
if(!(viewerResource instanceof ClassViewer))
|
||||
continue;
|
||||
|
||||
ClassViewer viewerClass = (ClassViewer) viewerResource;
|
||||
Configuration.rstaTheme.apply(viewerClass.resourceViewPanel1.textArea);
|
||||
Configuration.rstaTheme.apply(viewerClass.resourceViewPanel2.textArea);
|
||||
Configuration.rstaTheme.apply(viewerClass.resourceViewPanel3.textArea);
|
||||
}
|
||||
SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static final long serialVersionUID = 1851409230530948543L;
|
||||
}
|
|
@ -184,7 +184,7 @@ public class WorkPaneMainComponent extends TranslatedVisibleComponent
|
|||
{
|
||||
if(resourceView instanceof ClassViewer)
|
||||
{
|
||||
((ClassViewer)resourceView).startPaneUpdater(null);
|
||||
((ClassViewer)resourceView).refresh(null);
|
||||
}
|
||||
|
||||
resourceView.workingName = workingName;
|
||||
|
|
|
@ -3,6 +3,7 @@ package the.bytecode.club.bytecodeviewer.gui.resourceviewer;
|
|||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
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 javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
@ -30,18 +31,13 @@ public class WorkPaneRefresh implements Runnable
|
|||
if(event != null && event.getSource() instanceof JButton)
|
||||
src = (JButton) event.getSource();
|
||||
|
||||
final Component tabComp = BytecodeViewer.viewer.workPane.tabs.getSelectedComponent();
|
||||
final ResourceViewer tabComp = (ResourceViewer) BytecodeViewer.viewer.workPane.tabs.getSelectedComponent();
|
||||
|
||||
if(tabComp == null)
|
||||
return;
|
||||
|
||||
BytecodeViewer.updateBusyStatus(true);
|
||||
|
||||
if (tabComp instanceof ClassViewer)
|
||||
((ClassViewer) tabComp).startPaneUpdater(src);
|
||||
else if (tabComp instanceof FileViewer)
|
||||
((FileViewer) tabComp).refresh(src);
|
||||
|
||||
tabComp.refresh(src);
|
||||
BytecodeViewer.updateBusyStatus(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ public class ClassViewer extends ResourceViewer
|
|||
});
|
||||
}
|
||||
|
||||
public void startPaneUpdater(final JButton button)
|
||||
@Override
|
||||
public void refresh(final JButton button)
|
||||
{
|
||||
this.cn = container.getClassNode(cn.name); //update the classnode
|
||||
|
||||
|
|
|
@ -122,13 +122,15 @@ public class FileViewer extends ResourceViewer
|
|||
mainPanel.add(textArea.getScrollPane());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(JButton src)
|
||||
{
|
||||
refreshTitle();
|
||||
|
||||
if (!canRefresh)
|
||||
{
|
||||
src.setEnabled(true);
|
||||
if(src != null)
|
||||
src.setEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -139,8 +141,9 @@ public class FileViewer extends ResourceViewer
|
|||
JLabel label = new JLabel("", new ImageIcon(image), JLabel.CENTER);
|
||||
mainPanel.add(label, BorderLayout.CENTER);
|
||||
mainPanel.updateUI();
|
||||
|
||||
src.setEnabled(true);
|
||||
|
||||
if(src != null)
|
||||
src.setEnabled(true);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = 6103372882168257164L;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.*;
|
||||
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourceviewer.TabbedPane;
|
||||
|
@ -62,6 +63,9 @@ public abstract class ResourceViewer extends JPanel
|
|||
return container.getBytes(name);
|
||||
}
|
||||
|
||||
|
||||
public abstract void refresh(final JButton button);
|
||||
|
||||
/**
|
||||
* Updates the tab's title
|
||||
*/
|
||||
|
|
|
@ -116,6 +116,16 @@ public class ResourceContainer
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates this container's class node byte[] map
|
||||
*/
|
||||
public ResourceContainer updateClassNodeBytes()
|
||||
{
|
||||
resourceClassBytes.clear();
|
||||
resourceClasses.forEach((s, cn) -> resourceClassBytes.put(s, ASMUtil.nodeToBytes(cn)));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a resource container's resources into this container
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue