mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
load document from resource
This commit is contained in:
+3
-3
@@ -284,9 +284,9 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
|
||||
if (ourShadowInstance == null) {
|
||||
ourShadowInstance = new ApplicationInfoImpl();
|
||||
try {
|
||||
Document doc = JDOMUtil.loadDocument(ApplicationInfoImpl.class.getResourceAsStream(IDEA_PATH +
|
||||
ApplicationNamesInfo.getComponentName() +
|
||||
XML_EXTENSION));
|
||||
Document doc = JDOMUtil.loadDocument(ApplicationInfoImpl.class, IDEA_PATH +
|
||||
ApplicationNamesInfo.getComponentName() +
|
||||
XML_EXTENSION);
|
||||
ourShadowInstance.readExternal(doc.getRootElement());
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
@@ -336,6 +336,13 @@ public class JDOMUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Document loadDocument(Class clazz, String reaource) throws JDOMException, IOException {
|
||||
InputStream stream = clazz.getResourceAsStream(reaource);
|
||||
if (stream == null) throw new FileNotFoundException(reaource);
|
||||
return loadDocument(stream);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Document loadDocument(URL url) throws JDOMException, IOException {
|
||||
return loadDocument(URLUtil.openStream(url));
|
||||
|
||||
Reference in New Issue
Block a user