use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class InternalCompilerRefServiceView method createViewTab.
private static InternalCompilerRefServiceView createViewTab(PsiElement element) {
Project project = element.getProject();
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
if (toolWindow == null) {
toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID, true, ToolWindowAnchor.TOP);
}
final InternalCompilerRefServiceView view = new InternalCompilerRefServiceView(project);
ToolWindow finalToolWindow = toolWindow;
toolWindow.activate(() -> {
final String text = SymbolPresentationUtil.getSymbolPresentableText(element);
final ContentImpl content = new ContentImpl(view, text, true);
finalToolWindow.getContentManager().addContent(content);
finalToolWindow.getContentManager().setSelectedContent(content, true);
});
return view;
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class ExternalSystemUtil method ensureToolWindowInitialized.
public static void ensureToolWindowInitialized(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
try {
ToolWindowManager manager = ToolWindowManager.getInstance(project);
if (!(manager instanceof ToolWindowManagerEx)) {
return;
}
ToolWindowManagerEx managerEx = (ToolWindowManagerEx) manager;
String id = externalSystemId.getReadableName();
ToolWindow window = manager.getToolWindow(id);
if (window != null) {
return;
}
ToolWindowEP[] beans = Extensions.getExtensions(ToolWindowEP.EP_NAME);
for (final ToolWindowEP bean : beans) {
if (id.equals(bean.id)) {
managerEx.initToolWindow(bean);
}
}
} catch (Exception e) {
LOG.error(String.format("Unable to initialize %s tool window", externalSystemId.getReadableName()), e);
}
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class ExternalSystemUtil method ensureToolWindowContentInitialized.
@Nullable
public static ToolWindow ensureToolWindowContentInitialized(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
if (toolWindowManager == null)
return null;
final ToolWindow toolWindow = toolWindowManager.getToolWindow(externalSystemId.getReadableName());
if (toolWindow == null)
return null;
if (toolWindow instanceof ToolWindowImpl) {
((ToolWindowImpl) toolWindow).ensureContentInitialized();
}
return toolWindow;
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class ExternalToolWindowManager method getToolWindow.
@Nullable
private static ToolWindow getToolWindow(@NotNull Project project, @NotNull ProjectSystemId externalSystemId) {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
if (toolWindowManager == null) {
return null;
}
ToolWindow result = toolWindowManager.getToolWindow(externalSystemId.getReadableName());
if (result instanceof ToolWindowImpl) {
((ToolWindowImpl) result).ensureContentInitialized();
}
return result;
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class RunDashboardManagerImpl method updateDashboard.
private void updateDashboard(final boolean withStructure) {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
toolWindowManager.invokeLater(() -> {
if (myProject.isDisposed()) {
return;
}
if (withStructure) {
boolean available = hasContent();
ToolWindow toolWindow = toolWindowManager.getToolWindow(getToolWindowId());
if (toolWindow == null) {
if (available) {
createToolWindow();
}
return;
}
boolean doShow = !toolWindow.isAvailable() && available;
toolWindow.setAvailable(available, null);
if (doShow) {
toolWindow.show(null);
}
}
if (myDashboardContent != null) {
myDashboardContent.updateContent(withStructure);
}
});
}
Aggregations