|
|
@ -125,33 +125,9 @@ public class Main |
|
|
|
|
|
|
|
|
|
|
|
public synchronized void actionPerformed(ActionEvent e) { |
|
|
|
public synchronized void actionPerformed(ActionEvent e) { |
|
|
|
if (e.getSource() == classTree && decompileThread == null) { |
|
|
|
if (e.getSource() == classTree && decompileThread == null) { |
|
|
|
// startButton.setEnabled(false);
|
|
|
|
|
|
|
|
decompileThread = new Thread(this); |
|
|
|
decompileThread = new Thread(this); |
|
|
|
sourcecodeArea.setText("Please wait, while decompiling...\n"); |
|
|
|
sourcecodeArea.setText("Please wait, while decompiling...\n"); |
|
|
|
decompileThread.start(); |
|
|
|
decompileThread.start(); |
|
|
|
// } else if (e.getSource() == saveButton) {
|
|
|
|
|
|
|
|
// if (frame == null)
|
|
|
|
|
|
|
|
// frame = new Frame(); //XXX
|
|
|
|
|
|
|
|
// FileDialog fd = new FileDialog(frame,
|
|
|
|
|
|
|
|
// "Save decompiled code",
|
|
|
|
|
|
|
|
// FileDialog.SAVE);
|
|
|
|
|
|
|
|
// fd.setFile(lastClassName.substring
|
|
|
|
|
|
|
|
// (lastClassName.lastIndexOf('.')+1).concat(".java"));
|
|
|
|
|
|
|
|
// fd.show();
|
|
|
|
|
|
|
|
// String fileName = fd.getFile();
|
|
|
|
|
|
|
|
// if (fileName == null)
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// File f = new File(new File(fd.getDirectory()), fileName);
|
|
|
|
|
|
|
|
// FileWriter out = new FileWriter(f);
|
|
|
|
|
|
|
|
// out.write(sourcecodeArea.getText());
|
|
|
|
|
|
|
|
// out.close();
|
|
|
|
|
|
|
|
// } catch (IOException ex) {
|
|
|
|
|
|
|
|
// errorArea.setText("");
|
|
|
|
|
|
|
|
// GlobalOptions.err.println("Couldn't write to file "
|
|
|
|
|
|
|
|
// + fileName + ": ");
|
|
|
|
|
|
|
|
// ex.printStackTrace(GlobalOptions.err);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -168,11 +144,7 @@ public class Main |
|
|
|
area.setText(""); |
|
|
|
area.setText(""); |
|
|
|
initialized = true; |
|
|
|
initialized = true; |
|
|
|
} |
|
|
|
} |
|
|
|
///#ifdef AWT10
|
|
|
|
|
|
|
|
/// area.appendText(new String(b, off, len));
|
|
|
|
|
|
|
|
///#else
|
|
|
|
|
|
|
|
area.append(new String(b, off, len)); |
|
|
|
area.append(new String(b, off, len)); |
|
|
|
///#endif
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void flush() { |
|
|
|
public void flush() { |
|
|
@ -183,35 +155,19 @@ public class Main |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void run() { |
|
|
|
public void run() { |
|
|
|
// Decompiler.isVerbose = verboseCheck.getState();
|
|
|
|
|
|
|
|
// if (prettyCheck.getState())
|
|
|
|
|
|
|
|
// Decompiler.options |= Decompiler.OPTION_PRETTY;
|
|
|
|
|
|
|
|
// else
|
|
|
|
|
|
|
|
// Decompiler.options &= ~Decompiler.OPTION_PRETTY;
|
|
|
|
|
|
|
|
errorArea.setText(""); |
|
|
|
errorArea.setText(""); |
|
|
|
// saveButton.setEnabled(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImportHandler imports = new ImportHandler(); |
|
|
|
ImportHandler imports = new ImportHandler(); |
|
|
|
try { |
|
|
|
try { |
|
|
|
ClassInfo clazz = ClassInfo.forName(lastClassName); |
|
|
|
ClassInfo clazz = ClassInfo.forName(lastClassName); |
|
|
|
|
|
|
|
|
|
|
|
imports.init(lastClassName); |
|
|
|
|
|
|
|
ClassAnalyzer clazzAna = new ClassAnalyzer(null, clazz, imports); |
|
|
|
|
|
|
|
clazzAna.analyze(); |
|
|
|
|
|
|
|
clazzAna.analyzeInnerClasses(); |
|
|
|
|
|
|
|
clazzAna.makeDeclaration(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sourcecodeArea.setText(""); |
|
|
|
|
|
|
|
TabbedPrintWriter writer = |
|
|
|
TabbedPrintWriter writer = |
|
|
|
new TabbedPrintWriter |
|
|
|
new TabbedPrintWriter |
|
|
|
(new BufferedWriter |
|
|
|
(new BufferedWriter |
|
|
|
(new AreaWriter(sourcecodeArea), 1024), imports, false); |
|
|
|
(new AreaWriter(sourcecodeArea), 1024), imports, false); |
|
|
|
|
|
|
|
ClassAnalyzer clazzAna = new ClassAnalyzer(null, clazz, imports); |
|
|
|
imports.dumpHeader(writer); |
|
|
|
clazzAna.dumpJavaFile(writer); |
|
|
|
clazzAna.dumpSource(writer); |
|
|
|
|
|
|
|
writer.close(); |
|
|
|
writer.close(); |
|
|
|
|
|
|
|
|
|
|
|
// saveButton.setEnabled(true);
|
|
|
|
|
|
|
|
} catch (Throwable t) { |
|
|
|
} catch (Throwable t) { |
|
|
|
sourcecodeArea.setText("Didn't succeed.\n" |
|
|
|
sourcecodeArea.setText("Didn't succeed.\n" |
|
|
|
+"Check the below area for more info."); |
|
|
|
+"Check the below area for more info."); |
|
|
@ -219,7 +175,6 @@ public class Main |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
synchronized(this) { |
|
|
|
synchronized(this) { |
|
|
|
decompileThread = null; |
|
|
|
decompileThread = null; |
|
|
|
// startButton.setEnabled(true);
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|