forked from java-decompiler/jd-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds ".json", ".yaml" and ".yml" extensions
- Loading branch information
Showing
4 changed files
with
48 additions
and
2 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
44 changes: 44 additions & 0 deletions
44
services/src/main/groovy/jd/gui/service/treenode/JsonFileTreeNodeFactoryProvider.groovy
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,44 @@ | ||
/* | ||
* Copyright (c) 2008-2015 Emmanuel Dupuy | ||
* This program is made available under the terms of the GPLv3 License. | ||
*/ | ||
|
||
package jd.gui.service.treenode | ||
|
||
import jd.gui.api.API | ||
import jd.gui.api.feature.UriGettable | ||
import jd.gui.api.model.Container | ||
import jd.gui.view.data.TreeNodeBean | ||
import org.fife.ui.rsyntaxtextarea.SyntaxConstants | ||
|
||
import javax.swing.* | ||
import javax.swing.tree.DefaultMutableTreeNode | ||
|
||
class JsonFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { | ||
static final ImageIcon ICON = new ImageIcon(JsonFileTreeNodeFactoryProvider.class.classLoader.getResource('images/ascii_obj.png')) | ||
|
||
/** | ||
* @return local + optional external selectors | ||
*/ | ||
String[] getSelectors() { ['*:file:*.json'] + externalSelectors } | ||
|
||
public <T extends DefaultMutableTreeNode & UriGettable> T make(API api, Container.Entry entry) { | ||
int lastSlashIndex = entry.path.lastIndexOf('/') | ||
def name = entry.path.substring(lastSlashIndex+1) | ||
return new TreeNode(entry, new TreeNodeBean(label:name, icon:ICON, tip:"Location: $entry.uri.path")) | ||
} | ||
|
||
static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode { | ||
TreeNode(Container.Entry entry, Object userObject) { | ||
super(entry, userObject) | ||
} | ||
|
||
public <T extends JComponent & UriGettable> T createPage(API api) { | ||
return new TextFileTreeNodeFactoryProvider.Page(entry) { | ||
String getSyntaxStyle() { | ||
SyntaxConstants.SYNTAX_STYLE_JSON | ||
} | ||
} | ||
} | ||
} | ||
} |
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