Example usage for com.intellij.openapi.wm ToolWindow show

List of usage examples for com.intellij.openapi.wm ToolWindow show

Introduction

In this page you can find the example usage for com.intellij.openapi.wm ToolWindow show.

Prototype

void show(@Nullable Runnable runnable);

Source Link

Usage

From source file:com.android.tools.idea.assistant.AssistToolWindowFactory.java

License:Apache License

@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    if (myAssistSidePanel == null) {
        myAssistSidePanel = new AssistSidePanel(myActionId, project);
    }/*from   w  ww. ja v  a2  s .  c  o  m*/

    ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
    Content content = contentFactory.createContent(myAssistSidePanel, null, false);
    ContentManager contentManager = toolWindow.getContentManager();
    contentManager.removeAllContents(true);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content);
    toolWindow.show(null);
}

From source file:com.android.tools.idea.memory.MemoryMonitorAction.java

License:Apache License

@Override
public void actionPerformed(AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
        ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
        ToolWindow toolWindow = toolWindowManager.getToolWindow(MemoryMonitorToolWindowFactory.ID);
        if (toolWindow != null) {
            toolWindow.show(null);
        }/*from  www  .jav a  2 s.co m*/
    }
}

From source file:com.android.tools.idea.startup.AndroidStudioInitializer.java

License:Apache License

private static void setUpExperimentalFeatures() {
    if (System.getProperty(ProfilerState.ENABLE_EXPERIMENTAL_PROFILING) != null) {
        ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerAdapter() {
            @Override/*from  w  w w.  j  av a2  s  . c  o m*/
            public void projectOpened(final Project project) {
                StartupManager.getInstance(project).runWhenProjectIsInitialized(() -> {
                    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
                    ToolWindow toolWindow = toolWindowManager.registerToolWindow(
                            AndroidMonitorToolWindowFactory.ID, false, ToolWindowAnchor.BOTTOM, project, true);
                    toolWindow.setIcon(AndroidIcons.AndroidToolWindow);
                    new AndroidMonitorToolWindowFactory().createToolWindowContent(project, toolWindow);
                    toolWindow.show(null);
                });
            }
        });
    }
}

From source file:com.atlassian.theplugin.idea.PluginToolWindow.java

License:Apache License

public static void showHidePluginWindow(AnActionEvent event) {
    ToolWindow tw = IdeaHelper.getToolWindow(IdeaHelper.getCurrentProject(event.getDataContext()));
    if (tw != null) {
        if (tw.isVisible()) {
            tw.hide(new Runnable() {
                public void run() {
                }/*from w w w. j  a  v a2 s  . com*/
            });
        } else {

            tw.show(new Runnable() {
                public void run() {
                }
            });
        }

    }

}

From source file:com.boxysystems.libraryfinder.view.intellij.IntelliJLibraryFinderView.java

License:Apache License

private void showResultsPanelInToolWindow() {
    ToolWindow toolWindow = ToolWindowManager.getInstance(plugin.getProject())
            .getToolWindow(Constants.PLUGIN_ID);
    toolWindow.setAvailable(true, null);
    if (toolWindow.isActive()) {
        toolWindow.show(resultsPanel);
    } else {/*from w  ww. jav a  2 s . c  om*/
        toolWindow.activate(resultsPanel);
    }
}

From source file:com.eightbitmage.moonscript.util.MoonSystemUtil.java

License:Apache License

private static void activateConsoleToolWindow(@NotNull Project project) {
    final ToolWindowManager manager = ToolWindowManager.getInstance(project);

    ToolWindow toolWindow = manager.getToolWindow(toolWindowId);
    if (toolWindow != null) {
        return;/*from   www  . ja  v  a  2 s .co m*/
    }

    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()) {
                manager.unregisterToolWindow(toolWindowId);
                ((ToolWindowManagerEx) manager).removeToolWindowManagerListener(this);
            }
        }
    };

    toolWindow.show(new Runnable() {
        @Override
        public void run() {
            ((ToolWindowManagerEx) manager).addToolWindowManagerListener(listener);
        }
    });
}

From source file:com.google.idea.blaze.clwb.problemsview.BlazeProblemsViewConsole.java

License:Open Source License

private void updateIcon() {
    UIUtil.invokeLaterIfNeeded(() -> {
        if (!myProject.isDisposed()) {
            final ToolWindow tw = ToolWindowManager.getInstance(myProject)
                    .getToolWindow(BLAZE_PROBLEMS_TOOLWINDOW_ID);
            if (tw != null) {
                final boolean active = myPanel.getErrorViewStructure().hasMessages(ALL_MESSAGE_KINDS);
                tw.setIcon(active ? myActiveIcon : myPassiveIcon);
                if (active) {
                    tw.show(null);
                }/* ww w .j  a  v a2s .c o m*/
            }
        }
    });
}

From source file:com.hp.alm.ali.idea.content.AliContentFactory.java

License:Apache License

public static void loadDetail(Project project, Entity entity, boolean show, boolean select) {
    ApplicationManager.getApplication().assertIsDispatchThread();

    ToolWindow toolWindow = getOrCreateDetailToolWindow(project);
    Content content = addEntity(project, toolWindow, entity, -1);
    if (show) {/*from   w  w  w.  j a  v  a  2s  . co m*/
        toolWindow.show(null);
    }
    if (select) {
        AliProjectConfiguration conf = project.getComponent(AliProjectConfiguration.class);
        conf.getDetails().setSelectedRef(new EntityRef(entity));
        toolWindow.getContentManager().setSelectedContent(content);
    }
}

From source file:com.intellij.execution.ExecutionHelper.java

License:Apache License

private static void descriptorToFront(final Project project, final RunContentDescriptor descriptor) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override//w  ww.j  av a  2  s . co  m
        public void run() {
            final ToolWindow toolWindow = ExecutionManager.getInstance(project).getContentManager()
                    .getToolWindowByDescriptor(descriptor);

            if (toolWindow != null) {
                toolWindow.show(null);

                final ContentManager contentManager = toolWindow.getContentManager();

                contentManager.setSelectedContent(descriptor.getAttachedContent());
            }
        }
    });
}

From source file:com.intellij.ide.favoritesTreeView.FavoritesViewSelectInTarget.java

License:Apache License

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();

    ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
    final ToolWindow favoritesToolWindow = windowManager.getToolWindow(ToolWindowId.FAVORITES_VIEW);

    if (favoritesToolWindow != null) {
        final FavoritesTreeViewPanel panel = UIUtil.findComponentOfType(favoritesToolWindow.getComponent(),
                FavoritesTreeViewPanel.class);

        if (panel != null) {
            final Runnable runnable = new Runnable() {
                @Override//from  w ww  . j  ava2s  . c o m
                public void run() {
                    panel.selectElement(toSelect, virtualFile, requestFocus);
                    result.setDone();
                }
            };

            if (requestFocus) {
                favoritesToolWindow.activate(runnable, false);
            } else {
                favoritesToolWindow.show(runnable);
            }
        }
    }

    return result;
}