Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CND (Apache Jackrabbit), Drools and Groovy files #309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.fife.ui.rsyntaxtextarea.SyntaxConstants;
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.view.data.TreeNodeBean;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class GroovyTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(GroovyTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/groovy_obj.png"));

@Override public String[] getSelectors() { return appendSelectors("*:file:*.groovy"); }

@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);
String location = new File(entry.getUri()).getPath();
return (T)new GroovyTreeNodeFactoryProvider.TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
public TreeNode(Container.Entry entry, Object userObject) { super(entry, userObject); }

// --- PageCreator --- //
@Override
@SuppressWarnings("unchecked")
public <T extends JComponent & UriGettable> T createPage(API api) {
return (T)new TextFileTreeNodeFactoryProvider.Page(entry) {
@Override public String getSyntaxStyle() { return SyntaxConstants.SYNTAX_STYLE_GROOVY; }
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
public class PropertiesFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(PropertiesFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/ascii_obj.png"));

@Override public String[] getSelectors() { return appendSelectors("*:file:*.properties"); }
@Override public String[] getSelectors() { return appendSelectors("*:file:*.properties", "*:file:*.cfg"); }

@Override
@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class TextFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider
}

@Override public String[] getSelectors() {
return appendSelectors("*:file:*.txt", "*:file:*.md", "*:file:*.SF", "*:file:*.policy", "*:file:*.yaml", "*:file:*.yml", "*:file:*/COPYRIGHT", "*:file:*/LICENSE");
return appendSelectors("*:file:*.txt", "*:file:*.md", "*:file:*.SF", "*:file:*.policy", "*:file:*.yaml", "*:file:*.yml", "*:file:*/COPYRIGHT", "*:file:*/LICENSE", "*:file:*.cnd", "*:file:*.drl", "*:file:*.dsl");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ org.jd.gui.service.treenode.XmlBasedFileTreeNodeFactoryProvider
org.jd.gui.service.treenode.XmlFileTreeNodeFactoryProvider
org.jd.gui.service.treenode.ZipFileTreeNodeFactoryProvider
org.jd.gui.service.treenode.ImageFileTreeNodeFactoryProvider
org.jd.gui.service.treenode.GroovyTreeNodeFactoryProvider
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.