mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javafx: use common exception to flag stop
This commit is contained in:
+18
-24
@@ -98,34 +98,28 @@ public class JavaFxControllerClassIndex extends ScalarIndexExtension<String> {
|
||||
}
|
||||
|
||||
final String[] className = new String[]{null};
|
||||
|
||||
class StopException extends RuntimeException {}
|
||||
NanoXmlUtil.parse(new StringReader(content), new NanoXmlUtil.IXMLBuilderAdapter() {
|
||||
private boolean myFxRootUsed = false;
|
||||
|
||||
try {
|
||||
NanoXmlUtil.parse(new StringReader(content), new NanoXmlUtil.IXMLBuilderAdapter() {
|
||||
private boolean myFxRootUsed = false;
|
||||
|
||||
@Override
|
||||
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
|
||||
if (value != null &&
|
||||
(FxmlConstants.FX_CONTROLLER.equals(nsPrefix + ":" + key) || FxmlConstants.TYPE.equals(key) && myFxRootUsed)) {
|
||||
className[0] = value;
|
||||
}
|
||||
@Override
|
||||
public void addAttribute(String key, String nsPrefix, String nsURI, String value, String type) throws Exception {
|
||||
if (value != null &&
|
||||
(FxmlConstants.FX_CONTROLLER.equals(nsPrefix + ":" + key) || FxmlConstants.TYPE.equals(key) && myFxRootUsed)) {
|
||||
className[0] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementAttributesProcessed(String name, String nsPrefix, String nsURI) throws Exception {
|
||||
throw new StopException();
|
||||
}
|
||||
@Override
|
||||
public void elementAttributesProcessed(String name, String nsPrefix, String nsURI) throws Exception {
|
||||
throw NanoXmlUtil.ParserStoppedXmlException.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr)
|
||||
throws Exception {
|
||||
myFxRootUsed = FxmlConstants.FX_ROOT.equals(nsPrefix + ":" + name);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (StopException ignore){}
|
||||
@Override
|
||||
public void startElement(String name, String nsPrefix, String nsURI, String systemID, int lineNr)
|
||||
throws Exception {
|
||||
myFxRootUsed = FxmlConstants.FX_ROOT.equals(nsPrefix + ":" + name);
|
||||
}
|
||||
});
|
||||
return className[0];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user