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
8 changed files
with
216 additions
and
180 deletions.
There are no files selected for viewing
45 changes: 0 additions & 45 deletions
45
services/src/main/groovy/jd/gui/service/indexer/AbstractIndexerProvider.groovy
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
services/src/main/groovy/jd/gui/service/sourcesaver/AbstractSourceSaverProvider.groovy
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
services/src/main/groovy/jd/gui/service/treenode/AbstractTreeNodeFactoryProvider.groovy
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
services/src/main/groovy/jd/gui/service/type/AbstractTypeFactoryProvider.groovy
This file was deleted.
Oops, something went wrong.
54 changes: 54 additions & 0 deletions
54
services/src/main/java/jd/gui/service/indexer/AbstractIndexerProvider.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,54 @@ | ||
/* | ||
* 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.spi.Indexer; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Properties; | ||
import java.util.regex.Pattern; | ||
|
||
public abstract class AbstractIndexerProvider implements Indexer { | ||
|
||
protected List<String> externalSelectors; | ||
protected Pattern externalPathPattern; | ||
|
||
/** | ||
* Initialize "selectors" and "pathPattern" with optional external properties file | ||
*/ | ||
AbstractIndexerProvider() { | ||
Properties properties = new Properties(); | ||
Class clazz = this.getClass(); | ||
|
||
try (InputStream is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".properties")) { | ||
if (is != null) { | ||
properties.load(is); | ||
} | ||
} catch (IOException ignore) { | ||
} | ||
|
||
init(properties); | ||
} | ||
|
||
protected void init(Properties properties) { | ||
String selectors = properties.getProperty("selectors"); | ||
externalSelectors = (selectors == null) ? null : Arrays.asList(selectors.split(",")); | ||
|
||
String pathRegExp = properties.getProperty("pathRegExp"); | ||
externalPathPattern = (pathRegExp == null) ? null : Pattern.compile(pathRegExp); | ||
} | ||
|
||
protected List<String> getExternalSelectors() { return externalSelectors; } | ||
protected Pattern getExternalPathPattern() { return externalPathPattern; } | ||
|
||
public String[] getSelectors() { | ||
return (externalSelectors==null) ? null : externalSelectors.toArray(new String[externalSelectors.size()]); | ||
} | ||
public Pattern getPathPattern() { return externalPathPattern; } | ||
} |
54 changes: 54 additions & 0 deletions
54
services/src/main/java/jd/gui/service/sourcesaver/AbstractSourceSaverProvider.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,54 @@ | ||
/* | ||
* Copyright (c) 2008-2015 Emmanuel Dupuy | ||
* This program is made available under the terms of the GPLv3 License. | ||
*/ | ||
|
||
package jd.gui.service.sourcesaver; | ||
|
||
import jd.gui.spi.SourceSaver; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Properties; | ||
import java.util.regex.Pattern; | ||
|
||
public abstract class AbstractSourceSaverProvider implements SourceSaver { | ||
|
||
protected List<String> externalSelectors; | ||
protected Pattern externalPathPattern; | ||
|
||
/** | ||
* Initialize "selectors" and "pathPattern" with optional external properties file | ||
*/ | ||
AbstractSourceSaverProvider() { | ||
Properties properties = new Properties(); | ||
Class clazz = this.getClass(); | ||
|
||
try (InputStream is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".properties")) { | ||
if (is != null) { | ||
properties.load(is); | ||
} | ||
} catch (IOException ignore) { | ||
} | ||
|
||
init(properties); | ||
} | ||
|
||
protected void init(Properties properties) { | ||
String selectors = properties.getProperty("selectors"); | ||
externalSelectors = (selectors == null) ? null : Arrays.asList(selectors.split(",")); | ||
|
||
String pathRegExp = properties.getProperty("pathRegExp"); | ||
externalPathPattern = (pathRegExp == null) ? null : Pattern.compile(pathRegExp); | ||
} | ||
|
||
protected List<String> getExternalSelectors() { return externalSelectors; } | ||
protected Pattern getExternalPathPattern() { return externalPathPattern; } | ||
|
||
public String[] getSelectors() { | ||
return (externalSelectors==null) ? null : externalSelectors.toArray(new String[externalSelectors.size()]); | ||
} | ||
public Pattern getPathPattern() { return externalPathPattern; } | ||
} |
54 changes: 54 additions & 0 deletions
54
services/src/main/java/jd/gui/service/treenode/AbstractTreeNodeFactoryProvider.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,54 @@ | ||
/* | ||
* 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.spi.TreeNodeFactory; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Properties; | ||
import java.util.regex.Pattern; | ||
|
||
public abstract class AbstractTreeNodeFactoryProvider implements TreeNodeFactory { | ||
|
||
protected List<String> externalSelectors; | ||
protected Pattern externalPathPattern; | ||
|
||
/** | ||
* Initialize "selectors" and "pathPattern" with optional external properties file | ||
*/ | ||
AbstractTreeNodeFactoryProvider() { | ||
Properties properties = new Properties(); | ||
Class clazz = this.getClass(); | ||
|
||
try (InputStream is = clazz.getClassLoader().getResourceAsStream(clazz.getName().replace('.', '/') + ".properties")) { | ||
if (is != null) { | ||
properties.load(is); | ||
} | ||
} catch (IOException ignore) { | ||
} | ||
|
||
init(properties); | ||
} | ||
|
||
protected void init(Properties properties) { | ||
String selectors = properties.getProperty("selectors"); | ||
externalSelectors = (selectors == null) ? null : Arrays.asList(selectors.split(",")); | ||
|
||
String pathRegExp = properties.getProperty("pathRegExp"); | ||
externalPathPattern = (pathRegExp == null) ? null : Pattern.compile(pathRegExp); | ||
} | ||
|
||
protected List<String> getExternalSelectors() { return externalSelectors; } | ||
protected Pattern getExternalPathPattern() { return externalPathPattern; } | ||
|
||
public String[] getSelectors() { | ||
return (externalSelectors==null) ? null : externalSelectors.toArray(new String[externalSelectors.size()]); | ||
} | ||
public Pattern getPathPattern() { return externalPathPattern; } | ||
} |
Oops, something went wrong.