use of com.intellij.ide.TwoPaneIdeView in project intellij-community by JetBrains.
the class CopyHandler method updateSelectionInActiveProjectView.
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;
}
}
}
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);
}
}
Aggregations