use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class ProjectViewSelectInTarget method select.
@NotNull
public static ActionCallback select(@NotNull Project project, final Object toSelect, @Nullable final String viewId, @Nullable final String subviewId, final VirtualFile virtualFile, final boolean requestFocus) {
final ActionCallback result = new ActionCallback();
final ProjectView projectView = ProjectView.getInstance(project);
if (ApplicationManager.getApplication().isUnitTestMode()) {
AbstractProjectViewPane pane = projectView.getProjectViewPaneById(ProjectViewPane.ID);
pane.select(toSelect, virtualFile, requestFocus);
return result;
}
ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
final ToolWindow projectViewToolWindow = windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW);
final Runnable runnable = () -> {
Runnable r = () -> projectView.selectCB(toSelect, virtualFile, requestFocus).notify(result);
projectView.changeViewCB(ObjectUtils.chooseNotNull(viewId, ProjectViewPane.ID), subviewId).doWhenProcessed(r);
};
if (requestFocus) {
projectViewToolWindow.activate(runnable, true);
} else {
projectViewToolWindow.show(runnable);
}
return result;
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class VcsLogContentProvider method openAnotherLogTab.
public static void openAnotherLogTab(@NotNull VcsLogManager logManager, @NotNull Project project) {
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
String name = generateShortName(toolWindow);
openLogTab(project, logManager, TAB_NAME, name, logManager.getMainLogUiFactory(name));
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class VcsLogContentProvider method openLogTab.
public static <U extends AbstractVcsLogUi> void openLogTab(@NotNull Project project, @NotNull VcsLogManager logManager, @NotNull String tabGroupName, @NotNull String shortName, @NotNull VcsLogManager.VcsLogUiFactory<U> factory) {
ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
String name = ContentUtilEx.getFullName(tabGroupName, shortName);
U logUi = logManager.createLogUi(name, factory);
ContentUtilEx.addTabbedContent(toolWindow.getContentManager(), new VcsLogPanel(logManager, logUi), tabGroupName, shortName, true, logUi);
toolWindow.activate(null);
logManager.scheduleInitialization();
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class VcsLogContentProvider method closeLogTabs.
private void closeLogTabs() {
ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS);
if (toolWindow != null) {
VcsLogManager logManager = myProjectLog.getLogManager();
if (logManager != null) {
for (String tabName : logManager.getTabNames()) {
if (tabName != TAB_NAME) {
// main tab is closed by the ChangesViewContentManager
Content content = toolWindow.getContentManager().findContent(tabName);
ContentsUtil.closeContentTab(toolWindow.getContentManager(), content);
}
}
}
}
}
use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.
the class MvcModuleStructureSynchronizer method updateProjectViewVisibility.
private void updateProjectViewVisibility() {
if (ApplicationManager.getApplication().isUnitTestMode())
return;
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
@Override
public void run() {
ApplicationManager.getApplication().invokeLater(() -> {
if (myProject.isDisposed())
return;
for (ToolWindowEP ep : ToolWindowEP.EP_NAME.getExtensions()) {
if (MvcToolWindowDescriptor.class.isAssignableFrom(ep.getFactoryClass())) {
MvcToolWindowDescriptor descriptor = (MvcToolWindowDescriptor) ep.getToolWindowFactory();
String id = descriptor.getToolWindowId();
boolean shouldShow = descriptor.value(myProject);
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
ToolWindow toolWindow = toolWindowManager.getToolWindow(id);
if (shouldShow && toolWindow == null) {
toolWindow = toolWindowManager.registerToolWindow(id, true, ToolWindowAnchor.LEFT, myProject, true);
toolWindow.setIcon(descriptor.getFramework().getToolWindowIcon());
descriptor.createToolWindowContent(myProject, toolWindow);
} else if (!shouldShow && toolWindow != null) {
toolWindowManager.unregisterToolWindow(id);
Disposer.dispose(toolWindow.getContentManager());
}
}
}
});
}
});
}
Aggregations