com.intellij.openapi.wm.ToolWindowManager Java Examples

The following examples show how to use com.intellij.openapi.wm.ToolWindowManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FreelineUtil.java    From freeline with BSD 3-Clause "New" or "Revised" License 7 votes vote down vote up
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);
}
 
Example #2
Source File: PredefinedSearchScopeProviderImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void addHierarchyScope(@Nonnull Project project, Collection<SearchScope> result) {
  final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.HIERARCHY);
  if (toolWindow == null) {
    return;
  }
  final ContentManager contentManager = toolWindow.getContentManager();
  final Content content = contentManager.getSelectedContent();
  if (content == null) {
    return;
  }
  final String name = content.getDisplayName();
  final JComponent component = content.getComponent();
  if (!(component instanceof HierarchyBrowserBase)) {
    return;
  }
  final HierarchyBrowserBase hierarchyBrowserBase = (HierarchyBrowserBase)component;
  final PsiElement[] elements = hierarchyBrowserBase.getAvailableElements();
  if (elements.length > 0) {
    result.add(new LocalSearchScope(elements, "Hierarchy '" + name + "' (visible nodes only)"));
  }
}
 
Example #3
Source File: ToggleFloatingModeAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void setSelected(AnActionEvent event, boolean flag) {
  Project project = event.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }
  String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
  if (id == null) {
    return;
  }
  ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
  ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);
  ToolWindowType type = toolWindow.getType();
  if (ToolWindowType.FLOATING == type) {
    toolWindow.setType(toolWindow.getInternalType(), null);
  }
  else {
    toolWindow.setType(ToolWindowType.FLOATING, null);
  }
}
 
Example #4
Source File: ReactNativeConsole.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
     * Get the RN Console instance.
     *
     * @param displayName - the tab's display name must be unique.
     * @param icon        - used to set a tab icon, not used for search
     * @return
     */
    public RNConsole getRNConsole(String displayName, Icon icon) {
        ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(RNToolWindowFactory.TOOL_WINDOW_ID);
        if (window != null) {
            Content existingContent = createConsoleTabContent(window, false, displayName, icon);
            if (existingContent != null && existingContent instanceof RNContentImpl) {
//                final JComponent existingComponent = existingContent.getComponent();
//                if (existingComponent instanceof SimpleToolWindowPanel) {
//                    JComponent component = ((SimpleToolWindowPanel) existingComponent).getContent();
//                    if (component instanceof RNConsoleImpl) {
//                        RNConsoleImpl rnConsole = (RNConsoleImpl) component;
//                        return rnConsole;
//                    }
//                }
                return ((RNContentImpl)existingContent).getRnConsole();
            }
        }

        return null;
    }
 
Example #5
Source File: AbstractVcsHelperImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void openMessagesView(final VcsErrorViewPanel errorTreeView, final String tabDisplayName) {
  CommandProcessor commandProcessor = CommandProcessor.getInstance();
  commandProcessor.executeCommand(myProject, new Runnable() {
    @Override
    public void run() {
      final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
      messageView.runWhenInitialized(new Runnable() {
        @Override
        public void run() {
          final Content content =
                  ContentFactory.getInstance().createContent(errorTreeView, tabDisplayName, true);
          messageView.getContentManager().addContent(content);
          Disposer.register(content, errorTreeView);
          messageView.getContentManager().setSelectedContent(content);
          removeContents(content, tabDisplayName);

          ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW).activate(null);
        }
      });
    }
  }, VcsBundle.message("command.name.open.error.message.view"), null);
}
 
Example #6
Source File: FavoritesTreeViewPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void selectElement(final PsiElement element) {
  if (element != null) {
    selectPsiElement(element, false);
    boolean requestFocus = true;
    final boolean isDirectory = element instanceof PsiDirectory;
    if (!isDirectory) {
      Editor editor = EditorHelper.openInEditor(element);
      if (editor != null) {
        ToolWindowManager.getInstance(myProject).activateEditorComponent();
        requestFocus = false;
      }
    }
    if (requestFocus) {
      selectPsiElement(element, true);
    }
  }
}
 
Example #7
Source File: CopyElementAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void update(AnActionEvent event) {
  Presentation presentation = event.getPresentation();
  DataContext dataContext = event.getDataContext();
  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  presentation.setEnabled(false);
  if (project == null) {
    return;
  }

  Editor editor = dataContext.getData(PlatformDataKeys.EDITOR);
  if (editor != null) {
    updateForEditor(dataContext, presentation);
  }
  else {
    String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
    updateForToolWindow(id, dataContext, presentation);
  }
}
 
