use of com.intellij.uiDesigner.compiler.UnexpectedFormElementException in project intellij-community by JetBrains.
the class FormWordsScanner method processWords.
@Override
public void processWords(CharSequence fileText, final Processor<WordOccurrence> processor) {
super.processWords(fileText, processor);
try {
LwRootContainer container = Utils.getRootContainer(fileText.toString(), null);
String className = container.getClassToBind();
if (className != null) {
processClassAndPackagesNames(className, processor);
}
FormEditingUtil.iterate(container, new FormEditingUtil.ComponentVisitor() {
WordOccurrence occurence;
public boolean visit(IComponent iComponent) {
String componentClassName = iComponent.getComponentClassName();
processClassAndPackagesNames(componentClassName, processor);
final String binding = iComponent.getBinding();
if (binding != null) {
if (occurence == null)
occurence = new WordOccurrence(binding, 0, binding.length(), WordOccurrence.Kind.FOREIGN_LANGUAGE);
else
occurence.init(binding, 0, binding.length(), WordOccurrence.Kind.FOREIGN_LANGUAGE);
processor.process(occurence);
}
return true;
}
});
} catch (AlienFormFileException | JDOMParseException | UnexpectedFormElementException ex) {
// ignore
} catch (Exception e) {
LOG.error("Error indexing form file", e);
}
}
use of com.intellij.uiDesigner.compiler.UnexpectedFormElementException in project intellij-community by JetBrains.
the class LwRootContainer method read.
public void read(final Element element, final PropertiesProvider provider) throws Exception {
if (element == null) {
throw new IllegalArgumentException("element cannot be null");
}
if (!Utils.FORM_NAMESPACE.equals(element.getNamespace().getURI())) {
throw new AlienFormFileException();
}
if (!"form".equals(element.getName())) {
throw new UnexpectedFormElementException("unexpected element: " + element);
}
setId("root");
myClassToBind = element.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_BIND_TO_CLASS);
// Constraints and properties
for (Iterator i = element.getChildren().iterator(); i.hasNext(); ) {
final Element child = (Element) i.next();
if (child.getName().equals(UIFormXmlConstants.ELEMENT_BUTTON_GROUPS)) {
readButtonGroups(child);
} else if (child.getName().equals(UIFormXmlConstants.ELEMENT_INSPECTION_SUPPRESSIONS)) {
readInspectionSuppressions(child);
} else {
final LwComponent component = createComponentFromTag(child);
addComponent(component);
component.read(child, provider);
}
}
myMainComponentBinding = element.getAttributeValue("stored-main-component-binding");
}
use of com.intellij.uiDesigner.compiler.UnexpectedFormElementException in project intellij-community by JetBrains.
the class LwSplitPane method readConstraintsForChild.
protected void readConstraintsForChild(final Element element, final LwComponent component) {
final Element constraintsElement = LwXmlReader.getRequiredChild(element, "constraints");
final Element splitterChild = LwXmlReader.getRequiredChild(constraintsElement, "splitpane");
final String position = LwXmlReader.getRequiredString(splitterChild, "position");
if ("left".equals(position)) {
component.setCustomLayoutConstraints(POSITION_LEFT);
} else if ("right".equals(position)) {
component.setCustomLayoutConstraints(POSITION_RIGHT);
} else {
throw new UnexpectedFormElementException("unexpected position: " + position);
}
}
use of com.intellij.uiDesigner.compiler.UnexpectedFormElementException in project intellij-community by JetBrains.
the class LwContainer method readLayout.
/**
* 'xy' or 'grid'
*/
protected final void readLayout(final Element element) {
myLayoutManager = element.getAttributeValue("layout-manager");
if ("xy".equals(element.getName())) {
myLayoutSerializer = XYLayoutSerializer.INSTANCE;
} else if ("grid".equals(element.getName())) {
createLayoutSerializer();
} else {
throw new UnexpectedFormElementException("unexpected element: " + element);
}
myLayoutSerializer.readLayout(element, this);
}
Aggregations