Search in sources :

Example 1 with JDOMParseException

use of org.jdom.input.JDOMParseException 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);
    }
}
Also used : JDOMParseException(org.jdom.input.JDOMParseException) WordOccurrence(com.intellij.lang.cacheBuilder.WordOccurrence) IComponent(com.intellij.uiDesigner.lw.IComponent) AlienFormFileException(com.intellij.uiDesigner.compiler.AlienFormFileException) LwRootContainer(com.intellij.uiDesigner.lw.LwRootContainer) FormEditingUtil(com.intellij.uiDesigner.FormEditingUtil) UnexpectedFormElementException(com.intellij.uiDesigner.compiler.UnexpectedFormElementException) AlienFormFileException(com.intellij.uiDesigner.compiler.AlienFormFileException) JDOMParseException(org.jdom.input.JDOMParseException) UnexpectedFormElementException(com.intellij.uiDesigner.compiler.UnexpectedFormElementException)

Aggregations

WordOccurrence (com.intellij.lang.cacheBuilder.WordOccurrence)1 FormEditingUtil (com.intellij.uiDesigner.FormEditingUtil)1 AlienFormFileException (com.intellij.uiDesigner.compiler.AlienFormFileException)1 UnexpectedFormElementException (com.intellij.uiDesigner.compiler.UnexpectedFormElementException)1 IComponent (com.intellij.uiDesigner.lw.IComponent)1 LwRootContainer (com.intellij.uiDesigner.lw.LwRootContainer)1 JDOMParseException (org.jdom.input.JDOMParseException)1