Cleanup
This commit is contained in:
parent
8116cacd49
commit
69b282aa2d
5 changed files with 41 additions and 52 deletions
|
@ -561,6 +561,7 @@ public class MainViewerGUI extends JFrame
|
|||
//FERNFLOWER SETTINGS
|
||||
//settingsMainMenu.add(fernFlowerSettingsSecondaryMenu);
|
||||
settingsMainMenu.add(fernFlowerSettings);
|
||||
fernFlowerSettingsSecondaryMenu.add(ren);
|
||||
fernFlowerSettingsSecondaryMenu.add(dc4);
|
||||
fernFlowerSettingsSecondaryMenu.add(nns);
|
||||
fernFlowerSettingsSecondaryMenu.add(ner);
|
||||
|
@ -579,7 +580,6 @@ public class MainViewerGUI extends JFrame
|
|||
fernFlowerSettingsSecondaryMenu.add(udv);
|
||||
fernFlowerSettingsSecondaryMenu.add(fdi);
|
||||
fernFlowerSettingsSecondaryMenu.add(asc);
|
||||
fernFlowerSettingsSecondaryMenu.add(ren);
|
||||
fernFlowerSettingsDialogue = new SettingsDialogue(
|
||||
fernFlowerSettingsSecondaryMenu,
|
||||
new JPanel());
|
||||
|
|
|
@ -16,6 +16,7 @@ import static javax.swing.JOptionPane.*;
|
|||
* @author Scott Violet
|
||||
* @since 7/4/2021
|
||||
*/
|
||||
|
||||
public class BetterJOptionPane
|
||||
{
|
||||
public static void showMessageDialog(Component parentComponent,
|
||||
|
@ -85,30 +86,13 @@ public class BetterJOptionPane
|
|||
getRootFrame() : parentComponent).getComponentOrientation());
|
||||
|
||||
int style = styleFromMessageType(messageType);
|
||||
|
||||
//reflection to cheat our way around the
|
||||
// private createDialog(Component parentComponent, String title, int style)
|
||||
JDialog dialog = null;
|
||||
try
|
||||
JDialog dialog = createNewJDialogue(parentComponent, pane, title, style, (d)->
|
||||
{
|
||||
Method createDialog = pane.getClass().getDeclaredMethod("createDialog", Component.class, String.class, int.class);
|
||||
createDialog.setAccessible(true);
|
||||
dialog = (JDialog) createDialog.invoke(pane, parentComponent, title, style);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
pane.selectInitialValue();
|
||||
});
|
||||
|
||||
pane.selectInitialValue();
|
||||
|
||||
//check if the dialogue is in a poor location, attempt to correct
|
||||
if(dialog.getLocation().getY() == 0)
|
||||
dialog.setLocationRelativeTo(null);
|
||||
|
||||
dialog.show();
|
||||
dialog.dispose();
|
||||
|
||||
Object selectedValue = pane.getValue();
|
||||
|
||||
if(selectedValue == null)
|
||||
|
@ -146,57 +130,49 @@ public class BetterJOptionPane
|
|||
getRootFrame() : parentComponent).getComponentOrientation());
|
||||
|
||||
int style = styleFromMessageType(messageType);
|
||||
//reflection to cheat our way around the
|
||||
// private createDialog(Component parentComponent, String title, int style)
|
||||
JDialog dialog = null;
|
||||
try
|
||||
JDialog dialog = createNewJDialogue(parentComponent, pane, title, style, (d)->
|
||||
{
|
||||
Method createDialog = pane.getClass().getDeclaredMethod("createDialog", Component.class, String.class, int.class);
|
||||
createDialog.setAccessible(true);
|
||||
dialog = (JDialog) createDialog.invoke(pane, parentComponent, title, style);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
pane.selectInitialValue();
|
||||
});
|
||||
|
||||
pane.selectInitialValue();
|
||||
|
||||
//check if the dialogue is in a poor location, attempt to correct
|
||||
if(dialog.getLocation().getY() == 0)
|
||||
dialog.setLocationRelativeTo(null);
|
||||
|
||||
dialog.show();
|
||||
dialog.dispose();
|
||||
|
||||
Object value = pane.getInputValue();
|
||||
|
||||
if (value == UNINITIALIZED_VALUE) {
|
||||
if (value == UNINITIALIZED_VALUE)
|
||||
return null;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public static void showJPanelDialogue(Component parentComponent, JScrollPane panel, int minimumHeight)
|
||||
throws HeadlessException
|
||||
{
|
||||
//create a new option pane with a empty text and just 'ok'
|
||||
JOptionPane pane = new JOptionPane("");
|
||||
pane.add(panel, 0);
|
||||
|
||||
JDialog dialog = createNewJDialogue(parentComponent, pane, panel.getName(), 0, (d)->
|
||||
{
|
||||
int newHeight = Math.min(minimumHeight, d.getHeight());
|
||||
d.setMinimumSize(new Dimension(d.getWidth(), newHeight));
|
||||
d.setSize(new Dimension(d.getWidth(), newHeight));
|
||||
});
|
||||
}
|
||||
|
||||
private static JDialog createNewJDialogue(Component parentComponent, JOptionPane pane, String title, int style, OnCreate onCreate)
|
||||
{
|
||||
JDialog dialog = null;
|
||||
|
||||
//reflection to cheat our way around the
|
||||
// private createDialog(Component parentComponent, String title, int style)
|
||||
JDialog dialog = null;
|
||||
try
|
||||
{
|
||||
Method createDialog = pane.getClass().getDeclaredMethod("createDialog", Component.class, String.class, int.class);
|
||||
createDialog.setAccessible(true);
|
||||
dialog = (JDialog) createDialog.invoke(pane, parentComponent, panel.getName(), 0);
|
||||
dialog = (JDialog) createDialog.invoke(pane, parentComponent, title, style);
|
||||
|
||||
//dialog.setResizable(true);
|
||||
|
||||
int newHeight = minimumHeight < dialog.getHeight() ? minimumHeight : dialog.getHeight();
|
||||
dialog.setMinimumSize(new Dimension(dialog.getWidth(), newHeight));
|
||||
dialog.setSize(new Dimension(dialog.getWidth(), newHeight));
|
||||
onCreate.onCreate(dialog);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -209,6 +185,8 @@ public class BetterJOptionPane
|
|||
|
||||
dialog.show();
|
||||
dialog.dispose();
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private static int styleFromMessageType(int messageType)
|
||||
|
@ -228,4 +206,9 @@ public class BetterJOptionPane
|
|||
return JRootPane.PLAIN_DIALOG;
|
||||
}
|
||||
}
|
||||
|
||||
interface OnCreate
|
||||
{
|
||||
void onCreate(JDialog dialog);
|
||||
}
|
||||
}
|
|
@ -83,7 +83,7 @@ public class FileViewer extends ResourceViewer
|
|||
// + Add file header checks
|
||||
// + Check for CAFEBABE
|
||||
// + ClassRead then quick-decompile using Pane1 Decompiler
|
||||
// (If none selected, try Pane2, Pane3, default to Proycon)
|
||||
// (If none selected, try Pane2, Pane3, default to Procyon)
|
||||
|
||||
|
||||
//check by file extension to display image
|
||||
|
|
|
@ -102,7 +102,13 @@ public enum LAFTheme
|
|||
Configuration.showDarkLAFComponentIcons = darkLAF;
|
||||
|
||||
if(BytecodeViewer.viewer != null)
|
||||
{
|
||||
BytecodeViewer.viewer.uiComponents.forEach(VisibleComponent::setDefaultIcon);
|
||||
SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.procyonSettingsDialogue);
|
||||
SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.cfrSettingsDialogue);
|
||||
SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.fernFlowerSettingsDialogue);
|
||||
SwingUtilities.updateComponentTreeUI(BytecodeViewer.viewer.bytecodeDecompilerSettingsDialogue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -81,7 +81,7 @@ public class ResourceDecompiling
|
|||
Thread t12 = new Thread(() -> {
|
||||
try {
|
||||
Decompiler.PROCYON_DECOMPILER.getDecompiler().decompileToZip(tempZip.getAbsolutePath(),
|
||||
MiscUtils.append(javaSucks, "-proycon.zip"));
|
||||
MiscUtils.append(javaSucks, "-procyon.zip"));
|
||||
BytecodeViewer.updateBusyStatus(false);
|
||||
} catch (Exception e) {
|
||||
BytecodeViewer.handleException(e);
|
||||
|
@ -241,7 +241,7 @@ public class ResourceDecompiling
|
|||
}
|
||||
|
||||
try {
|
||||
DiskWriter.replaceFile(MiscUtils.append(file, "-proycon.java"),
|
||||
DiskWriter.replaceFile(MiscUtils.append(file, "-procyon.java"),
|
||||
Decompiler.PROCYON_DECOMPILER.getDecompiler().decompileClassNode(cn, cw.toByteArray()), false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
Loading…
Reference in a new issue