Search in sources :

Example 1 with DomElementNavigationProvider

use of com.intellij.util.xml.DomElementNavigationProvider in project intellij-community by JetBrains.

the class GotoDomElementDeclarationAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
    final SimpleNode simpleNode = treeView.getTree().getSelectedNode();
    if (simpleNode instanceof BaseDomElementNode) {
        final DomElement domElement = ((BaseDomElementNode) simpleNode).getDomElement();
        final DomElementNavigationProvider provider = DomElementsNavigationManager.getManager(domElement.getManager().getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME);
        provider.navigate(domElement, true);
    }
}
Also used : BaseDomElementNode(com.intellij.util.xml.tree.BaseDomElementNode) DomElement(com.intellij.util.xml.DomElement) DomElementNavigationProvider(com.intellij.util.xml.DomElementNavigationProvider) SimpleNode(com.intellij.ui.treeStructure.SimpleNode)

Example 2 with DomElementNavigationProvider

use of com.intellij.util.xml.DomElementNavigationProvider in project intellij-community by JetBrains.

the class GenerateDomElementProvider method navigate.

public void navigate(final DomElement element) {
    if (element != null && element.isValid()) {
        final DomElement copy = element.createStableCopy();
        final Project project = element.getManager().getProject();
        final DomElementNavigationProvider navigateProvider = getNavigationProviderName(project);
        if (navigateProvider != null && navigateProvider.canNavigate(copy)) {
            ApplicationManager.getApplication().invokeLater(() -> {
                if (!project.isDisposed()) {
                    doNavigate(navigateProvider, copy);
                }
            });
        }
    }
}
Also used : Project(com.intellij.openapi.project.Project) DomElement(com.intellij.util.xml.DomElement) DomElementNavigationProvider(com.intellij.util.xml.DomElementNavigationProvider)

Aggregations

DomElement (com.intellij.util.xml.DomElement)2 DomElementNavigationProvider (com.intellij.util.xml.DomElementNavigationProvider)2 Project (com.intellij.openapi.project.Project)1 SimpleNode (com.intellij.ui.treeStructure.SimpleNode)1 BaseDomElementNode (com.intellij.util.xml.tree.BaseDomElementNode)1