Example usage for com.intellij.openapi.wm ToolWindowId STRUCTURE_VIEW

List of usage examples for com.intellij.openapi.wm ToolWindowId STRUCTURE_VIEW

Introduction

In this page you can find the example usage for com.intellij.openapi.wm ToolWindowId STRUCTURE_VIEW.

Prototype

String STRUCTURE_VIEW

To view the source code for com.intellij.openapi.wm ToolWindowId STRUCTURE_VIEW.

Click Source Link

Usage

From source file:com.intellij.ide.impl.StructureViewSelectInTarget.java

License:Apache License

@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
    final FileEditor fileEditor = context.getFileEditorProvider().openFileEditor();

    ToolWindowManager windowManager = ToolWindowManager.getInstance(context.getProject());
    final Runnable runnable = new Runnable() {
        @Override/*from w ww .j av  a  2s.  co  m*/
        public void run() {
            StructureViewFactoryEx.getInstanceEx(myProject).runWhenInitialized(new Runnable() {
                @Override
                public void run() {
                    final StructureViewWrapper structureView = getStructureViewWrapper();
                    structureView.selectCurrentElement(fileEditor, context.getVirtualFile(), requestFocus);
                }
            });
        }
    };
    if (requestFocus) {
        windowManager.getToolWindow(ToolWindowId.STRUCTURE_VIEW).activate(runnable);
    } else {
        runnable.run();
    }

}

From source file:com.intellij.ide.impl.StructureViewSelectInTarget.java

License:Apache License

@Override
public String getToolWindowId() {
    return ToolWindowId.STRUCTURE_VIEW;
}

From source file:com.intellij.ide.impl.StructureViewWrapperImpl.java

License:Apache License

protected boolean isStructureViewShowing() {
    ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject);
    ToolWindow toolWindow = windowManager.getToolWindow(ToolWindowId.STRUCTURE_VIEW);
    // it means that window is registered
    return toolWindow != null && toolWindow.isVisible();
}

From source file:com.intellij.refactoring.copy.CopyHandler.java

License:Apache License

public static void updateSelectionInActiveProjectView(PsiElement newElement, Project project,
        boolean selectInActivePanel) {
    String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
    if (id != null) {
        ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(id);
        Content selectedContent = window.getContentManager().getSelectedContent();
        if (selectedContent != null) {
            JComponent component = selectedContent.getComponent();
            if (component instanceof TwoPaneIdeView) {
                ((TwoPaneIdeView) component).selectElement(newElement, selectInActivePanel);
                return;
            }//from   ww w .  j a  v  a  2 s . c  o m
        }
    }
    if (ToolWindowId.PROJECT_VIEW.equals(id)) {
        ProjectView.getInstance(project).selectPsiElement(newElement, true);
    } else if (ToolWindowId.STRUCTURE_VIEW.equals(id)) {
        VirtualFile virtualFile = newElement.getContainingFile().getVirtualFile();
        FileEditor editor = FileEditorManager.getInstance(newElement.getProject())
                .getSelectedEditor(virtualFile);
        StructureViewFactoryEx.getInstanceEx(project).getStructureViewWrapper().selectCurrentElement(editor,
                virtualFile, true);
    }
}