0001: /*
0002: * JDecTree.java Copyright (c) 2006,07 Swaroop Belur
0003: *
0004: * This program is free software; you can redistribute it and/or
0005: * modify it under the terms of the GNU General Public License
0006: * as published by the Free Software Foundation; either version 2
0007: * of the License, or (at your option) any later version.
0008:
0009: * This program is distributed in the hope that it will be useful,
0010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0012: * GNU General Public License for more details.
0013:
0014: * You should have received a copy of the GNU General Public License
0015: * along with this program; if not, write to the Free Software
0016: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0017: *
0018: */
0019:
0020: package net.sf.jdec.ui.core;
0021:
0022: import net.sf.jdec.config.Configuration;
0023: import net.sf.jdec.core.InnerClassTracker;
0024: import net.sf.jdec.main.ConsoleLauncher;
0025: import net.sf.jdec.ui.adapter.DecompilerBridge;
0026: import net.sf.jdec.ui.main.UILauncher;
0027: import net.sf.jdec.ui.util.LogWriter;
0028: import net.sf.jdec.ui.util.UIConstants;
0029: import net.sf.jdec.ui.util.UIUtil;
0030: import net.sf.jdec.util.ClassStructure;
0031:
0032: import javax.swing.*;
0033: import javax.swing.event.TreeExpansionEvent;
0034: import javax.swing.event.TreeExpansionListener;
0035: import javax.swing.event.TreeSelectionEvent;
0036: import javax.swing.event.TreeSelectionListener;
0037: import javax.swing.tree.DefaultMutableTreeNode;
0038: import javax.swing.tree.DefaultTreeModel;
0039: import javax.swing.tree.TreePath;
0040: import javax.swing.tree.TreeSelectionModel;
0041: import java.awt.*;
0042: import java.io.File;
0043: import java.io.FileReader;
0044: import java.io.IOException;
0045: import java.util.ArrayList;
0046: import java.util.HashMap;
0047: import java.util.StringTokenizer;
0048:
0049: public class JdecTree extends JInternalFrame {
0050:
0051: protected JTree mainTree;
0052:
0053: protected DefaultTreeModel treeModel;
0054:
0055: private ArrayList methodList = null;
0056:
0057: private boolean process = true;
0058:
0059: public JdecTree() {
0060: super ("File/Folder List On System");
0061: TreeObject to = new TreeObject("Directory-Structure");
0062: DefaultMutableTreeNode top = new DefaultMutableTreeNode(to);
0063: DefaultMutableTreeNode node;
0064: File[] roots = File.listRoots();
0065: for (int k = 0; k < roots.length; k++) {
0066: node = new DefaultMutableTreeNode(new TreeObject(roots[k]));
0067: node.add(new DefaultMutableTreeNode(
0068: "Getting Child Nodes For "
0069: + roots[k].getAbsolutePath()));
0070: top.add(node);
0071: }
0072: to.setRoots(roots);
0073: treeModel = new DefaultTreeModel(top);
0074: mainTree = new JTree(treeModel);
0075: mainTree.getSelectionModel().setSelectionMode(
0076: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
0077: mainTree
0078: .addTreeExpansionListener(new JDecTreeExpansionListener());
0079: mainTree
0080: .addTreeSelectionListener(new JdecTreeSelectionListener());
0081: mainTree.setShowsRootHandles(true);
0082: mainTree.setEditable(false);
0083: JScrollPane s = new JScrollPane();
0084: s.getViewport().add(mainTree);
0085: getContentPane().add(s, BorderLayout.CENTER);
0086: // mainTree.setBackground(Color.LIGHT_GRAY);
0087: setVisible(true);
0088: }
0089:
0090: public JdecTree(String dirStart) {
0091: super ("File/Folder List On System");
0092: TreeObject tobj = new TreeObject("Directory-Structure");
0093: DefaultMutableTreeNode top = new DefaultMutableTreeNode(tobj);
0094: DefaultMutableTreeNode node;
0095: File roots[] = { new File(dirStart) };
0096: for (int k = 0; k < roots.length; k++) {
0097: TreeObject to = new TreeObject(roots[k]);
0098: to.setPassedDirectoryList(dirStart);
0099: node = new DefaultMutableTreeNode(to);
0100: node.add(new DefaultMutableTreeNode(
0101: "Getting Child Nodes For "
0102: + roots[k].getAbsolutePath()));
0103: top.add(node);
0104: }
0105: tobj.setRoots(roots);
0106: treeModel = new DefaultTreeModel(top);
0107: mainTree = new JTree(treeModel);
0108: mainTree.getSelectionModel().setSelectionMode(
0109: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
0110: mainTree
0111: .addTreeExpansionListener(new JDecTreeExpansionListener());
0112: mainTree
0113: .addTreeSelectionListener(new JdecTreeSelectionListener());
0114: mainTree.setShowsRootHandles(true);
0115: mainTree.setEditable(false);
0116: JScrollPane s = new JScrollPane();
0117: s.getViewport().add(mainTree);
0118: // mainTree.setBackground(Color.LIGHT_GRAY);
0119: getContentPane().add(s, BorderLayout.CENTER);
0120: setVisible(true);
0121: }
0122:
0123: // Use for favorite display only
0124: public JdecTree(String[] favorite) {
0125: super ("Favorite Folder List On System");
0126: if (favorite == null || favorite.length == 0)
0127: return;
0128: TreeObject to = new TreeObject("Directory-Structure");
0129: DefaultMutableTreeNode top = new DefaultMutableTreeNode(to);
0130: DefaultMutableTreeNode node;
0131: File roots[] = new File[favorite.length];
0132: for (int z = 0; z < favorite.length; z++) {
0133: roots[z] = new File(favorite[z].toString());
0134: }
0135: for (int k = 0; k < roots.length; k++) {
0136: node = new DefaultMutableTreeNode(new TreeObject(roots[k]));
0137: node.add(new DefaultMutableTreeNode(
0138: "Getting Child Nodes For "
0139: + roots[k].getAbsolutePath()));
0140: top.add(node);
0141: }
0142: to.setRoots(roots);
0143: treeModel = new DefaultTreeModel(top);
0144: mainTree = new JTree(treeModel);
0145: mainTree.getSelectionModel().setSelectionMode(
0146: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
0147: mainTree
0148: .addTreeExpansionListener(new JDecTreeExpansionListener());
0149: mainTree
0150: .addTreeSelectionListener(new JdecTreeSelectionListener());
0151: mainTree.setShowsRootHandles(true);
0152: mainTree.setEditable(false);
0153: JScrollPane s = new JScrollPane();
0154: s.getViewport().add(mainTree);
0155: // mainTree.setBackground(Color.LIGHT_GRAY);
0156: getContentPane().add(s, BorderLayout.CENTER);
0157: setVisible(true);
0158: }
0159:
0160: // For methods display
0161: public JdecTree(ArrayList methods) {
0162: super ("List of Methods In Current Class");
0163: methodList = methods;
0164: if (methods == null || methods.size() == 0)
0165: return;
0166: TreeObject to = new TreeObject("Directory-Structure");
0167: DefaultMutableTreeNode top = new DefaultMutableTreeNode(to);
0168: DefaultMutableTreeNode node;
0169: String m[] = (String[]) methods.toArray(new String[methods
0170: .size()]);
0171: File roots[] = new File[m.length];
0172: for (int z = 0; z < m.length; z++) {
0173: roots[z] = new File(m[z].toString());
0174: }
0175: for (int k = 0; k < roots.length; k++) {
0176: node = new DefaultMutableTreeNode(new TreeObject(roots[k]));
0177: top.add(node);
0178:
0179: }
0180: to.setRoots(roots);
0181: treeModel = new DefaultTreeModel(top);
0182: mainTree = new JTree(treeModel);
0183: mainTree.getSelectionModel().setSelectionMode(
0184: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
0185: mainTree
0186: .addTreeExpansionListener(new JDecTreeExpansionListener());
0187: mainTree
0188: .addTreeSelectionListener(new JdecTreeSelectionListener());
0189: mainTree.setShowsRootHandles(true);
0190: mainTree.setEditable(false);
0191: s = new JScrollPane();
0192: s.getViewport().add(mainTree);
0193: tiplabel = new JLabel("Hover to view ToolTip");
0194:
0195: UIUtil.getUIUtil().tiplabel = tiplabel;
0196: tiplabel.setFont(new Font("Dialog", Font.BOLD, 11));
0197: tiplabel.setForeground(new Color(51, 0, 51));
0198: // mainTree.setBackground(Color.LIGHT_GRAY);
0199: getContentPane().add(tiplabel, BorderLayout.NORTH);
0200: getContentPane().add(s, BorderLayout.CENTER);
0201:
0202: Thread b = new Thread(new blink());
0203: b.start();
0204: setVisible(true);
0205: }
0206:
0207: public JdecTree(ClassStructure cs, boolean b) {
0208: super ("Class Structure");
0209: DefaultMutableTreeNode node;
0210: if (cs == null)
0211: return;
0212: DefaultMutableTreeNode header = new DefaultMutableTreeNode(
0213: new TreeObject("Class Structure..."));
0214: DefaultMutableTreeNode top = new DefaultMutableTreeNode(
0215: new TreeObject(cs.getName()));
0216: header.add(top);
0217: ArrayList structure = cs.getMethods();
0218: String m[] = (String[]) structure.toArray(new String[structure
0219: .size()]);
0220: for (int k = 0; k < m.length; k++) {
0221: node = new DefaultMutableTreeNode(
0222: new TreeObject(m[k], true));
0223: top.add(node);
0224:
0225: }
0226: // Add inner classes
0227:
0228: ArrayList innercls = cs.getInnerclasses();
0229: structure = new ArrayList();
0230: for (int x = 0; x < innercls.size(); x++) {
0231: ClassStructure temp = (ClassStructure) innercls.get(x);
0232: String name = temp.getName();
0233: structure.add(name);
0234:
0235: }
0236:
0237: m = (String[]) structure.toArray(new String[structure.size()]);
0238:
0239: for (int k = 0; k < m.length; k++) {
0240: node = new DefaultMutableTreeNode(
0241: new TreeObject(m[k], true));
0242: node.add(new DefaultMutableTreeNode("Scanning...."));
0243: top.add(node);
0244:
0245: }
0246:
0247: treeModel = new DefaultTreeModel(top);
0248: mainTree = new JTree(treeModel);
0249: mainTree.getSelectionModel().setSelectionMode(
0250: TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
0251: mainTree
0252: .addTreeExpansionListener(new JDecStructureTreeExpansionListener());
0253: mainTree
0254: .addTreeSelectionListener(new JdecStructureTreeSelectionListener());
0255: mainTree.setShowsRootHandles(true);
0256: mainTree.setEditable(false);
0257: s = new JScrollPane();
0258: s.getViewport().add(mainTree);
0259: tiplabel = new JLabel("Hover to view ToolTip");
0260:
0261: UIUtil.getUIUtil().tiplabel = tiplabel;
0262: tiplabel.setFont(new Font("Dialog", Font.BOLD, 11));
0263: tiplabel.setForeground(new Color(51, 0, 51));
0264: // mainTree.setBackground(Color.LIGHT_GRAY);
0265: if (b)
0266: getContentPane().add(tiplabel, BorderLayout.NORTH);
0267: getContentPane().add(s, BorderLayout.CENTER);
0268:
0269: Thread blnk = new Thread(new blink());
0270: blnk.start();
0271: setVisible(true);
0272: }
0273:
0274: JLabel tiplabel = null;
0275:
0276: JScrollPane s;
0277:
0278: public JLabel getTipLabel() {
0279: return tiplabel;
0280: }
0281:
0282: public JScrollPane getScrollPane() {
0283: return s;
0284: }
0285:
0286: public JTree getTree() {
0287: return mainTree;
0288: }
0289:
0290: DefaultMutableTreeNode getTreeNode(TreePath path) {
0291: return (DefaultMutableTreeNode) (path.getLastPathComponent());
0292: }
0293:
0294: static TreeObject getFileNode(DefaultMutableTreeNode node) {
0295: if (node == null)
0296: return null;
0297: Object obj = node.getUserObject();
0298: if (obj instanceof TreeObject)
0299: return (TreeObject) obj;
0300: else
0301: return null;
0302: }
0303:
0304: class JDecTreeExpansionListener implements TreeExpansionListener {
0305: public void treeExpanded(TreeExpansionEvent event) {
0306: process = true;
0307: final DefaultMutableTreeNode node = getTreeNode(event
0308: .getPath());
0309: final TreeObject fnode = getFileNode(node);
0310: if (fnode != null
0311: && TreeUtil.showChildren(node, fnode.getFile(),
0312: fnode)) {
0313: treeModel.reload(node);
0314: }
0315: /*
0316: * Thread runner = new Thread() { public void run() { if (fnode !=
0317: * null && TreeUtil.showChildren(node,fnode.getFile())) { Runnable
0318: * runnable = new Runnable() { public void run() {
0319: * treeModel.reload(node); } } ; 7(runnable); } } } ;
0320: * runner.start();
0321: */
0322: }
0323:
0324: public void treeCollapsed(TreeExpansionEvent event) {
0325: JdecTree.this .process = false;
0326: }
0327:
0328: }
0329:
0330: public class JdecStructureTreeSelectionListener implements
0331: TreeSelectionListener {
0332:
0333: private void gotoSleep() {
0334: try {
0335: Thread.sleep(1000);
0336:
0337: } catch (InterruptedException e) {
0338:
0339: }
0340:
0341: }
0342:
0343: public void valueChanged(TreeSelectionEvent event) {
0344: DefaultMutableTreeNode node = getTreeNode(event.getPath());
0345: // int in=treeModel.getIndexOfChild(node.getParent(),node);
0346: final TreeObject fnode = getFileNode(node);
0347: ClassStructure cst = null;
0348: String name = null;
0349: if (node.getParent() != null) {
0350: name = node.getParent().toString();
0351: cst = ConsoleLauncher.getClassStructure(name);
0352: } else {
0353: String x = event.getPath().toString();
0354: int br = x.indexOf("[");
0355: if (br != -1) {
0356: x = x.substring(br + 1);
0357: br = x.indexOf("]");
0358: if (br != -1) {
0359: x = x.substring(0, br);
0360: StringTokenizer st = new StringTokenizer(x, ",");
0361: ArrayList list = new ArrayList();
0362: while (st.hasMoreTokens()) {
0363: list.add(st.nextToken());
0364: }
0365: if (list.size() > 1) {
0366: String nm = (String) list
0367: .get(list.size() - 2);
0368: if (ConsoleLauncher.classMethodMap != null) {
0369: HashMap map = ConsoleLauncher.classMethodMap;
0370: if (nm != null) {
0371: HashMap methodmap = (HashMap) map
0372: .get(nm.trim());
0373: if (fnode.getCsName() != null) {
0374: name = (String) methodmap
0375: .get(fnode.getCsName()
0376: .trim());
0377:
0378: String x2 = "";// cst.getSearchString(name);
0379:
0380: UIUtil.getUIUtil().searchText(
0381: name);
0382: }
0383: }
0384: }
0385: }
0386: }
0387: }
0388:
0389: }
0390: if (cst != null) {
0391:
0392: String s1 = fnode.getCsName();
0393: if (ConsoleLauncher.classMethodMap != null) {
0394: HashMap map = ConsoleLauncher.classMethodMap;
0395: HashMap methodmap = (HashMap) map.get(name);
0396: name = (String) methodmap.get(fnode.getCsName());
0397: // String x=cst.getSearchString(name);
0398:
0399: UIUtil.getUIUtil().searchText(name);
0400: }
0401:
0402: }
0403:
0404: }
0405: }
0406:
0407: class JdecTreeSelectionListener implements TreeSelectionListener {
0408:
0409: private void gotoSleep() {
0410: try {
0411: Thread.sleep(1000);
0412:
0413: } catch (InterruptedException e) {
0414:
0415: }
0416:
0417: }
0418:
0419: public void valueChanged(TreeSelectionEvent event) {
0420: // if(!process)return;
0421: try {
0422: DefaultMutableTreeNode node = getTreeNode(event
0423: .getPath());
0424: final TreeObject fnode = getFileNode(node);
0425: final String fileClicked = fnode.getFile()
0426: .getAbsolutePath();
0427: if (fileClicked != null
0428: && ConsoleLauncher.getCurrentSourceFile() != null
0429: && fileClicked.equals(ConsoleLauncher
0430: .getCurrentSourceFile()
0431: .getAbsolutePath())) {
0432: return;
0433: }
0434:
0435: if (fnode.getFile().isDirectory() == false) {
0436:
0437: if (isValidArchiveFileExt(fnode.getFile()
0438: .getAbsolutePath())) { // .endsWith(".jar"))
0439: // {
0440:
0441: try {
0442:
0443: JFrame tempframes[] = UILauncher
0444: .getTempFrames();
0445: for (int i = 0; i < tempframes.length; i++) {
0446: JFrame tempframe = tempframes[i];
0447: if (tempframe != null) {
0448: tempframe.setVisible(false);
0449: tempframe.dispose();
0450: }
0451: }
0452: final File chosenFile = fnode.getFile();
0453: if (chosenFile == null)
0454: return;
0455: String filename = chosenFile
0456: .getAbsolutePath();
0457: if (!chosenFile.exists()
0458: || (filename != null && !isValidArchiveFileExt(filename))) {
0459: JOptionPane
0460: .showMessageDialog(UILauncher
0461: .getMainFrame(),
0462: "Chosen File is not a valid archive file");
0463: Manager.getManager()
0464: .setShowProgressBar(false);
0465: return;
0466: }
0467: String message = "";
0468: message += "Would You like Jdec to Decompile Entire Jar ...\n\n";
0469: message += "[Warning:] This May take some time depending on size of Jar ...\n";
0470: message += "Would You Like to Proceed...?\n";
0471: message += "\n\n*** [NOTE :] *** IF Cancel is selected all The class Files in the Jar\n";
0472: message += "will be shown as a directory structure in the jar tab....";
0473:
0474: JOptionPane option = new JOptionPane();// message,JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_CANCEL_OPTION);
0475: Object[] options = { "OK", "CANCEL" };
0476: int opt = option.showOptionDialog(
0477: UILauncher.getMainFrame(), message,
0478: "Jar Decompile Option",
0479: JOptionPane.DEFAULT_OPTION,
0480: JOptionPane.QUESTION_MESSAGE, null,
0481: options, options[0]);
0482: option.setVisible(true);
0483: if (opt == JOptionPane.CANCEL_OPTION
0484: || opt == JOptionPane.NO_OPTION) {
0485: Thread prog = new Thread() {
0486: public void run() {
0487: JDialog archiveProf = UIUtil
0488: .launchArchiveProgressBarFrame();
0489: archiveProf.setVisible(true);
0490: while (UIUtil.explosionInProgress) {
0491: gotoSleep();
0492: }
0493: if (!UIUtil.explosionInProgress) {
0494: if (UIUtil.archiveproframe != null) {
0495: UIUtil.archiveproframe
0496: .setVisible(false);
0497: UIUtil.archiveproframe
0498: .dispose();
0499: }
0500: }
0501:
0502: }
0503: };
0504:
0505: Thread work = new Thread() {
0506:
0507: public void run() {
0508: JdecTree jarExploded = null;
0509: String filePath = chosenFile
0510: .getAbsolutePath();
0511: String jarDir = UIUtil
0512: .getUIUtil()
0513: .explodeJar(chosenFile);
0514: String s = File.separator;
0515: if (jarDir.endsWith(s) == false)
0516: jarDir = jarDir
0517: .concat(File.separator);
0518: boolean valid = isValidArchiveFileExt(filePath);
0519: if (jarDir.trim().length() > 0
0520: && valid)
0521: jarExploded = new JdecTree(
0522: jarDir);
0523: else {
0524: jarExploded = null;
0525: }
0526: UIUtil.currentScannedJDecTree = jarExploded;
0527: UIUtil.explosionInProgress = false;
0528:
0529: if (UIUtil
0530: .checkForInvalidEntries("jar")) {
0531: updateJarTabWithTree(UIUtil.currentScannedJDecTree);
0532: JOptionPane
0533: .showMessageDialog(
0534: UILauncher
0535: .getMainFrame(),
0536: "Jar Tab has been updated with directory containing Class Files..\nPlease Click on any File to see the output...",
0537: "User Info...",
0538: JOptionPane.INFORMATION_MESSAGE);
0539: UIUtil
0540: .getUIUtil()
0541: .getLeftTabbedPane()
0542: .setSelectedIndex(
0543: UIUtil
0544: .getUIUtil()
0545: .getLeftTabbedPane()
0546: .indexOfTab(
0547: "Jar"));
0548: } else {
0549: JOptionPane
0550: .showMessageDialog(
0551: UILauncher
0552: .getMainFrame(),
0553: "Please Check The Decompiler Configuration Property Values Again",
0554: "JDEC WARNING",
0555: JOptionPane.INFORMATION_MESSAGE);
0556: }
0557:
0558: }
0559: };
0560:
0561: work.setPriority(Thread.MAX_PRIORITY);
0562: prog.setPriority(Thread.NORM_PRIORITY);
0563: UIUtil.explosionInProgress = true;
0564: UIUtil.continueToExplode = true;
0565: work.start();
0566: prog.start();
0567:
0568: }
0569:
0570: if (opt == JOptionPane.OK_OPTION) {
0571: JTabbedPane tab = UIUtil.getUIUtil()
0572: .getLeftTabbedPane();
0573: tab.setSelectedIndex(1);
0574:
0575: final Thread decProg = new Thread() {
0576:
0577: public void run() {
0578:
0579: JDialog proframe = UIUtil
0580: .launchProgressBarFrame();
0581: if (proframe != null)
0582: proframe.setVisible(true);
0583: // proframe.requestFocusInWindow();
0584:
0585: while (Manager.getManager()
0586: .isShowProgressBar() == true) {
0587:
0588: gotoSleep();
0589: }
0590:
0591: if (!Manager.getManager()
0592: .isShowProgressBar()) {
0593: if (proframe != null) {
0594: proframe
0595: .setVisible(false);
0596: proframe.dispose();
0597: }
0598: proframe = null;
0599: if (ConsoleLauncher.fatalErrorOccured)
0600: JOptionPane
0601: .showMessageDialog(
0602: UILauncher
0603: .getMainFrame(),
0604: UIConstants.jdecTaskError,
0605: "Jdec Status",
0606: JOptionPane.INFORMATION_MESSAGE);
0607: }
0608:
0609: }
0610:
0611: };
0612:
0613: Thread work = new Thread() {
0614:
0615: public void run() {
0616: Console c = UILauncher
0617: .getUIutil()
0618: .getConsoleFrame();
0619: if (c != null) {
0620: JEditorPane rdwr = c
0621: .getComponent();
0622: rdwr.setText("");
0623: String s = "Jdec Started..\n";
0624: s = rdwr.getText() + "\n\n"
0625: + s;
0626: rdwr.setText(s);
0627: }
0628: Manager.getManager()
0629: .setShowProgressBar(
0630: false);
0631: JdecTree jarExploded = null;
0632: String filePath = chosenFile
0633: .getAbsolutePath();
0634: String jarDir = UIUtil
0635: .getUIUtil()
0636: .explodeJar(chosenFile);
0637: if (UIUtil.getUIUtil().registeredClasses == null
0638: || UIUtil.getUIUtil().registeredClasses
0639: .size() == 0) {
0640: Manager
0641: .getManager()
0642: .setShowProgressBar(
0643: false);
0644: JOptionPane
0645: .showMessageDialog(
0646: null,
0647: "No Files to decompile. Please check the filter settings! ");
0648: return;
0649: }
0650: UIUtil.explosionInProgress = false;
0651:
0652: Manager.getManager()
0653: .setShowProgressBar(
0654: true);
0655: decProg.start();
0656: DecompilerBridge bridge = DecompilerBridge
0657: .getInstance(UIUtil
0658: .getUIUtil());
0659: bridge.setJarFile(fnode
0660: .getFile()
0661: .getAbsolutePath());
0662: if (c != null) {
0663: JEditorPane rdwr = c
0664: .getComponent();
0665:
0666: String s = "Current Task :Decompile Jar\n";
0667: s = rdwr.getText() + "\n\n"
0668: + s;
0669: rdwr.setText(s);
0670: }
0671: bridge.execute("decompileJar",
0672: "", false, "null");
0673: if (c != null) {
0674: JEditorPane rdwr = c
0675: .getComponent();
0676:
0677: String s = "Current File :"
0678: + Configuration
0679: .getJarPath()
0680: + "\n";
0681: // Reinitialize current executed
0682: // files....
0683: ConsoleLauncher
0684: .setCurrentJarSourceFile(null);
0685: Configuration
0686: .setJarPath(null);
0687:
0688: s = rdwr.getText() + "\n\n"
0689: + s;
0690: rdwr.setText(s);
0691: }
0692: if (UIUtil.getUIUtil()
0693: .getJDecOption()
0694: .equals("decompileJar") == false) {
0695: bridge
0696: .showResult(UIUtil
0697: .getUIUtil()
0698: .getRightTabbedPane());
0699:
0700: }
0701: if (c != null) {
0702: JEditorPane rdwr = c
0703: .getComponent();
0704: String s;
0705: if (UIUtil
0706: .getUIUtil()
0707: .getJDecOption()
0708: .equals(
0709: "decompileJar") == false)
0710: s = "Done...Please Wait for UI to render the output....\nPlease Check up the log files for any error(s)";
0711: else
0712: s = "Done...The Jar Tab Has been Updated with The output folder \nshowing the necessary decompiled files\n";
0713: s = rdwr.getText() + "\n\n"
0714: + s;
0715: rdwr.setText(s);
0716: }
0717: JOptionPane
0718: .showMessageDialog(
0719: UILauncher
0720: .getMainFrame(),
0721: "Jar Tab has been updated with directory containing decompiled Files..\n[Traverse the package structure]",
0722: "User Info...",
0723: JOptionPane.INFORMATION_MESSAGE);
0724:
0725: }
0726: };
0727:
0728: Thread explodeprog = new Thread() {
0729: public void run() {
0730: JDialog archiveProf = UIUtil
0731: .launchArchiveProgressBarFrame();
0732: archiveProf.setVisible(true);
0733: while (UIUtil.explosionInProgress) {
0734: gotoSleep();
0735: }
0736: if (!UIUtil.explosionInProgress) {
0737: if (UIUtil.archiveproframe != null) {
0738: UIUtil.archiveproframe
0739: .setVisible(false);
0740: UIUtil.archiveproframe
0741: .dispose();
0742: }
0743: }
0744:
0745: }
0746: };
0747:
0748: // /
0749: // if(fnode.getFile().getAbsolutePath().endsWith(".jar")){
0750: if (isValidArchiveFileExt(fnode
0751: .getFile().getAbsolutePath())) {
0752: ConsoleLauncher
0753: .setCurrentJarSourceFile(fnode
0754: .getFile());
0755: UILauncher.getUIutil()
0756: .setJarOption(true);
0757: if (UIUtil
0758: .checkForInvalidEntries("jar")) {
0759: UIUtil.explosionInProgress = true;
0760: UIUtil.continueToExplode = true;
0761: work.start();
0762: explodeprog.start();
0763: } else {
0764: JOptionPane
0765: .showMessageDialog(
0766: UILauncher
0767: .getMainFrame(),
0768: "Please Check The Decompiler Configuration Property Values Again",
0769: "JDEC WARNING",
0770: JOptionPane.INFORMATION_MESSAGE);
0771: }
0772: } else {
0773: JOptionPane
0774: .showMessageDialog(
0775: UILauncher
0776: .getMainFrame(),
0777: "Chosen File is not a archive file",
0778: "Archive Option",
0779: JOptionPane.INFORMATION_MESSAGE);
0780:
0781: }
0782:
0783: }
0784:
0785: } catch (Exception jarexcep) {
0786: try {
0787: LogWriter lg = LogWriter.getInstance();
0788: lg
0789: .writeLog("[ERROR]: Method: actionPeformed\n\tClass: NewTaskListener.class");
0790: lg
0791: .writeLog("------------------------------------------------");
0792: lg.writeLog("Exception Stack Trace");
0793: jarexcep.printStackTrace(lg
0794: .getPrintWriter());
0795: lg.flush();
0796: JOptionPane.showMessageDialog(
0797: UILauncher.getMainFrame(),
0798: "Error Processing Jar "
0799: + jarexcep);
0800: } catch (Exception e) {
0801:
0802: }
0803:
0804: }
0805:
0806: } else if (fnode
0807: .getFile()
0808: .getAbsolutePath()
0809: .endsWith(
0810: "."
0811: + Configuration
0812: .getFileExtension())
0813: && fnode.getFile().exists()) {
0814:
0815: JTabbedPane rightTab = UIUtil.getUIUtil()
0816: .getRightTabbedPane();
0817: int index = rightTab
0818: .indexOfTab("Decompiled Output");
0819: if (index != -1) {
0820: rightTab.setSelectedIndex(index);
0821: }
0822: Component editor = rightTab
0823: .getSelectedComponent();
0824: JScrollPane editorTab = (JScrollPane) editor;
0825: Object o = editorTab.getComponent(0);
0826: JViewport view = (JViewport) o;
0827: Object o2 = view.getView();
0828: if (o2 != null) {
0829: JEditorPane rdwrPane = (JEditorPane) o2;
0830: File res[] = new File[] { fnode.getFile() };
0831: if (res != null && res.length > 0) {
0832: File f = res[0];
0833:
0834: try {
0835: FileReader fr = new FileReader(f);
0836: rdwrPane.read(fr, null);
0837: rdwrPane.setEditable(true);
0838: UILauncher.getUIutil()
0839: .addRecentFile(f);
0840: UIUtil u = UILauncher.getUIutil();
0841: FileInfoFrame finfo = u
0842: .getInfoFrame();
0843:
0844: // finfo.setFileName(u.getJavaClassFile());
0845: String s = f.getAbsolutePath();
0846:
0847: int winslash = s.indexOf("\\");
0848: int unixslash = s.indexOf("/");
0849:
0850: if (winslash != -1) {
0851: s = s.replace('\\',
0852: File.separator
0853: .charAt(0));
0854: }
0855: if (unixslash != -1) {
0856: s = s.replace('/',
0857: File.separator
0858: .charAt(0));
0859: }
0860:
0861: finfo.recreateDetailsFrame(s);
0862: Splitter split = Manager
0863: .getManager()
0864: .getSplitterRef();
0865: split.resetInfoFrame(finfo);
0866: UILauncher.getMainFrame().repaint();
0867: UILauncher
0868: .getUIutil()
0869: .setCurrentOpenFile(
0870: f.getAbsolutePath());
0871: } catch (IOException fne) {
0872: try {
0873: LogWriter writer = LogWriter
0874: .getInstance();
0875: String msg = "***************************************************************";
0876: msg += "\n"
0877: + "EXCEPTION STACK TRACE";
0878: msg += "***************************************************************";
0879: msg += "\n\n";
0880: msg += "Message :"
0881: + fne.getMessage();
0882: msg += "\n" + "Cause :"
0883: + fne.getCause();
0884: writer.writeLog(msg);
0885: fne.printStackTrace(writer
0886: .getPrintWriter());
0887: writer.flush();
0888: String desc = "An Exception occured while processing";
0889: desc += "\nPlease refer to the Log Files \n";
0890: desc += "And Report the Error At Project Home Site\n";
0891:
0892: desc += "UILogFile :"
0893: + writer.logFilePath();
0894: desc += "\nDecompiler Log File :"
0895: + UILauncher
0896: .getUIutil()
0897: .getLogPath();
0898:
0899: Manager.getManager()
0900: .setShowProgressBar(
0901: false);
0902: JOptionPane
0903: .showMessageDialog(
0904: UILauncher
0905: .getMainFrame(),
0906: desc,
0907: "Run Jdec Decompiler",
0908: JOptionPane.ERROR_MESSAGE);
0909:
0910: } catch (Exception ex) {
0911: }
0912: }
0913:
0914: }
0915:
0916: }
0917:
0918: } else if (fnode.getFile().getAbsolutePath()
0919: .endsWith(".class")
0920: && fnode.getFile().exists()) {
0921: // System.out.println("valueChanged"+fnode.getFile().getAbsolutePath());
0922: ConsoleLauncher.setCurrentSourceFile(fnode
0923: .getFile());
0924: final File f = ConsoleLauncher
0925: .getCurrentSourceFile();
0926: if (f != null) {
0927: try {
0928: // Writer
0929: // outputwriter=Writer.getWriter("output");
0930: // outputwriter.close("output");
0931: Thread t1 = new Thread() {
0932:
0933: public void run() {
0934: Console c = UILauncher
0935: .getUIutil()
0936: .getConsoleFrame();
0937: if (c != null) {
0938: JEditorPane rdwr = c
0939: .getComponent();
0940: rdwr.setText("");
0941: String s = "Jdec Started..\n";
0942: s = rdwr.getText() + "\n\n"
0943: + s;
0944: rdwr.setText(s);
0945: }
0946: Manager.getManager()
0947: .setShowProgressBar(
0948: true);
0949: DecompilerBridge bridge = DecompilerBridge
0950: .getInstance(UIUtil
0951: .getUIUtil());
0952: bridge.setClassFile(f
0953: .getAbsolutePath());
0954: UILauncher
0955: .getUIutil()
0956: .setCurrentOpenFile(
0957: f
0958: .getAbsolutePath());
0959:
0960: if (c != null) {
0961: JEditorPane rdwr = c
0962: .getComponent();
0963:
0964: String s = "Current Task :Decompile Class\n";
0965: s = rdwr.getText() + "\n\n"
0966: + s;
0967: rdwr.setText(s);
0968: }
0969: bridge.execute(
0970: "decompileClass", "",
0971: false, "null");
0972: UILauncher.getUIutil()
0973: .addRecentFile(f);
0974: if (c != null) {
0975: JEditorPane rdwr = c
0976: .getComponent();
0977:
0978: String s = "Current File :"
0979: + Configuration
0980: .getJavaClassFile()
0981: + "\n";
0982: s = rdwr.getText() + "\n\n"
0983: + s;
0984: rdwr.setText(s);
0985: }
0986: bridge.showResult(UIUtil
0987: .getUIUtil()
0988: .getRightTabbedPane());
0989: UILauncher
0990: .getUIutil()
0991: .addRecentFile(
0992: new File(
0993: Configuration
0994: .getJavaClassFile()));
0995: if (c != null) {
0996: JEditorPane rdwr = c
0997: .getComponent();
0998:
0999: String s = "Done...Please Wait for UI to render the output....\nPlease Check up the log files for any error(s)";
1000: s = rdwr.getText() + "\n\n"
1001: + s;
1002: rdwr.setText(s);
1003: }
1004: ConsoleLauncher
1005: .setCurrentDecompiledFile(Configuration
1006: .getJavaClassFile());
1007: // Configuration.setJavaClassFile(null);
1008: // Configuration.setClassFilePath(null);
1009:
1010: }
1011: };
1012: // t1.setPriority(Thread.NORM_PRIORITY);
1013: Manager.getManager()
1014: .setStatusThread(t1);
1015:
1016: Thread t2 = new Thread() {
1017:
1018: public void run() {
1019:
1020: JDialog proframe = UIUtil
1021: .launchProgressBarFrame();
1022: if (proframe != null)
1023: proframe.setVisible(true);
1024:
1025: while (Manager.getManager()
1026: .isShowProgressBar() == true) {
1027:
1028: gotoSleep();
1029: }
1030:
1031: if (!Manager.getManager()
1032: .isShowProgressBar()) {
1033: if (proframe != null) {
1034: proframe
1035: .setVisible(false);
1036: proframe.dispose();
1037: }
1038: proframe = null;
1039: if (ConsoleLauncher.fatalErrorOccured)
1040: JOptionPane
1041: .showMessageDialog(
1042: UILauncher
1043: .getMainFrame(),
1044: UIConstants.jdecTaskError,
1045: "Jdec Status",
1046: JOptionPane.INFORMATION_MESSAGE);
1047: }
1048:
1049: }
1050:
1051: };
1052:
1053: if (UIUtil.checkForInvalidEntries("")) {
1054: t1.start();
1055: t2.start();
1056: } else {
1057: JOptionPane
1058: .showMessageDialog(
1059: UILauncher
1060: .getMainFrame(),
1061: "Please Check The Decompiler Configuration Property Values Again",
1062: "JDEC WARNING",
1063: JOptionPane.INFORMATION_MESSAGE);
1064: }
1065: // Manager.getManager().setStatusFrame(frame);
1066: // //
1067: Manager manager = Manager.getManager();
1068: ArrayList paneList = manager
1069: .getCurrentSplitPaneComponents();
1070: Console c = null;
1071: for (int s = 0; s < paneList.size(); s++) {
1072: Object current = paneList.get(s);
1073: if (current instanceof Console) {
1074: c = (Console) current;
1075: break;
1076: }
1077:
1078: }
1079: FileReader fre = null;
1080: try {
1081: if (Configuration
1082: .getConsoleDetailFile() != null) {
1083: fre = new FileReader(
1084: Configuration
1085: .getConsoleDetailFile());
1086: /*
1087: * JScrollPane j=c.getComponent();
1088: * JViewport jview=j.getViewport();
1089: * Object v=jview.getView(); if(v!=null) {
1090: * JEditorPane rdwr=(JEditorPane)o2;
1091: * System.out.println(rdwr.getText());
1092: * rdwr.setText("Over");
1093: * System.out.println(rdwr.getText());
1094: * rdwrPane.read(fre,null); }
1095: */
1096: JEditorPane rdwr = c
1097: .getComponent();
1098: String s = "Jdec Started...";
1099: s = rdwr.getText() + "\n\n" + s;
1100: rdwr.setText(s);
1101: }
1102: // rdwr.read(fre,null);
1103: } catch (IOException ioe) {
1104: }
1105:
1106: // end
1107:
1108: // //
1109:
1110: } catch (Exception e) {
1111:
1112: try {
1113: LogWriter writer = LogWriter
1114: .getInstance();
1115: String msg = "***************************************************************";
1116: msg += "\n"
1117: + "EXCEPTION STACK TRACE";
1118: msg += "***************************************************************";
1119: msg += "\n\n";
1120: msg += "Message :" + e.getMessage();
1121: msg += "\n" + "Cause :"
1122: + e.getCause();
1123: writer.writeLog(msg);
1124: e.printStackTrace(writer
1125: .getPrintWriter());
1126: writer.flush();
1127: String desc = "An Exception occured while processing";
1128: desc += "\nPlease refer to the Log Files \n";
1129: desc += "And Report the Error At Project Home Site\n";
1130:
1131: desc += "UILogFile :"
1132: + writer.logFilePath();
1133: desc += "\nDecompiler Log File :"
1134: + UILauncher.getUIutil()
1135: .getLogPath();
1136:
1137: Manager.getManager()
1138: .setShowProgressBar(false);
1139: JOptionPane.showMessageDialog(
1140: UILauncher.getMainFrame(),
1141: desc,
1142: "Run Jdec Decompiler",
1143: JOptionPane.ERROR_MESSAGE);
1144:
1145: } catch (Exception ex) {
1146: }
1147: }
1148: }
1149: } else if (fnode.getFile().getAbsolutePath()
1150: .endsWith(".java")
1151: && fnode.getFile().exists()) {
1152: JEditorPane editor = UIUtil.getUIUtil()
1153: .getEditorWindow();
1154: editor.read(new FileReader(fnode.getFile()),
1155: null);
1156: } else if (fnode.getFile().getAbsolutePath()
1157: .endsWith(".txt")
1158: && fnode.getFile().exists()) {
1159: JEditorPane editor = UIUtil.getUIUtil()
1160: .getEditorWindow();
1161: editor.read(new FileReader(fnode.getFile()),
1162: null);
1163: } else if (fnode.getFile().getAbsolutePath()
1164: .endsWith(".properties")
1165: && fnode.getFile().exists()) {
1166: JEditorPane editor = UIUtil.getUIUtil()
1167: .getEditorWindow();
1168: editor.read(new FileReader(fnode.getFile()),
1169: null);
1170: } else {
1171: HashMap map = ConsoleLauncher.method_names_signature;
1172: String x = fnode.getFile().getAbsolutePath();
1173: if (x != null) {
1174: int i = x.lastIndexOf("\\");
1175: if (i == -1) {
1176: i = x.lastIndexOf("/");
1177: }
1178: if (i != -1) {
1179: x = x.substring(i + 1);
1180: String s = (String) map.get(x);
1181: UIUtil.getUIUtil().searchText(s);
1182:
1183: // JOptionPane.showMessageDialog(null,s);
1184: }
1185: }
1186: }
1187: }
1188:
1189: } catch (Throwable t) {
1190:
1191: }
1192:
1193: }
1194:
1195: private boolean isValidArchiveFileExt(String filename) {
1196: if (filename == null)
1197: return false;
1198: String types = UILauncher.getUIConfigRef()
1199: .getArchiveTypes();
1200: StringTokenizer st = new StringTokenizer(types, ",");
1201: while (st.hasMoreTokens()) {
1202: String c = (String) st.nextToken();
1203: if (filename.endsWith(c)) {
1204: return true;
1205: }
1206: }
1207: return false;
1208: }
1209:
1210: private void updateJarTabWithTree(JdecTree jarExploded) {
1211: if (jarExploded != null) {
1212: UIObserver observer = UILauncher.getObserver();
1213: if (observer != null) // Actually no need to check
1214: {
1215: observer.resetTabsPane(true);
1216: Manager manager = Manager.getManager();
1217: ArrayList list = manager
1218: .getCurrentSplitPaneComponents();
1219: JTabbedPane tabPane = UIUtil.getUIUtil()
1220: .getLeftTabbedPane();
1221: if (tabPane != null) {
1222: int jarTabIndex = tabPane.indexOfTab("Jar");
1223: if (jarTabIndex >= 0) {
1224: tabPane.remove(jarTabIndex);
1225: tabPane.addTab("Jar", jarExploded);
1226: }
1227: }
1228:
1229: }
1230: JFrame mainFrame = UILauncher.getMainFrame();
1231: mainFrame.repaint();
1232: }
1233: }
1234:
1235: }
1236:
1237: public class JDecStructureTreeExpansionListener implements
1238: TreeExpansionListener {
1239: public void treeExpanded(TreeExpansionEvent event) {
1240: process = true;
1241: final DefaultMutableTreeNode node = getTreeNode(event
1242: .getPath());
1243: final TreeObject fnode = getFileNode(node);
1244: // Thread runner = new Thread() {
1245: // public void run() {
1246: if (fnode != null
1247: && TreeUtil.showStructureChildren(node, fnode)) {
1248: // Runnable runnable = new Runnable() {
1249: // public void run() {
1250: treeModel.reload(node);
1251: // }
1252: // }
1253: // ;
1254: // SwingUtilities.invokeLater(runnable);
1255: // }
1256: }
1257: // }
1258: // ;
1259: // runner.start();
1260: }
1261:
1262: public void treeCollapsed(TreeExpansionEvent event) {
1263: JdecTree.this .process = false;
1264: }
1265:
1266: }
1267:
1268: class blink implements Runnable
1269:
1270: {
1271: JLabel l = UIUtil.getUIUtil().tiplabel;
1272:
1273: public void run() {
1274: if (l != null) {
1275: try {
1276: for (;;) {
1277: l.setForeground(Color.RED);// new Color(153,0,51));
1278: l.setFont(new Font("MONOSPACE", Font.BOLD, 11));
1279: Thread.sleep(800);
1280: l.setForeground(new Color(51, 0, 51));// new
1281: // Color(0,102,102));
1282: Thread.sleep(500);
1283: }
1284: } catch (InterruptedException ie) {
1285:
1286: }
1287:
1288: }
1289: }
1290: }
1291:
1292: public void expandTreeFully(DefaultMutableTreeNode root) {
1293:
1294: final DefaultMutableTreeNode node = root;
1295: final TreeObject fnode = getFileNode(node);
1296: // Thread runner = new Thread() {
1297: // public void run() {
1298: if (fnode != null
1299: && TreeUtil.showStructureChildren(node, fnode)) {
1300: // Runnable runnable = new Runnable() {
1301: // public void run() {
1302: treeModel.reload(node);
1303: // }
1304: // }
1305: // ;
1306: // SwingUtilities.invokeLater(runnable);
1307: // }
1308: // }
1309: // }
1310: // ;
1311: // runner.start();
1312:
1313: }
1314:
1315: }
1316:
1317: }
1318:
1319: class TreeObject {
1320: private String passedDirectoryList;
1321:
1322: protected File file;
1323:
1324: private java.lang.String s;
1325:
1326: private boolean forClassStructure = false;
1327:
1328: private String csName = null;
1329:
1330: private File[] roots;
1331:
1332: public File[] getRoots() {
1333: return roots;
1334: }
1335:
1336: public void setRoots(File[] roots) {
1337: this .roots = roots;
1338: }
1339:
1340: public void setPassedDirectoryList(String passedDirectoryList) {
1341: this .passedDirectoryList = passedDirectoryList;
1342: }
1343:
1344: public String getPassedDirectoryList() {
1345: return passedDirectoryList;
1346: }
1347:
1348: public String getCsName() {
1349: return csName;
1350: }
1351:
1352: public boolean isForClassStructure() {
1353: return forClassStructure;
1354: }
1355:
1356: public TreeObject(java.lang.String s) {
1357: this .s = s;
1358: }
1359:
1360: public TreeObject(File file) {
1361: this .file = file;
1362: }
1363:
1364: public TreeObject(String name, boolean isForCS) {
1365: this .csName = name;
1366: forClassStructure = isForCS;
1367: }
1368:
1369: public File getFile() {
1370: return file;
1371: }
1372:
1373: public String toString() {
1374:
1375: if (forClassStructure) {
1376: return csName;
1377: }
1378:
1379: if (file == null) {
1380: return s;
1381: }
1382: if (file.getName() == null
1383: || file.getName().trim().length() == 0) {
1384: return file.getPath();
1385: } else {
1386: return file.getName();
1387: }
1388:
1389: }
1390:
1391: }
1392:
1393: class TreeUtil {
1394:
1395: private static File[] getMyChildren(File file) {
1396: if (file == null)
1397: return new File[] { new File("INVALID:INVALID") };
1398: String path = file.getPath();
1399: if (path != null && !path.trim().endsWith(File.separator)) {
1400: path = path + File.separator;
1401: }
1402: file = new File(path);
1403: if (!file.isDirectory())
1404: return new File[] { file };
1405: else
1406: return file.listFiles();
1407:
1408: }
1409:
1410: public static boolean showChildren(DefaultMutableTreeNode parent,
1411: File file, TreeObject to) {
1412: parent.removeAllChildren();
1413: File[] files = null;//
1414: if (file != null)
1415: files = getMyChildren(file);
1416: else {
1417: if (to != null && to.getRoots() != null) {
1418: files = to.getRoots();
1419: }
1420: }
1421: if (files == null)
1422: return false;
1423: ArrayList list = new ArrayList();
1424:
1425: for (int k = 0; k < files.length; k++) {
1426: File f = files[k];
1427: TreeObject chidlNode = new TreeObject(f);
1428: list.add(chidlNode);
1429: }
1430: if (files.length == 1
1431: && files[0].getAbsolutePath()
1432: .indexOf("INVALID:INVALID") != -1) {
1433: list = ConsoleLauncher.getcurrentClassMethods();
1434: if (list == null || list.size() == 0)
1435: return false;
1436: for (int i = 0; i < list.size(); i++) {
1437: String nd = (String) list.get(i);
1438: TreeObject tnd = new TreeObject(new File(nd));
1439: DefaultMutableTreeNode node = new DefaultMutableTreeNode(
1440: tnd);
1441: parent.add(node);
1442:
1443: }
1444: return true;
1445:
1446: }
1447:
1448: for (int i = 0; i < list.size(); i++) {
1449: TreeObject nd = (TreeObject) list.get(i);
1450: DefaultMutableTreeNode node = new DefaultMutableTreeNode(nd);
1451: if (nd.getFile().isDirectory()) {
1452: node.add(new DefaultMutableTreeNode(
1453: "Getting Child For " + nd.getFile()));
1454: }
1455: parent.add(node);
1456:
1457: }
1458: return true;
1459: }
1460:
1461: public static boolean showStructureChildren(
1462: DefaultMutableTreeNode parent, TreeObject tobj) {
1463:
1464: if (parent == null || tobj.isForClassStructure() == false)
1465: return false;
1466: parent.removeAllChildren();
1467:
1468: String name = tobj.getCsName();
1469: if (name == null)
1470: return false;
1471: ArrayList list = new ArrayList();
1472: ClassStructure anycs = InnerClassTracker.getClassStructure(
1473: name, ConsoleLauncher.allClassStructures);
1474: if (anycs == null)
1475: return false;
1476: ArrayList structure = anycs.getMethods();
1477:
1478: for (int k = 0; k < structure.size(); k++) {
1479: String s = (String) structure.get(k);
1480: TreeObject chidlNode = new TreeObject(s, true);
1481: list.add(chidlNode);
1482: }
1483:
1484: for (int i = 0; i < list.size(); i++) {
1485: TreeObject nd = (TreeObject) list.get(i);
1486: DefaultMutableTreeNode node = new DefaultMutableTreeNode(nd);
1487: parent.add(node);
1488: node.setParent(parent);
1489:
1490: }
1491: // Add inner classes
1492:
1493: structure = new ArrayList();
1494: ArrayList innercls = anycs.getInnerclasses();
1495: for (int x = 0; x < innercls.size(); x++) {
1496: ClassStructure temp = (ClassStructure) innercls.get(x);
1497: String name2 = temp.getName();
1498: structure.add(name2);
1499:
1500: }
1501:
1502: list = new ArrayList();
1503:
1504: for (int k = 0; k < structure.size(); k++) {
1505: String s = (String) structure.get(k);
1506: TreeObject chidlNode = new TreeObject(s, true);
1507:
1508: list.add(chidlNode);
1509: }
1510:
1511: for (int i = 0; i < list.size(); i++) {
1512: TreeObject nd = (TreeObject) list.get(i);
1513: DefaultMutableTreeNode node = new DefaultMutableTreeNode(nd);
1514: node.add(new DefaultMutableTreeNode("Scanning...."));
1515: parent.add(node);
1516: node.setParent(parent);
1517:
1518: }
1519: return true;
1520: }
1521:
1522: }
|