Search in sources :

Example 91 with ToolWindow

use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.

the class MavenConsoleImpl method ensureAttachedToToolWindow.

private void ensureAttachedToToolWindow() {
    if (!isOpen.compareAndSet(false, true))
        return;
    MavenUtil.invokeLater(myProject, () -> {
        MessageView messageView = MessageView.SERVICE.getInstance(myProject);
        Content content = ContentFactory.SERVICE.getInstance().createContent(myConsoleView.getComponent(), myTitle, true);
        content.putUserData(CONSOLE_KEY, this);
        messageView.getContentManager().addContent(content);
        messageView.getContentManager().setSelectedContent(content);
        // remove unused tabs
        for (Content each : messageView.getContentManager().getContents()) {
            if (each.isPinned())
                continue;
            if (each == content)
                continue;
            MavenConsoleImpl console = each.getUserData(CONSOLE_KEY);
            if (console == null)
                continue;
            if (!myTitle.equals(console.myTitle))
                continue;
            if (console.isFinished()) {
                messageView.getContentManager().removeContent(each, true);
            }
        }
        ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
        if (!toolWindow.isActive()) {
            toolWindow.activate(null, false);
        }
    });
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) MessageView(com.intellij.ui.content.MessageView) Content(com.intellij.ui.content.Content)

Example 92 with ToolWindow

use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.

the class DynamicManagerImpl method addProperty.

@Override
public void addProperty(DynamicElementSettings settings) {
    assert settings != null;
    assert !settings.isMethod();
    final DPropertyElement propertyElement = (DPropertyElement) createDynamicElement(settings);
    final DClassElement classElement = getOrCreateClassElement(myProject, settings.getContainingClassName());
    //important to fetch myToolWindow before adding
    ToolWindow window = DynamicToolWindowWrapper.getInstance(myProject).getToolWindow();
    classElement.addProperty(propertyElement);
    addItemInTree(classElement, propertyElement, window);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow)

Example 93 with ToolWindow

use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.

the class DynamicManagerImpl method addMethod.

@Override
public void addMethod(DynamicElementSettings settings) {
    if (settings == null)
        return;
    assert settings.isMethod();
    final DMethodElement methodElement = (DMethodElement) createDynamicElement(settings);
    final DClassElement classElement = getOrCreateClassElement(myProject, settings.getContainingClassName());
    //important to fetch myToolWindow before adding
    ToolWindow window = DynamicToolWindowWrapper.getInstance(myProject).getToolWindow();
    classElement.addMethod(methodElement);
    addItemInTree(classElement, methodElement, window);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow)

Example 94 with ToolWindow

use of com.intellij.openapi.wm.ToolWindow 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);
        }
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) StudyToolWindow(com.jetbrains.edu.learning.ui.StudyToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 95 with ToolWindow

use of com.intellij.openapi.wm.ToolWindow in project intellij-community by JetBrains.

the class StudyProjectComponent method projectClosed.

@Override
public void projectClosed() {
    final Course course = StudyTaskManager.getInstance(myProject).getCourse();
    if (course != null) {
        final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
        if (toolWindow != null) {
            toolWindow.getContentManager().removeAllContents(false);
        }
        KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
        for (Keymap keymap : keymapManager.getAllKeymaps()) {
            List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
            if (pairs != null && !pairs.isEmpty()) {
                for (Pair<String, String> actionShortcut : pairs) {
                    keymap.addShortcut(actionShortcut.first, new KeyboardShortcut(KeyStroke.getKeyStroke(actionShortcut.second), null));
                }
            }
        }
    }
    myListener = null;
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) StudyToolWindow(com.jetbrains.edu.learning.ui.StudyToolWindow) KeymapManagerEx(com.intellij.openapi.keymap.ex.KeymapManagerEx) StudyProjectGenerator.flushCourse(com.jetbrains.edu.learning.courseGeneration.StudyProjectGenerator.flushCourse) Keymap(com.intellij.openapi.keymap.Keymap) Pair(com.intellij.openapi.util.Pair)

Aggregations

ToolWindow (com.intellij.openapi.wm.ToolWindow)124 Content (com.intellij.ui.content.Content)37 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)34 Project (com.intellij.openapi.project.Project)21 ContentManager (com.intellij.ui.content.ContentManager)14 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)13 Nullable (org.jetbrains.annotations.Nullable)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)8 ConsoleView (com.intellij.execution.ui.ConsoleView)5 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)5 NotNull (org.jetbrains.annotations.NotNull)5 RunContentManager (com.intellij.execution.ui.RunContentManager)4 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)3 ProcessEvent (com.intellij.execution.process.ProcessEvent)3 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)3 ProjectView (com.intellij.ide.projectView.ProjectView)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 DumbAwareRunnable (com.intellij.openapi.project.DumbAwareRunnable)3 ChangesViewContentManager (com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager)3 ToolWindowEP (com.intellij.openapi.wm.ToolWindowEP)3