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.
- Loading branch information
Showing
34 changed files
with
632 additions
and
40 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
22 changes: 22 additions & 0 deletions
22
services/src/main/groovy/jd/gui/model/container/WarContainer.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,22 @@ | ||
/* | ||
* Copyright (c) 2008-2015 Emmanuel Dupuy | ||
* This program is made available under the terms of the GPLv3 License. | ||
*/ | ||
|
||
package jd.gui.model.container | ||
|
||
import groovy.transform.CompileStatic | ||
import jd.gui.api.API | ||
import jd.gui.api.model.Container | ||
|
||
import java.nio.file.Path | ||
|
||
@CompileStatic | ||
class WarContainer extends GenericContainer { | ||
|
||
WarContainer(API api, Container.Entry parentEntry, Path rootPath) { | ||
super(api, parentEntry, rootPath) | ||
} | ||
|
||
String getType() { 'war' } | ||
} |
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
37 changes: 37 additions & 0 deletions
37
services/src/main/groovy/jd/gui/service/container/WarContainerFactoryProvider.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,37 @@ | ||
/* | ||
* Copyright (c) 2008-2015 Emmanuel Dupuy | ||
* This program is made available under the terms of the GPLv3 License. | ||
*/ | ||
|
||
package jd.gui.service.container | ||
|
||
import jd.gui.api.API | ||
import jd.gui.api.model.Container | ||
import jd.gui.model.container.WarContainer | ||
import jd.gui.spi.ContainerFactory | ||
|
||
import java.nio.file.Files | ||
import java.nio.file.InvalidPathException | ||
import java.nio.file.Path | ||
|
||
class WarContainerFactoryProvider implements ContainerFactory { | ||
|
||
String getType() { 'war' } | ||
|
||
boolean accept(API api, Path rootPath) { | ||
if (rootPath.toUri().toString().toLowerCase().endsWith('.war!/')) { | ||
return true | ||
} else { | ||
// Extension: accept uncompressed JAR file containing a folder 'WEB-INF' | ||
try { | ||
return rootPath.fileSystem.provider().scheme.equals('file') && Files.exists(rootPath.resolve('WEB-INF')) | ||
} catch (InvalidPathException e) { | ||
return false | ||
} | ||
} | ||
} | ||
|
||
Container make(API api, Container.Entry parentEntry, Path rootPath) { | ||
return new WarContainer(api, parentEntry, rootPath) | ||
} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
services/src/main/groovy/jd/gui/service/fileloader/WarFileLoaderProvider.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,13 @@ | ||
package jd.gui.service.fileloader | ||
|
||
import jd.gui.api.API | ||
|
||
class WarFileLoaderProvider extends ZipFileLoaderProvider { | ||
|
||
String[] getExtensions() { ['war'] } | ||
String getDescription() { 'War files (*.war)' } | ||
|
||
boolean accept(API api, File file) { | ||
return file.exists() && file.canRead() && file.name.toLowerCase().endsWith('.war') | ||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
services/src/main/groovy/jd/gui/service/indexer/WebXmlFileIndexerProvider.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,40 @@ | ||
/* | ||
* Copyright (c) 2008-2015 Emmanuel Dupuy | ||
* This program is made available under the terms of the GPLv3 License. | ||
*/ | ||
|
||
package jd.gui.service.indexer | ||
|
||
import jd.gui.api.API | ||
import jd.gui.api.model.Container | ||
import jd.gui.api.model.Indexes | ||
import jd.gui.util.xml.AbstractXmlPathFinder | ||
|
||
class WebXmlFileIndexerProvider extends XmlFileIndexerProvider { | ||
String[] getTypes() { ['*:file:WEB-INF/web.xml'] } | ||
|
||
void index(API api, Container.Entry entry, Indexes indexes) { | ||
super.index(api, entry, indexes) | ||
|
||
new WebXmlPathFinder(entry, indexes).find(entry.inputStream.text) | ||
} | ||
|
||
static class WebXmlPathFinder extends AbstractXmlPathFinder { | ||
Container.Entry entry | ||
Map<String, Collection> index | ||
|
||
WebXmlPathFinder(Container.Entry entry, Indexes indexes) { | ||
super([ | ||
'web-app/filter/filter-class', | ||
'web-app/listener/listener-class', | ||
'web-app/servlet/servlet-class' | ||
]) | ||
this.entry = entry | ||
this.index = indexes.getIndex('typeReferences'); | ||
} | ||
|
||
void handle(String path, String text, int position) { | ||
index.get(text.replace('.', '/')).add(entry); | ||
} | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
services/src/main/groovy/jd/gui/service/treenode/CssFileTreeNodeFactoryProvider.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,42 @@ | ||
/* | ||
* 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.ImageIcon | ||
import javax.swing.JComponent | ||
import javax.swing.tree.DefaultMutableTreeNode | ||
|
||
class CssFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { | ||
static final ImageIcon icon = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.classLoader.getResource('images/css_obj.png')) | ||
|
||
String[] getTypes() { ['*:file:*.css'] } | ||
|
||
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_CSS | ||
} | ||
} | ||
} | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
services/src/main/groovy/jd/gui/service/treenode/JspFileTreeNodeFactoryProvider.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,42 @@ | ||
/* | ||
* 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.ImageIcon | ||
import javax.swing.JComponent | ||
import javax.swing.tree.DefaultMutableTreeNode | ||
|
||
class JspFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider { | ||
static final ImageIcon icon = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.classLoader.getResource('images/html_obj.gif')) | ||
|
||
String[] getTypes() { ['*:file:*.jsp', '*:file:*.jspf'] } | ||
|
||
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_JSP | ||
} | ||
} | ||
} | ||
} | ||
} |
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.