jode.Decompiler moved to jode.decompiler.Options

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1204 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent 49aa106080
commit 7eb76796d2
  1. 1
      jode/jode/swingui/HierarchyTreeModel.java.in
  2. 49
      jode/jode/swingui/Main.java.in
  3. 4
      jode/jode/swingui/PackagesTreeModel.java.in

@ -18,7 +18,6 @@
*/ */
package jode.swingui; package jode.swingui;
import jode.Decompiler;
import jode.bytecode.ClassInfo; import jode.bytecode.ClassInfo;
import @JAVAX_SWING@.JProgressBar; import @JAVAX_SWING@.JProgressBar;

@ -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);
} }
} }
} }

@ -18,7 +18,7 @@
*/ */
package jode.swingui; package jode.swingui;
import jode.Decompiler; import jode.decompiler.Options;
import jode.bytecode.ClassInfo; import jode.bytecode.ClassInfo;
import @JAVAX_SWING@.tree.TreeModel; import @JAVAX_SWING@.tree.TreeModel;
@ -122,7 +122,7 @@ public class PackagesTreeModel implements TreeModel {
String fqn = prefix + name; String fqn = prefix + name;
boolean isClass = !ClassInfo.isPackage(fqn); boolean isClass = !ClassInfo.isPackage(fqn);
if (isClass && Decompiler.skipClass(ClassInfo.forName(fqn))) if (isClass && Options.skipClass(ClassInfo.forName(fqn)))
continue; continue;
TreeElement newElem = new TreeElement(prefix, name, isClass); TreeElement newElem = new TreeElement(prefix, name, isClass);
v.add(newElem); v.add(newElem);

Loading…
Cancel
Save