use of com.intellij.openapi.wm.ToolWindowManager 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());
}
}
}
});
}
});
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-community by JetBrains.
the class StudyUtils method registerStudyToolWindow.
public static void registerStudyToolWindow(@Nullable final Course course, Project project) {
if (course != null && "PyCharm".equals(course.getCourseType())) {
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
registerToolWindows(toolWindowManager, project);
final ToolWindow studyToolWindow = toolWindowManager.getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
if (studyToolWindow != null) {
studyToolWindow.show(null);
initToolWindows(project);
}
}
}
use of com.intellij.openapi.wm.ToolWindowManager in project android by JetBrains.
the class AndroidUtils method activateConsoleToolWindow.
public static void activateConsoleToolWindow(@NotNull Project project, @NotNull final Runnable runAfterActivation) {
final ToolWindowManager manager = ToolWindowManager.getInstance(project);
final String toolWindowId = AndroidBundle.message("android.console.tool.window.title");
ToolWindow toolWindow = manager.getToolWindow(toolWindowId);
if (toolWindow != null) {
runAfterActivation.run();
return;
}
toolWindow = manager.registerToolWindow(toolWindowId, true, ToolWindowAnchor.BOTTOM);
final ConsoleView console = new ConsoleViewImpl(project, false);
project.putUserData(CONSOLE_VIEW_KEY, console);
toolWindow.getContentManager().addContent(new ContentImpl(console.getComponent(), "", false));
final ToolWindowManagerListener listener = new ToolWindowManagerListener() {
@Override
public void toolWindowRegistered(@NotNull String id) {
}
@Override
public void stateChanged() {
ToolWindow window = manager.getToolWindow(toolWindowId);
if (window != null && !window.isVisible()) {
((ToolWindowManagerEx) manager).removeToolWindowManagerListener(this);
getApplication().invokeLater(() -> manager.unregisterToolWindow(toolWindowId));
}
}
};
toolWindow.show(() -> {
runAfterActivation.run();
((ToolWindowManagerEx) manager).addToolWindowManagerListener(listener);
});
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-plugins by StepicOrg.
the class StudyUtils method getStudyToolWindow.
@Nullable
static StudyToolWindow getStudyToolWindow(@NotNull final Project project) {
if (project.isDisposed()) {
return null;
}
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
if (toolWindowManager == null) {
return null;
}
ToolWindow toolWindow = toolWindowManager.getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
if (toolWindow != null) {
Content[] contents = toolWindow.getContentManager().getContents();
for (Content content : contents) {
JComponent component = content.getComponent();
if (component != null && component instanceof StudyToolWindow) {
return (StudyToolWindow) component;
}
}
}
return null;
}
use of com.intellij.openapi.wm.ToolWindowManager in project intellij-plugins by StepicOrg.
the class StudyProjectComponent method registerStudyToolWindow.
public void registerStudyToolWindow() {
if (!StepikProjectManager.isStepikProject(project)) {
return;
}
final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
registerToolWindows(toolWindowManager);
final ToolWindow studyToolWindow = toolWindowManager.getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
if (studyToolWindow != null) {
studyToolWindow.show(null);
StudyUtils.initToolWindows(project);
}
}
Aggregations