Search in sources :

Example 31 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project intellij-plugins by JetBrains.

the class ActionScriptProfileRunner method startProfiling.

private static void startProfiling(final String runConfigurationName, final Module module) {
    if (!initProfilingAgent(module)) {
        return;
    }
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(module.getProject());
    if (toolWindowManager == null) {
        return;
    }
    ApplicationManager.getApplication().invokeLater(new Runnable() {

        @Override
        public void run() {
            ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOLWINDOW_ID);
            if (toolWindow == null) {
                toolWindow = toolWindowManager.registerToolWindow(TOOLWINDOW_ID, true, ToolWindowAnchor.BOTTOM, module.getProject());
                final ContentManager contentManager = toolWindow.getContentManager();
                contentManager.addContentManagerListener(new ContentManagerAdapter() {

                    @Override
                    public void contentRemoved(ContentManagerEvent event) {
                        super.contentRemoved(event);
                        if (contentManager.getContentCount() == 0) {
                            toolWindowManager.unregisterToolWindow(TOOLWINDOW_ID);
                        }
                    }
                });
            }
            final ActionScriptProfileControlPanel profileControlPanel = new ActionScriptProfileControlPanel(runConfigurationName, module);
            final SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
            toolWindowPanel.setContent(profileControlPanel.getMainPanel());
            final Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, runConfigurationName, false);
            toolWindow.getContentManager().addContent(content);
            toolWindow.getContentManager().setSelectedContent(content);
            content.setDisposer(profileControlPanel);
            final DefaultActionGroup actionGroup = profileControlPanel.createProfilerActionGroup();
            actionGroup.addSeparator();
            final AnAction closeTabAction = new TabbedContentAction.CloseAction(content);
            closeTabAction.getTemplatePresentation().setIcon(AllIcons.Actions.Cancel);
            actionGroup.add(closeTabAction);
            ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("FlexProfiler", actionGroup, false);
            toolbar.setTargetComponent(toolWindowPanel);
            toolWindowPanel.setToolbar(toolbar.getComponent());
            final ToolWindow finalToolWindow = toolWindow;
            profileControlPanel.setConnectionCallback(() -> {
                finalToolWindow.show(null);
                removePreloadingOfProfilerSwf();
            });
            toolWindow.hide(null);
            profileControlPanel.startProfiling();
        }
    });
}
Also used : TabbedContentAction(com.intellij.ui.content.tabs.TabbedContentAction) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel) ToolWindow(com.intellij.openapi.wm.ToolWindow) ActionScriptProfileControlPanel(com.jetbrains.actionscript.profiler.ui.ActionScriptProfileControlPanel)

Example 32 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project intellij-plugins by JetBrains.

the class FlashPlayerTrustUtil method showWarningBalloonIfNeeded.

private static void showWarningBalloonIfNeeded(final Project project, final boolean isDebug, final boolean runTrusted, final String message) {
    if (runTrusted) {
        final ToolWindowManager manager = ToolWindowManager.getInstance(project);
        manager.notifyByBalloon(isDebug ? ToolWindowId.DEBUG : ToolWindowId.RUN, MessageType.WARNING, message);
    }
}
Also used : ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 33 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project android by JetBrains.

the class OpenAssistSidePanelAction method actionPerformed.

@Override
public final void actionPerformed(AnActionEvent event) {
    final Project thisProject = event.getProject();
    final String actionId = ActionManager.getInstance().getId(this);
    ApplicationManager.getApplication().invokeLater(() -> {
        AssistToolWindowFactory factory = new AssistToolWindowFactory(actionId);
        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(thisProject);
        ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_TITLE);
        if (toolWindow == null) {
            // NOTE: canWorkInDumbMode must be true or the window will close on gradle sync.
            toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_TITLE, false, ToolWindowAnchor.RIGHT, thisProject, true);
        }
        toolWindow.setIcon(AndroidIcons.Assistant.Assist);
        factory.createToolWindowContent(thisProject, toolWindow);
        // Always active the window, in case it was previously minimized.
        toolWindow.activate(null);
    });
    onActionPerformed(event);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 34 with ToolWindowManager

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

the class ThumbnailViewImpl method dispose.

public void dispose() {
    // Dispose UI
    Disposer.dispose(getUI());
    // Unregister ToolWindow
    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    windowManager.unregisterToolWindow(TOOLWINDOW_ID);
}
Also used : ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager)

Example 35 with ToolWindowManager

use of com.intellij.openapi.wm.ToolWindowManager in project freeline by alibaba.

the class FreelineUtil method processConsole.

/* process attach to console,show the log */
// TODO: 2016/9/14 0014 need refactor console method
private static void processConsole(Project project, ProcessHandler processHandler) {
    ConsoleView consoleView = FreeUIManager.getInstance(project).getConsoleView(project);
    consoleView.clear();
    consoleView.attachToProcess(processHandler);
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow;
    toolWindow = toolWindowManager.getToolWindow(TOOL_ID);
    // if already exist tool window then show it
    if (toolWindow != null) {
        toolWindow.show(null);
        return;
    }
    toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM);
    toolWindow.setTitle("free....");
    toolWindow.setStripeTitle("Free Console");
    toolWindow.setShowStripeButton(true);
    toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW);
    toolWindow.getContentManager().addContent(new ContentImpl(consoleView.getComponent(), "Build", true));
    toolWindow.show(null);
}
Also used : ToolWindow(com.intellij.openapi.wm.ToolWindow) ConsoleView(com.intellij.execution.ui.ConsoleView) ToolWindowManager(com.intellij.openapi.wm.ToolWindowManager) ContentImpl(com.intellij.ui.content.impl.ContentImpl)

Aggregations

ToolWindowManager (com.intellij.openapi.wm.ToolWindowManager)60 ToolWindow (com.intellij.openapi.wm.ToolWindow)34 Project (com.intellij.openapi.project.Project)27 Presentation (com.intellij.openapi.actionSystem.Presentation)8 Content (com.intellij.ui.content.Content)7 ToolWindowManagerEx (com.intellij.openapi.wm.ex.ToolWindowManagerEx)5 Nullable (org.jetbrains.annotations.Nullable)5 Module (com.intellij.openapi.module.Module)3 ContentManager (com.intellij.ui.content.ContentManager)3 ContentImpl (com.intellij.ui.content.impl.ContentImpl)3 NotNull (org.jetbrains.annotations.NotNull)3 ConsoleView (com.intellij.execution.ui.ConsoleView)2 ProjectView (com.intellij.ide.projectView.ProjectView)2 FileEditorManagerEx (com.intellij.openapi.fileEditor.ex.FileEditorManagerEx)2 ModuleUtilCore (com.intellij.openapi.module.ModuleUtilCore)2 ActionCallback (com.intellij.openapi.util.ActionCallback)2 ToolWindowId (com.intellij.openapi.wm.ToolWindowId)2 ToolWindowImpl (com.intellij.openapi.wm.impl.ToolWindowImpl)2 StudyToolWindow (org.stepik.core.ui.StudyToolWindow)2 AbstractProjectStructureAction.getSelectedAndroidModule (com.android.tools.idea.gradle.actions.AbstractProjectStructureAction.getSelectedAndroidModule)1