-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
emmanue1
committed
Jun 1, 2019
1 parent
25b7e53
commit fbc5b14
Showing
14 changed files
with
347 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
...ices/src/main/java/org/jd/gui/service/treenode/ModuleInfoFileTreeNodeFactoryProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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 org.jd.gui.api.API; | ||
import org.jd.gui.api.feature.ContainerEntryGettable; | ||
import org.jd.gui.api.feature.UriGettable; | ||
import org.jd.gui.api.model.Container; | ||
import org.jd.gui.util.exception.ExceptionUtil; | ||
import org.jd.gui.view.component.ModuleInfoFilePage; | ||
import org.jd.gui.view.data.TreeNodeBean; | ||
|
||
import javax.swing.*; | ||
import javax.swing.tree.DefaultMutableTreeNode; | ||
import java.io.File; | ||
import java.util.regex.Pattern; | ||
|
||
public class ModuleInfoFileTreeNodeFactoryProvider extends ClassFileTreeNodeFactoryProvider { | ||
protected static final Factory FACTORY = new Factory(); | ||
|
||
static { | ||
// Early class loading | ||
try { | ||
Class.forName(ModuleInfoFilePage.class.getName()); | ||
} catch (Exception e) { | ||
assert ExceptionUtil.printStackTrace(e); | ||
} | ||
} | ||
|
||
@Override public String[] getSelectors() { return appendSelectors("*:file:*/module-info.class"); } | ||
|
||
@Override public Pattern getPathPattern() { return externalPathPattern; } | ||
|
||
@Override | ||
@SuppressWarnings("unchecked") | ||
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) { | ||
int lastSlashIndex = entry.getPath().lastIndexOf('/'); | ||
String label = entry.getPath().substring(lastSlashIndex+1); | ||
return (T)new FileTreeNode(entry, new TreeNodeBean(label, CLASS_FILE_ICON), FACTORY); | ||
} | ||
|
||
protected static class Factory implements AbstractTypeFileTreeNodeFactoryProvider.PageAndTipFactory { | ||
// --- PageAndTipFactory --- // | ||
@Override | ||
@SuppressWarnings("unchecked") | ||
public <T extends JComponent & UriGettable> T makePage(API a, Container.Entry e) { | ||
return (T)new ModuleInfoFilePage(a, e); | ||
} | ||
|
||
@Override | ||
public String makeTip(API api, Container.Entry entry) { | ||
String location = new File(entry.getUri()).getPath(); | ||
StringBuilder tip = new StringBuilder("<html>Location: "); | ||
|
||
tip.append(location); | ||
tip.append("</html>"); | ||
|
||
return tip.toString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.