Example #8
Source File: FlutterView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void onAppChanged(FlutterApp app) {
  if (myProject.isDisposed()) {
    return;
  }

  final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(TOOL_WINDOW_ID);
  if (toolWindow == null) {
    return;
  }

  if (perAppViewState.isEmpty()) {
    notifyActionsAppStopped(app);
  }
  else {
    notifyActionsAppStarted(app);
  }

  final PerAppState state = getStateForApp(app);
  if (state != null) {
    for (InspectorPanel inspectorPanel : state.inspectorPanels) {
      inspectorPanel.onAppChanged();
    }
  }
}
 
Example #9
Source File: OpenFlutterViewAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
  final Project project = e.getProject();
  if (project == null) {
    return;
  }

  FlutterInitializer.sendAnalyticsAction(this);

  final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(FlutterView.TOOL_WINDOW_ID);
  if (toolWindow == null) {
    FlutterMessages.showError("Unable to open view", "Unable to open the Flutter tool window - no Flutter modules found");
  }
  else {
    toolWindow.show(null);
  }
}
 
Example #10
Source File: ANTLRv4PluginController.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void createToolWindows() {
	LOG.info("createToolWindows "+project.getName());
	ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);

	previewPanel = new PreviewPanel(project);

	ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
	Content content = contentFactory.createContent(previewPanel, "", false);
	content.setCloseable(false);

	previewWindow = toolWindowManager.registerToolWindow(PREVIEW_WINDOW_ID, true, ToolWindowAnchor.BOTTOM);
	previewWindow.getContentManager().addContent(content);
	previewWindow.setIcon(Icons.getToolWindow());

	TextConsoleBuilderFactory factory = TextConsoleBuilderFactory.getInstance();
	TextConsoleBuilder consoleBuilder = factory.createBuilder(project);
	this.console = consoleBuilder.getConsole();

	JComponent consoleComponent = console.getComponent();
	content = contentFactory.createContent(consoleComponent, "", false);
	content.setCloseable(false);

	consoleWindow = toolWindowManager.registerToolWindow(CONSOLE_WINDOW_ID, true, ToolWindowAnchor.BOTTOM);
	consoleWindow.getContentManager().addContent(content);
	consoleWindow.setIcon(Icons.getToolWindow());
}
 
Example #11
Source File: BaseToolWindowToggleAction.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public final void setSelected(AnActionEvent e, boolean state) {
  Project project = e.getData(CommonDataKeys.PROJECT);
  if (project == null) {
    return;
  }
  String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
  if (id == null) {
    return;
  }

  ToolWindowManagerEx mgr = ToolWindowManagerEx.getInstanceEx(project);
  ToolWindowEx toolWindow = (ToolWindowEx)mgr.getToolWindow(id);

  setSelected(toolWindow, state);
}
 
Example #12
Source File: CopyHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void updateSelectionInActiveProjectView(PsiElement newElement, Project project, boolean selectInActivePanel) {
  String id = ToolWindowManager.getInstance(project).getActiveToolWindowId();
  if (id != null) {
    ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(id);
    Content selectedContent = window.getContentManager().getSelectedContent();
    if (selectedContent != null) {
      JComponent component = selectedContent.getComponent();
      if (component instanceof TwoPaneIdeView) {
        ((TwoPaneIdeView) component).selectElement(newElement, selectInActivePanel);
        return;
      }
    }
  }
  if (ToolWindowId.PROJECT_VIEW.equals(id)) {
    ProjectView.getInstance(project).selectPsiElement(newElement, true);
  }
  else if (ToolWindowId.STRUCTURE_VIEW.equals(id)) {
    VirtualFile virtualFile = newElement.getContainingFile().getVirtualFile();
    FileEditor editor = FileEditorManager.getInstance(newElement.getProject()).getSelectedEditor(virtualFile);
    StructureViewFactoryEx.getInstanceEx(project).getStructureViewWrapper().selectCurrentElement(editor, virtualFile, true);
  }
}
 
