Update tooltip on tabs
emmanue1
4 years ago
+4
-4
40 | 40 | @SuppressWarnings("unchecked") |
41 | 41 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
42 | 42 | int lastSlashIndex = entry.getPath().lastIndexOf('/'); |
43 | String name = entry.getPath().substring(lastSlashIndex+1); | |
44 | return (T)new FileTreeNode(entry, new TreeNodeBean(name, CLASS_FILE_ICON), FACTORY); | |
43 | String label = entry.getPath().substring(lastSlashIndex+1); | |
44 | return (T)new FileTreeNode(entry, new TreeNodeBean(label, CLASS_FILE_ICON), FACTORY); | |
45 | 45 | } |
46 | 46 | |
47 | 47 | protected static class Factory implements AbstractTypeFileTreeNodeFactoryProvider.PageAndTipFactory { |
53 | 53 | |
54 | 54 | @Override |
55 | 55 | public String makeTip(API api, Container.Entry entry) { |
56 | File file = new File(entry.getContainer().getRoot().getUri()); | |
56 | String location = new File(entry.getUri()).getPath(); | |
57 | 57 | StringBuilder tip = new StringBuilder("<html>Location: "); |
58 | 58 | |
59 | tip.append(file.getPath()); | |
59 | tip.append(location); | |
60 | 60 | tip.append("<br>Java compiler version: "); |
61 | 61 | |
62 | 62 | try (InputStream is = entry.getInputStream()) { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class CssFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/css_obj.png")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+5
-3
17 | 17 | |
18 | 18 | import javax.swing.*; |
19 | 19 | import javax.swing.tree.DefaultMutableTreeNode; |
20 | import java.io.File; | |
20 | 21 | import java.net.URI; |
21 | 22 | import java.util.Collection; |
22 | 23 | |
41 | 42 | } |
42 | 43 | |
43 | 44 | String label = entry.getPath().substring(lastSlashIndex+1); |
44 | TreeNode node = new TreeNode(entry, new TreeNodeBean(label, getIcon(), getOpenIcon())); | |
45 | String location = new File(entry.getUri()).getPath(); | |
46 | TreeNode node = new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, getIcon(), getOpenIcon())); | |
45 | 47 | |
46 | 48 | if (entries.size() > 0) { |
47 | 49 | // Add dummy node |
48 | 50 | node.add(new DefaultMutableTreeNode()); |
49 | 51 | } |
50 | 52 | |
51 | return (T)node; | |
52 | } | |
53 | return (T)node; | |
54 | } | |
53 | 55 | |
54 | 56 | public ImageIcon getIcon() { return ICON; } |
55 | 57 | public ImageIcon getOpenIcon() { return OPEN_ICON; } |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class DtdFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(DtdFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/dtd_obj.gif")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
14 | 14 | |
15 | 15 | import javax.swing.*; |
16 | 16 | import javax.swing.tree.DefaultMutableTreeNode; |
17 | import java.io.File; | |
17 | 18 | |
18 | 19 | public class EarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider { |
19 | 20 | protected static final ImageIcon ICON = new ImageIcon(JarFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/ear_obj.gif")); |
24 | 25 | @SuppressWarnings("unchecked") |
25 | 26 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
26 | 27 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
27 | String name = entry.getPath().substring(lastSlashIndex+1); | |
28 | T node = (T)new TreeNode(entry, "ear", new TreeNodeBean(name, ICON)); | |
28 | String label = entry.getPath().substring(lastSlashIndex+1); | |
29 | String location = new File(entry.getUri()).getPath(); | |
30 | T node = (T)new TreeNode(entry, "ear", new TreeNodeBean(label, "Location: " + location, ICON)); | |
29 | 31 | // Add dummy node |
30 | 32 | node.add(new DefaultMutableTreeNode()); |
31 | 33 | return node; |
+3
-1
16 | 16 | |
17 | 17 | import javax.swing.*; |
18 | 18 | import javax.swing.tree.DefaultMutableTreeNode; |
19 | import java.io.File; | |
19 | 20 | |
20 | 21 | public class EjbJarXmlFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider { |
21 | 22 | protected static final ImageIcon ICON = new ImageIcon(ManifestFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/xml_obj.gif")); |
25 | 26 | @Override |
26 | 27 | @SuppressWarnings("unchecked") |
27 | 28 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
28 | return (T)new TreeNode(entry, new TreeNodeBean("ejb-jar.xml", "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String location = new File(entry.getUri()).getPath(); | |
30 | return (T)new TreeNode(entry, new TreeNodeBean("ejb-jar.xml", "Location: " + location, ICON)); | |
29 | 31 | } |
30 | 32 | |
31 | 33 | protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator { |
14 | 14 | |
15 | 15 | import javax.swing.*; |
16 | 16 | import javax.swing.tree.DefaultMutableTreeNode; |
17 | import java.io.File; | |
17 | 18 | import java.net.URI; |
18 | 19 | |
19 | 20 | public class FileTreeNodeFactoryProvider extends AbstractTreeNodeFactoryProvider { |
20 | protected static final ImageIcon ICON = new ImageIcon(FileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/file_plain_obj.png")); | |
21 | protected static final ImageIcon ICON = new ImageIcon(FileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/file_plain_obj.png")); | |
21 | 22 | |
22 | 23 | @Override public String[] getSelectors() { return appendSelectors("*:file:*"); } |
23 | 24 | |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf('/'); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, ICON)); | |
30 | } | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
32 | } | |
31 | 33 | |
32 | 34 | protected static class TreeNode extends DefaultMutableTreeNode implements ContainerEntryGettable, UriGettable { |
33 | 35 | protected Container.Entry entry; |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class HtmlFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/html_obj.gif")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | 18 | import java.awt.*; |
19 | import java.io.File; | |
19 | 20 | import java.io.IOException; |
20 | 21 | import java.io.InputStream; |
21 | 22 | import java.net.URI; |
29 | 30 | @SuppressWarnings("unchecked") |
30 | 31 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
31 | 32 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
32 | String name = entry.getPath().substring(lastSlashIndex+1); | |
33 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
33 | String label = entry.getPath().substring(lastSlashIndex+1); | |
34 | String location = new File(entry.getUri()).getPath(); | |
35 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
34 | 36 | } |
35 | 37 | |
36 | 38 | protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator { |
+5
-3
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | import java.util.Collection; |
19 | 20 | |
20 | 21 | public class JarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider { |
27 | 28 | @SuppressWarnings("unchecked") |
28 | 29 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
29 | 30 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
30 | String name = entry.getPath().substring(lastSlashIndex+1); | |
31 | String label = entry.getPath().substring(lastSlashIndex+1); | |
32 | String location = new File(entry.getUri()).getPath(); | |
31 | 33 | ImageIcon icon = isAEjbModule(entry) ? EJB_FILE_ICON : JAR_FILE_ICON; |
32 | T node = (T)new TreeNode(entry, "jar", new TreeNodeBean(name, icon)); | |
34 | T node = (T)new TreeNode(entry, "jar", new TreeNodeBean(label, "Location: " + location, icon)); | |
33 | 35 | // Add dummy node |
34 | 36 | node.add(new DefaultMutableTreeNode()); |
35 | 37 | return node; |
36 | } | |
38 | } | |
37 | 39 | |
38 | 40 | protected static boolean isAEjbModule(Container.Entry entry) { |
39 | 41 | Collection<Container.Entry> children = entry.getChildren(); |
+3
-3
27 | 27 | @SuppressWarnings("unchecked") |
28 | 28 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
29 | 29 | int lastSlashIndex = entry.getPath().lastIndexOf('/'); |
30 | String name = entry.getPath().substring(lastSlashIndex+1); | |
31 | ||
32 | return (T)new FileTreeNode(entry, new TreeNodeBean(name, JAVA_FILE_ICON), FACTORY); | |
30 | String label = entry.getPath().substring(lastSlashIndex+1); | |
31 | String location = new File(entry.getUri()).getPath(); | |
32 | return (T)new FileTreeNode(entry, new TreeNodeBean(label, "Location: " + location, JAVA_FILE_ICON), FACTORY); | |
33 | 33 | } |
34 | 34 | |
35 | 35 | protected static class Factory implements AbstractTypeFileTreeNodeFactoryProvider.PageAndTipFactory { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class JavascriptFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(JavascriptFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/js_obj.png")); |
24 | 25 | @SuppressWarnings("unchecked") |
25 | 26 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
26 | 27 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
27 | String name = entry.getPath().substring(lastSlashIndex+1); | |
28 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
28 | String label = entry.getPath().substring(lastSlashIndex+1); | |
29 | String location = new File(entry.getUri()).getPath(); | |
30 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
29 | 31 | } |
30 | 32 | |
31 | 33 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-13
10 | 10 | import org.jd.gui.api.feature.ContainerEntryGettable; |
11 | 11 | import org.jd.gui.api.feature.UriGettable; |
12 | 12 | import org.jd.gui.api.model.Container; |
13 | import org.jd.gui.spi.TreeNodeFactory; | |
14 | 13 | import org.jd.gui.view.data.TreeNodeBean; |
15 | 14 | |
16 | import javax.swing.*; | |
17 | 15 | import javax.swing.tree.DefaultMutableTreeNode; |
16 | import java.io.File; | |
18 | 17 | |
19 | 18 | public class JmodFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider { |
20 | 19 | @Override public String[] getSelectors() { return appendSelectors("*:file:*.jmod"); } |
23 | 22 | @SuppressWarnings("unchecked") |
24 | 23 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
25 | 24 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
26 | String name = entry.getPath().substring(lastSlashIndex+1); | |
27 | ||
28 | ||
29 | ||
30 | T node = (T)new TreeNode(entry, "generic", new TreeNodeBean(name, ICON)); | |
31 | ||
32 | ||
33 | ||
25 | String label = entry.getPath().substring(lastSlashIndex+1); | |
26 | String location = new File(entry.getUri()).getPath(); | |
27 | T node = (T)new TreeNode(entry, "generic", new TreeNodeBean(label, "Location: " + location, ICON)); | |
34 | 28 | // Add dummy node |
35 | 29 | node.add(new DefaultMutableTreeNode()); |
36 | ||
37 | ||
38 | ||
39 | 30 | return node; |
40 | 31 | } |
41 | 32 | } |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class JsonFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(JsonFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/ascii_obj.png")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class JspFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/html_obj.gif")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+3
-1
16 | 16 | |
17 | 17 | import javax.swing.*; |
18 | 18 | import javax.swing.tree.DefaultMutableTreeNode; |
19 | import java.io.File; | |
19 | 20 | |
20 | 21 | public class ManifestFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider { |
21 | 22 | protected static final ImageIcon ICON = new ImageIcon(ManifestFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/manifest_obj.png")); |
25 | 26 | @Override |
26 | 27 | @SuppressWarnings("unchecked") |
27 | 28 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
28 | return (T)new TreeNode(entry, new TreeNodeBean("MANIFEST.MF", "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String location = new File(entry.getUri()).getPath(); | |
30 | return (T)new TreeNode(entry, new TreeNodeBean("MANIFEST.MF", "Location: " + location, ICON)); | |
29 | 31 | } |
30 | 32 | |
31 | 33 | protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator { |
+4
-2
16 | 16 | |
17 | 17 | import javax.swing.*; |
18 | 18 | import javax.swing.tree.DefaultMutableTreeNode; |
19 | import java.io.File; | |
19 | 20 | import java.util.regex.Pattern; |
20 | 21 | |
21 | 22 | public class MetainfServiceFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider { |
35 | 36 | @SuppressWarnings("unchecked") |
36 | 37 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
37 | 38 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
38 | String name = entry.getPath().substring(lastSlashIndex+1); | |
39 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
39 | String label = entry.getPath().substring(lastSlashIndex+1); | |
40 | String location = new File(entry.getUri()).getPath(); | |
41 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
40 | 42 | } |
41 | 43 | |
42 | 44 | protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator { |
+3
-1
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | import java.util.Collection; |
19 | 20 | |
20 | 21 | public class PackageTreeNodeFactoryProvider extends DirectoryTreeNodeFactoryProvider { |
37 | 38 | } |
38 | 39 | |
39 | 40 | String label = entry.getPath().substring(lastSlashIndex+1).replace("/", "."); |
40 | T node = (T)new TreeNode(entry, new TreeNodeBean(label, getIcon(), getOpenIcon())); | |
41 | String location = new File(entry.getUri()).getPath(); | |
42 | T node = (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, getIcon(), getOpenIcon())); | |
41 | 43 | |
42 | 44 | if (entries.size() > 0) { |
43 | 45 | // Add dummy node |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class PropertiesFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(PropertiesFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/ascii_obj.png")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class SqlFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(SqlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/sql_obj.png")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
21 | 21 | |
22 | 22 | import javax.swing.*; |
23 | 23 | import javax.swing.tree.DefaultMutableTreeNode; |
24 | import java.io.File; | |
24 | 25 | import java.io.IOException; |
25 | 26 | import java.net.URI; |
26 | 27 | |
45 | 46 | @SuppressWarnings("unchecked") |
46 | 47 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
47 | 48 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
48 | String name = entry.getPath().substring(lastSlashIndex+1); | |
49 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
49 | String label = entry.getPath().substring(lastSlashIndex+1); | |
50 | String location = new File(entry.getUri()).getPath(); | |
51 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
50 | 52 | } |
51 | 53 | |
52 | 54 | protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator { |
+4
-2
14 | 14 | |
15 | 15 | import javax.swing.*; |
16 | 16 | import javax.swing.tree.DefaultMutableTreeNode; |
17 | import java.io.File; | |
17 | 18 | |
18 | 19 | public class WarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider { |
19 | 20 | protected static final ImageIcon ICON = new ImageIcon(JarFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/war_obj.gif")); |
24 | 25 | @SuppressWarnings("unchecked") |
25 | 26 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
26 | 27 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
27 | String name = entry.getPath().substring(lastSlashIndex+1); | |
28 | T node = (T)new TreeNode(entry, "war", new TreeNodeBean(name, ICON)); | |
28 | String label = entry.getPath().substring(lastSlashIndex+1); | |
29 | String location = new File(entry.getUri()).getPath(); | |
30 | T node = (T)new TreeNode(entry, "war", new TreeNodeBean(label, "Location: " + location, ICON)); | |
29 | 31 | // Add dummy node |
30 | 32 | node.add(new DefaultMutableTreeNode()); |
31 | 33 | return node; |
+3
-1
16 | 16 | |
17 | 17 | import javax.swing.*; |
18 | 18 | import javax.swing.tree.DefaultMutableTreeNode; |
19 | import java.io.File; | |
19 | 20 | |
20 | 21 | public class WebXmlFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider { |
21 | 22 | protected static final ImageIcon ICON = new ImageIcon(ManifestFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/xml_obj.gif")); |
25 | 26 | @Override |
26 | 27 | @SuppressWarnings("unchecked") |
27 | 28 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
28 | return (T)new TreeNode(entry, new TreeNodeBean("web.xml", "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String location = new File(entry.getUri()).getPath(); | |
30 | return (T)new TreeNode(entry, new TreeNodeBean("web.xml", "Location: " + location, ICON)); | |
29 | 31 | } |
30 | 32 | |
31 | 33 | protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class XmlBasedFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(XmlBasedFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/xml_obj.gif")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class XmlFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(XmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/xml_obj.gif")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | } |
31 | 33 | |
32 | 34 | protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { |
+4
-2
15 | 15 | |
16 | 16 | import javax.swing.*; |
17 | 17 | import javax.swing.tree.DefaultMutableTreeNode; |
18 | import java.io.File; | |
18 | 19 | |
19 | 20 | public class ZipFileTreeNodeFactoryProvider extends DirectoryTreeNodeFactoryProvider { |
20 | 21 | protected static final ImageIcon ICON = new ImageIcon(ZipFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/zip_obj.png")); |
25 | 26 | @SuppressWarnings("unchecked") |
26 | 27 | public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { |
27 | 28 | int lastSlashIndex = entry.getPath().lastIndexOf("/"); |
28 | String name = entry.getPath().substring(lastSlashIndex+1); | |
29 | T node = (T)new TreeNode(entry, "generic", new TreeNodeBean(name, ICON)); | |
29 | String label = entry.getPath().substring(lastSlashIndex+1); | |
30 | String location = new File(entry.getUri()).getPath(); | |
31 | T node = (T)new TreeNode(entry, "generic", new TreeNodeBean(label, "Location: " + location, ICON)); | |
30 | 32 | // Add dummy node |
31 | 33 | node.add(new DefaultMutableTreeNode()); |
32 | 34 | return node; |