diff --git a/api/src/main/java/org/jd/gui/spi/TreeNodeFactory.java b/api/src/main/java/org/jd/gui/spi/TreeNodeFactory.java index 8eff37de..ad8fa6a8 100644 --- a/api/src/main/java/org/jd/gui/spi/TreeNodeFactory.java +++ b/api/src/main/java/org/jd/gui/spi/TreeNodeFactory.java @@ -16,9 +16,9 @@ import java.util.regex.Pattern; public interface TreeNodeFactory { - String[] getSelectors(); + String[] getSelectors(); Pattern getPathPattern(); - T make(API api, Container.Entry entry); + T make(API api, Container.Entry entry); } diff --git a/services/src/main/java/org/jd/gui/service/treenode/ClassesDirectoryTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/ClassesDirectoryTreeNodeFactoryProvider.java index f5d91511..510cc684 100644 --- a/services/src/main/java/org/jd/gui/service/treenode/ClassesDirectoryTreeNodeFactoryProvider.java +++ b/services/src/main/java/org/jd/gui/service/treenode/ClassesDirectoryTreeNodeFactoryProvider.java @@ -12,7 +12,23 @@ public class ClassesDirectoryTreeNodeFactoryProvider extends DirectoryTreeNodeFactoryProvider { protected static final ImageIcon ICON = new ImageIcon(ClassesDirectoryTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/packagefolder_obj.png")); - @Override public String[] getSelectors() { return appendSelectors("war:dir:WEB-INF/classes", "jmod:dir:classes"); } + @Override public String[] getSelectors() { + return appendSelectors( + "jar:dir:META-INF/versions", + "jar:dir:META-INF/versions/5", + "jar:dir:META-INF/versions/6", + "jar:dir:META-INF/versions/7", + "jar:dir:META-INF/versions/8", + "jar:dir:META-INF/versions/9", + "jar:dir:META-INF/versions/10", + "jar:dir:META-INF/versions/11", + "jar:dir:META-INF/versions/12", + "jar:dir:META-INF/versions/13", + "jar:dir:META-INF/versions/14", + "war:dir:WEB-INF/classes", + "jmod:dir:classes"); + } + @Override public ImageIcon getIcon() { return ICON; } @Override public ImageIcon getOpenIcon() { return null; } } diff --git a/services/src/main/java/org/jd/gui/service/treenode/DirectoryTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/DirectoryTreeNodeFactoryProvider.java index 473c6e85..c58a3fab 100644 --- a/services/src/main/java/org/jd/gui/service/treenode/DirectoryTreeNodeFactoryProvider.java +++ b/services/src/main/java/org/jd/gui/service/treenode/DirectoryTreeNodeFactoryProvider.java @@ -23,7 +23,7 @@ import java.util.Collection; public class DirectoryTreeNodeFactoryProvider extends AbstractTreeNodeFactoryProvider { - protected static final ImageIcon ICON = new ImageIcon(DirectoryTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/folder.gif")); + protected static final ImageIcon ICON = new ImageIcon(DirectoryTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/folder.gif")); protected static final ImageIcon OPEN_ICON = new ImageIcon(DirectoryTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/folder_open.png")); @Override public String[] getSelectors() { return appendSelectors("*:dir:*"); } diff --git a/services/src/main/java/org/jd/gui/service/treenode/JavaModulePackageTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/JavaModulePackageTreeNodeFactoryProvider.java index fbd71e57..7706c069 100644 --- a/services/src/main/java/org/jd/gui/service/treenode/JavaModulePackageTreeNodeFactoryProvider.java +++ b/services/src/main/java/org/jd/gui/service/treenode/JavaModulePackageTreeNodeFactoryProvider.java @@ -16,7 +16,7 @@ public class JavaModulePackageTreeNodeFactoryProvider extends PackageTreeNodeFac @Override public Pattern getPathPattern() { if (externalPathPattern == null) { - return Pattern.compile("classes\\/.*"); + return Pattern.compile("classes\\/(?!META-INF)..*"); } else { return externalPathPattern; } diff --git a/services/src/main/java/org/jd/gui/service/treenode/MetainfDirectoryTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/MetainfDirectoryTreeNodeFactoryProvider.java index 9a4050d7..acd120ab 100644 --- a/services/src/main/java/org/jd/gui/service/treenode/MetainfDirectoryTreeNodeFactoryProvider.java +++ b/services/src/main/java/org/jd/gui/service/treenode/MetainfDirectoryTreeNodeFactoryProvider.java @@ -13,15 +13,13 @@ public class MetainfDirectoryTreeNodeFactoryProvider extends DirectoryTreeNodeFactoryProvider { protected static final ImageIcon ICON = new ImageIcon(MetainfDirectoryTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/inf_obj.png")); - @Override public String[] getSelectors() { return appendSelectors("jar:dir:*", "war:dir:*", "ear:dir:*"); } - - @Override - public Pattern getPathPattern() { - if (externalPathPattern == null) { - return Pattern.compile("(WEB-INF|(WEB-INF\\/classes\\/)?META-IN(F|F\\/.*))"); - } else { - return externalPathPattern; - } + @Override public String[] getSelectors() { + return appendSelectors( + "jar:dir:META-INF", + "war:dir:WEB-INF", + "war:dir:WEB-INF/classes/META-INF", + "ear:dir:META-INF", + "jmod:dir:classes/META-INF"); } @Override public ImageIcon getIcon() { return ICON; } diff --git a/services/src/main/java/org/jd/gui/service/treenode/PackageTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/PackageTreeNodeFactoryProvider.java index bc796610..3db5d656 100644 --- a/services/src/main/java/org/jd/gui/service/treenode/PackageTreeNodeFactoryProvider.java +++ b/services/src/main/java/org/jd/gui/service/treenode/PackageTreeNodeFactoryProvider.java @@ -18,12 +18,22 @@ import javax.swing.tree.DefaultMutableTreeNode; import java.io.File; import java.util.Collection; +import java.util.regex.Pattern; public class PackageTreeNodeFactoryProvider extends DirectoryTreeNodeFactoryProvider { protected static final ImageIcon ICON = new ImageIcon(PackageTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/package_obj.png")); @Override public String[] getSelectors() { return appendSelectors("jar:dir:*"); } + @Override + public Pattern getPathPattern() { + if (externalPathPattern == null) { + return Pattern.compile("(META-INF\\/versions\\/.*)|(?!META-INF)..*"); + } else { + return externalPathPattern; + } + } + @Override @SuppressWarnings("unchecked") public T make(API api, Container.Entry entry) { diff --git a/services/src/main/java/org/jd/gui/service/treenode/SpiFileTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/SpiFileTreeNodeFactoryProvider.java new file mode 100644 index 00000000..48f2bab0 --- /dev/null +++ b/services/src/main/java/org/jd/gui/service/treenode/SpiFileTreeNodeFactoryProvider.java @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2008-2019 Emmanuel Dupuy. + * This project is distributed under the GPLv3 license. + * This is a Copyleft license that gives the user the right to use, + * copy and modify the code freely for non-commercial purposes. + */ + +package org.jd.gui.service.treenode; + +import java.util.regex.Pattern; + +public class SpiFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { + @Override public String[] getSelectors() { + return appendSelectors("*:file:*"); + } + + @Override + public Pattern getPathPattern() { + if (externalPathPattern == null) { + return Pattern.compile("(.*\\/)?META-INF\\/services\\/.*"); + } else { + return externalPathPattern; + } + } +} \ No newline at end of file diff --git a/services/src/main/java/org/jd/gui/service/treenode/WarPackageTreeNodeFactoryProvider.java b/services/src/main/java/org/jd/gui/service/treenode/WarPackageTreeNodeFactoryProvider.java index c32e1f51..d42fa2cd 100644 --- a/services/src/main/java/org/jd/gui/service/treenode/WarPackageTreeNodeFactoryProvider.java +++ b/services/src/main/java/org/jd/gui/service/treenode/WarPackageTreeNodeFactoryProvider.java @@ -16,7 +16,7 @@ public class WarPackageTreeNodeFactoryProvider extends PackageTreeNodeFactoryPro @Override public Pattern getPathPattern() { if (externalPathPattern == null) { - return Pattern.compile("WEB-INF\\/classes\\/.*"); + return Pattern.compile("WEB-INF\\/classes\\/(?!META-INF)..*"); } else { return externalPathPattern; } diff --git a/services/src/main/resources/META-INF/services/org.jd.gui.spi.TreeNodeFactory b/services/src/main/resources/META-INF/services/org.jd.gui.spi.TreeNodeFactory index 697007d1..b331e515 100644 --- a/services/src/main/resources/META-INF/services/org.jd.gui.spi.TreeNodeFactory +++ b/services/src/main/resources/META-INF/services/org.jd.gui.spi.TreeNodeFactory @@ -21,6 +21,7 @@ org.jd.gui.service.treenode.ModuleInfoFileTreeNodeFactoryProvider org.jd.gui.service.treenode.PackageTreeNodeFactoryProvider org.jd.gui.service.treenode.PropertiesFileTreeNodeFactoryProvider org.jd.gui.service.treenode.SqlFileTreeNodeFactoryProvider +org.jd.gui.service.treenode.SpiFileTreeNodeFactoryProvider org.jd.gui.service.treenode.TextFileTreeNodeFactoryProvider org.jd.gui.service.treenode.WarFileTreeNodeFactoryProvider org.jd.gui.service.treenode.WarPackageTreeNodeFactoryProvider