Example #13
Source File: AbstractProjectViewPane.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void doSelectModuleOrGroup(@Nonnull Object toSelect, final boolean requestFocus) {
  ToolWindowManager windowManager = ToolWindowManager.getInstance(myProject);
  final Runnable runnable = () -> {
    if (requestFocus) {
      ProjectView projectView = ProjectView.getInstance(myProject);
      if (projectView != null) {
        projectView.changeView(getId(), getSubId());
      }
    }
    BaseProjectTreeBuilder builder = (BaseProjectTreeBuilder)getTreeBuilder();
    if (builder != null) {
      builder.selectInWidth(toSelect, requestFocus, node -> node instanceof AbstractModuleNode || node instanceof ModuleGroupNode || node instanceof AbstractProjectNode);
    }
  };
  if (requestFocus) {
    windowManager.getToolWindow(ToolWindowId.PROJECT_VIEW).activate(runnable);
  }
  else {
    runnable.run();
  }
}
 
Example #14
Source File: MetadataAction.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent e) {
    Project project = getEventProject(e);
    MessageBus messageBus = project.getMessageBus();

    ExecuteQueryEvent executeQueryEvent = messageBus.syncPublisher(ExecuteQueryEvent.EXECUTE_QUERY_TOPIC);

    ExecuteQueryPayload payload = new ExecuteQueryPayload(getQuery(data));

    DataSourcesComponent dataSourcesComponent = project.getComponent(DataSourcesComponent.class);
    Optional<DataSourceApi> dataSource = dataSourcesComponent.getDataSourceContainer().findDataSource(dataSourceUuid);

    dataSource.ifPresent(dataSourceApi -> executeQueryEvent.executeQuery(dataSourceApi, payload));

    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(CONSOLE_TOOL_WINDOW);
    if (!toolWindow.isVisible()) {
        ConsoleToolWindow.ensureOpen(project);
        messageBus.syncPublisher(OpenTabEvent.OPEN_TAB_TOPIC).openTab(Tabs.TABLE);
    }
}
 
Example #15
Source File: IssueOutputFilter.java    From intellij with Apache License 2.0 6 votes vote down vote up
private Navigatable openConsoleToHyperlink(HyperlinkInfo link, int originalOffset) {
  return new Navigatable() {
    @Override
    public void navigate(boolean requestFocus) {
      BlazeConsoleView consoleView = BlazeConsoleView.getInstance(project);
      ToolWindow toolWindow =
          ToolWindowManager.getInstance(project).getToolWindow(BlazeConsoleToolWindowFactory.ID);
      toolWindow.activate(() -> consoleView.navigateToHyperlink(link, originalOffset), true);
    }

    @Override
    public boolean canNavigate() {
      return true;
    }

    @Override
    public boolean canNavigateToSource() {
      return true;
    }
  };
}
 
Example #16
Source File: MessageViewImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Inject
public MessageViewImpl(final Project project, final StartupManager startupManager, final ToolWindowManager toolWindowManager) {
  final Runnable runnable = new Runnable() {
    @Override
    public void run() {
      myToolWindow = toolWindowManager.registerToolWindow(ToolWindowId.MESSAGES_WINDOW, true, ToolWindowAnchor.BOTTOM, project, true);
      myToolWindow.setIcon(AllIcons.Toolwindows.ToolWindowMessages);
      new ContentManagerWatcher(myToolWindow, getContentManager());
      for (Runnable postponedRunnable : myPostponedRunnables) {
        postponedRunnable.run();
      }
      myPostponedRunnables.clear();
    }
  };
  if (project.isInitialized()) {
    runnable.run();
  }
  else {
    startupManager.registerPostStartupActivity(runnable::run);
  }

}
 
Example #17
Source File: HighlightSymbolAction.java    From emacsIDEAs with Apache License 2.0 6 votes vote down vote up
public void actionPerformed(AnActionEvent e, boolean searchForward) {
    Project project = e.getData(PlatformDataKeys.PROJECT);
    if (!ToolWindowManager.getInstance(project).isEditorComponentActive()) {
        ToolWindowManager.getInstance(project).activateEditorComponent();
        return;
    }

    if (super.initAction(e)) {
        int nextSymbolOffset = getNextSymbolOffset(searchForward, project);
        if (-1 != nextSymbolOffset) {
            _editor.getCaretModel().moveToOffset(nextSymbolOffset);
            _editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
            _editor.getSelectionModel().selectWordAtCaret(false);
        }
    }

    super.cleanupSetupsInAndBackToNormalEditingMode();
}
 
