Search in sources :

Example 1 with ToolWindow

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

the class PythonConsoleToolWindow method doInit.

private void doInit(@NotNull final ToolWindow toolWindow) {
    myInitialized = true;
    toolWindow.setToHideOnEmptyContent(true);
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {

        @Override
        public void toolWindowRegistered(@NotNull String id) {
        }

        @Override
        public void stateChanged() {
            ToolWindow window = getToolWindow(myProject);
            if (window != null) {
                boolean visible = window.isVisible();
                if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                    PydevConsoleRunner runner = PythonConsoleRunnerFactory.getInstance().createConsoleRunner(myProject, null);
                    runner.run();
                }
            }
        }
    });
}
Also used : ToolWindowManagerListener(com.intellij.openapi.wm.ex.ToolWindowManagerListener) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManagerEx(com.intellij.openapi.wm.ex.ToolWindowManagerEx)

Example 2 with ToolWindow

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

the class SvnMergeSourceDetails method showMe.

public static void showMe(final Project project, final SvnFileRevision revision, final VirtualFile file) {
    if (ModalityState.NON_MODAL.equals(ModalityState.current())) {
        ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.VCS);
        final ContentManager contentManager = toolWindow.getContentManager();
        final MyDialog dialog = new MyDialog(project, revision, file);
        // TODO: Temporary memory leak fix - rewrite this part not to create dialog if only createCenterPanel(), but not show() is invoked
        Disposer.register(project, dialog.getDisposable());
        Content content = ContentFactory.SERVICE.getInstance().createContent(dialog.createCenterPanel(), SvnBundle.message("merge.source.details.title", (file == null) ? revision.getURL() : file.getName(), revision.getRevisionNumber().asString()), true);
        ContentsUtil.addOrReplaceContent(contentManager, content, true);
        toolWindow.activate(null);
    } else {
        new MyDialog(project, revision, file).show();
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ContentManager(com.intellij.ui.content.ContentManager)

Example 3 with ToolWindow

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

the class StudyNavigator method navigateToTask.

public static void navigateToTask(@NotNull Project project, @NotNull Task task) {
    for (VirtualFile file : FileEditorManager.getInstance(project).getOpenFiles()) {
        FileEditorManager.getInstance(project).closeFile(file);
    }
    Map<String, TaskFile> taskFiles = task.getTaskFiles();
    VirtualFile taskDir = task.getTaskDir(project);
    if (taskDir == null) {
        return;
    }
    VirtualFile srcDir = taskDir.findChild(EduNames.SRC);
    if (srcDir != null) {
        taskDir = srcDir;
    }
    if (taskFiles.isEmpty()) {
        ProjectView.getInstance(project).select(taskDir, taskDir, false);
        return;
    }
    VirtualFile fileToActivate = getFirstTaskFile(taskDir, project);
    for (Map.Entry<String, TaskFile> entry : taskFiles.entrySet()) {
        final TaskFile taskFile = entry.getValue();
        if (taskFile.getActivePlaceholders().isEmpty()) {
            continue;
        }
        VirtualFile virtualFile = taskDir.findFileByRelativePath(entry.getKey());
        if (virtualFile == null) {
            continue;
        }
        FileEditorManager.getInstance(project).openFile(virtualFile, true);
        fileToActivate = virtualFile;
    }
    EduUsagesCollector.taskNavigation();
    if (fileToActivate != null) {
        updateProjectView(project, fileToActivate);
    }
    StudyUtils.selectFirstAnswerPlaceholder(StudyUtils.getSelectedStudyEditor(project), project);
    ToolWindow runToolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.RUN);
    if (runToolWindow != null) {
        runToolWindow.hide(null);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ToolWindow(com.intellij.openapi.wm.ToolWindow) Map(java.util.Map)

Example 4 with ToolWindow

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

the class WorkingCopiesContent method show.

public static void show(@NotNull Project project) {
    final ToolWindowManager manager = ToolWindowManager.getInstance(project);
    if (manager != null) {
        final ToolWindow window = manager.getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
        if (window != null) {
            window.show(null);
            final ContentManager cm = window.getContentManager();
            final Content content = cm.findContent(TAB_NAME);
            if (content != null) {
                cm.setSelectedContent(content, true);
            }
        }
    }
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ChangesViewContentManager(com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager) ContentManager(com.intellij.ui.content.ContentManager)

Example 5 with ToolWindow

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

the class BrowseRepositoryAction method actionPerformed.

public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (project == null) {
        RepositoryBrowserDialog dialog = new RepositoryBrowserDialog(ProjectManager.getInstance().getDefaultProject());
        dialog.show();
    } else {
        ToolWindowManager manager = ToolWindowManager.getInstance(project);
        ToolWindow w = manager.getToolWindow(REPOSITORY_BROWSER_TOOLWINDOW);
        if (w == null) {
            RepositoryToolWindowPanel component = new RepositoryToolWindowPanel(project);
            w = manager.registerToolWindow(REPOSITORY_BROWSER_TOOLWINDOW, true, ToolWindowAnchor.BOTTOM, project, true);
            final Content content = ContentFactory.SERVICE.getInstance().createContent(component, "", false);
            Disposer.register(content, component);
            w.getContentManager().addContent(content);
        }
        w.show(null);
        w.activate(null);
    }
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) Content(com.intellij.ui.content.Content) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) RepositoryBrowserDialog(org.jetbrains.idea.svn.dialogs.RepositoryBrowserDialog)

Aggregations

ToolWindow (com.intellij.openapi.wm.ToolWindow)165 Content (com.intellij.ui.content.Content)51 Project (com.intellij.openapi.project.Project)47 ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)40 CheckStylePlugin (org.infernus.idea.checkstyle.CheckStylePlugin)18 ContentManager (com.intellij.ui.content.ContentManager)16 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)15 VirtualFile (com.intellij.openapi.vfs.VirtualFile)12 Nullable (org.jetbrains.annotations.Nullable)12 CheckStyleToolWindowPanel (org.infernus.idea.checkstyle.toolwindow.CheckStyleToolWindowPanel)10 ConsoleView (com.intellij.execution.ui.ConsoleView)5 ToolWindowManagerAdapter (com.intellij.openapi.wm.ex.ToolWindowManagerAdapter)5 NotNull (org.jetbrains.annotations.NotNull)5 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)4 Presentation (com.intellij.openapi.actionSystem.Presentation)4 ContentFactory (com.intellij.ui.content.ContentFactory)4 MessageView (com.intellij.ui.content.MessageView)4 ProcessAdapter (com.intellij.execution.process.ProcessAdapter)3 ProcessEvent (com.intellij.execution.process.ProcessEvent)3 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)3