Example #18
Source File: SearchAction.java    From KodeBeagle with Apache License 2.0 6 votes vote down vote up
public final void actionPerformed(final AnActionEvent e) {
    Project project = e.getProject();
    if (project != null) {
        ToolWindowManager.getInstance(e.getProject()).
                getToolWindow(MainWindowBase.KODEBEAGLE).show(new Runnable() {
            @Override
            public void run() {
                try {
                    new RefreshAction().init();
                } catch (IOException ioe) {
                    KBNotification.getInstance().error(ioe);
                    ioe.printStackTrace();
                }
            }
        });
    }
}
 
Example #19
Source File: PantsConsoleManager.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
private static void initializeConsolePanel(Project project, ConsoleView console) {
  ToolWindow window =
    ToolWindowManager.getInstance(project).registerToolWindow(
      PantsConstants.PANTS_CONSOLE_NAME,
      true,
      ToolWindowAnchor.BOTTOM,
      project,
      true
    );

  window.setIcon(PantsIcons.Icon);

  PantsConsoleViewPanel pantsConsoleViewPanel = new PantsConsoleViewPanel(project, console);
  final boolean isLockable = true;
  final String displayName = "";
  Content pantsConsoleContent = ContentFactory.SERVICE.getInstance().createContent(pantsConsoleViewPanel, displayName, isLockable);
  pantsConsoleContent.setCloseable(false);
  window.getContentManager().addContent(pantsConsoleContent);
}
 
Example #20
Source File: EditorMacro.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public final String expand(DataContext dataContext) throws ExecutionCancelledException {
  Project project = dataContext.getData(CommonDataKeys.PROJECT);
  if (project == null) return null;
  if (ToolWindowManager.getInstance(project).isEditorComponentActive()) {
    Editor editor = dataContext.getData(PlatformDataKeys.EDITOR);
    if (editor != null){
      return expand(editor);
    }
  }
  return null;
}
 
Example #21
Source File: BookmarksAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public BookmarkInContextInfo invoke() {
  myBookmarkAtPlace = null;
  myFile = null;
  myLine = -1;


  BookmarkManager bookmarkManager = BookmarkManager.getInstance(myProject);
  if (ToolWindowManager.getInstance(myProject).isEditorComponentActive()) {
    Editor editor = myDataContext.getData(PlatformDataKeys.EDITOR);
    if (editor != null) {
      Document document = editor.getDocument();
      myLine = editor.getCaretModel().getLogicalPosition().line;
      myFile = FileDocumentManager.getInstance().getFile(document);
      myBookmarkAtPlace = bookmarkManager.findEditorBookmark(document, myLine);
    }
  }

  if (myFile == null) {
    myFile = myDataContext.getData(PlatformDataKeys.VIRTUAL_FILE);
    myLine = -1;

    if (myBookmarkAtPlace == null && myFile != null) {
      myBookmarkAtPlace = bookmarkManager.findFileBookmark(myFile);
    }
  }
  return this;
}
 
Example #22
Source File: BuckEventsConsumerTest.java    From buck with Apache License 2.0 5 votes vote down vote up
public BuckEventsConsumer initialiseEventsConsumer(MockProject project) {
  MockDisposable mockDisposable = new MockDisposable();

  MockApplication application = new MyMockApplication(mockDisposable);
  ApplicationManager.setApplication(application, mockDisposable);
  application.registerService(
      FileDocumentManager.class, new MockFileDocumentManagerImpl(null, null));
  application.registerService(
      VirtualFileManager.class,
      (VirtualFileManager) EasyMock.createMock(VirtualFileManager.class));
  project.registerService(BuckUIManager.class, new MockBuckUIManager(project));
  project.registerService(ToolWindowManager.class, new Mock.MyToolWindowManager());
  return new BuckEventsConsumer(project);
}
 
Example #23
Source File: ExportTestResultsAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void showBalloon(final Project project, final MessageType type, final String text, @Nullable final HyperlinkListener listener) {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    public void run() {
      if (project.isDisposed()) return;
      if (ToolWindowManager.getInstance(project).getToolWindow(myToolWindowId) != null) {
        ToolWindowManager.getInstance(project).notifyByBalloon(myToolWindowId, type, text, null, listener);
      }
    }
  });
}
 
Example #24
Source File: FreelineTerminal.java    From freeline with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void initTerminal(final ToolWindow toolWindow) {
    toolWindow.setToHideOnEmptyContent(true);
    LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
    toolWindow.setStripeTitle("Freeline");
    Content content = createTerminalInContentPanel(terminalRunner, toolWindow);
    toolWindow.getContentManager().addContent(content);
    toolWindow.setShowStripeButton(true);
    toolWindow.setTitle("Console");
    ((ToolWindowManagerEx) ToolWindowManager.getInstance(this.myProject)).addToolWindowManagerListener(new ToolWindowManagerListener() {
        @Override
        public void toolWindowRegistered(@NotNull String s) {

        }

        @Override
        public void stateChanged() {
            ToolWindow window = ToolWindowManager.getInstance(myProject).getToolWindow(FreelineToolWindowFactory.TOOL_WINDOW_ID);
            if (window != null) {
                boolean visible = window.isVisible();
                if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                    initTerminal(window);
                }
            }
        }
    });
    toolWindow.show(null);
    JBTabbedTerminalWidget terminalWidget = getTerminalWidget(toolWindow);
    if (terminalWidget != null && terminalWidget.getCurrentSession() != null) {
        Terminal terminal = terminalWidget.getCurrentSession().getTerminal();
        if (terminal != null) {
            terminal.setCursorVisible(false);
        }
    }
}
 
Example #25
Source File: ActivateToolWindowAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  Project project = getEventProject(e);
  if (project == null) return;
  ToolWindowManager windowManager = ToolWindowManager.getInstance(project);
  if (windowManager.isEditorComponentActive() || !myToolWindowId.equals(windowManager.getActiveToolWindowId())) {
    windowManager.getToolWindow(myToolWindowId).activate(null);
  }
  else {
    windowManager.getToolWindow(myToolWindowId).hide(null);
  }
}
 
Example #26
Source File: CopyError.java    From mypy-PyCharm-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getData(PlatformDataKeys.PROJECT);
    if (project == null) {
        return;
    }
    ToolWindow tw = ToolWindowManager.getInstance(project).getToolWindow(
            MypyToolWindowFactory.MYPY_PLUGIN_ID);
    if (!tw.isVisible()) {
        return;
    }
    MypyTerminal terminal = MypyToolWindowFactory.getMypyTerminal(project);
    if (terminal == null) {
        return;
    }
    if (terminal.getRunner().isRunning()) {
        return;
    }
    MypyError error = terminal.getErrorsList().getSelectedValue();
    if (error == null) { // no errors
        return;
    }
    if (error.getLevel() == MypyError.HEADER) {
        return;
    }
    StringSelection selection = new StringSelection(error.getRaw());
    Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    clipboard.setContents(selection, selection);
}
 
Example #27
Source File: ConsoleToolWindow.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
public static void ensureOpen(Project project) {
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.getToolWindow(GraphConstants.ToolWindow.CONSOLE_TOOL_WINDOW);

    if (!toolWindow.isActive()) {
        toolWindow.activate(null, false);
        return;
    }

    if (!toolWindow.isVisible()) {
        toolWindow.show(null);
    }
}
 
Example #28
Source File: RunContentManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void toFrontRunContent(final Executor requestor, final RunContentDescriptor descriptor) {
  ApplicationManager.getApplication().invokeLater(() -> {
    ContentManager contentManager = getContentManagerForRunner(requestor, descriptor);
    Content content = getRunContentByDescriptor(contentManager, descriptor);
    if (content != null) {
      contentManager.setSelectedContent(content);
      ToolWindowManager.getInstance(myProject).getToolWindow(getToolWindowIdForRunner(requestor, descriptor)).show(null);
    }
  }, myProject.getDisposed());
}
 
Example #29
Source File: BlazeConsoleServiceImpl.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void activateConsoleWindow() {
  ToolWindow toolWindow =
      ToolWindowManager.getInstance(project).getToolWindow(BlazeConsoleToolWindowFactory.ID);
  if (toolWindow != null) {
    toolWindow.activate(/* runnable= */ null, /* autoFocusContents= */ false);
  }
}
 
Example #30
Source File: JSGraphQLLanguageUIProjectService.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
private void initToolWindow() {
    if (this.myToolWindowManager != null && !this.myProject.isDisposed()) {
        StartupManager.getInstance(this.myProject).runWhenProjectIsInitialized(() -> ApplicationManager.getApplication().invokeLater(() -> {

            myToolWindowManager.init();

            final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(GRAPH_QL_TOOL_WINDOW_NAME);
            if (toolWindow != null) {
                createToolWindowResultEditor(toolWindow);
            }
            myToolWindowManagerInitialized = true;
        }, myProject.getDisposed()));
    }
}