Java Code Examples for com.intellij.openapi.wm.ToolWindowManager#registerToolWindow()

The following examples show how to use com.intellij.openapi.wm.ToolWindowManager#registerToolWindow() . 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: TestToolWindow.java    From intellij-reference-diagram with Apache License 2.0 6 votes vote down vote up
private static TestToolWindow createViewTab(Project project, PsiElement baseElement) {
    final ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    ToolWindow toolWindow = toolWindowManager.getToolWindow(TOOL_WINDOW_ID);
    if (toolWindow == null) {
        toolWindow = toolWindowManager.registerToolWindow(TOOL_WINDOW_ID,
                true,
                ToolWindowAnchor.BOTTOM);
    }
    final TestToolWindow view = new TestToolWindow(project);
    ToolWindow finalToolWindow = toolWindow;
    toolWindow.activate(() -> {
        final String text = SymbolPresentationUtil.getSymbolPresentableText(baseElement);
        final ContentImpl content = new ContentImpl(view, "to " + text, true);
        finalToolWindow.getContentManager().addContent(content);
        finalToolWindow.getContentManager().setSelectedContent(content, true);
    });
    return view;
}
 
Example 3
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 4
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 5
Source File: BlazeProblemsView.java    From intellij with Apache License 2.0 5 votes vote down vote up
private void createToolWindow(
    Project project, ToolWindowManager wm, BlazeProblemsViewPanel panel) {
  if (project.isDisposed()) {
    return;
  }
  ToolWindow toolWindow =
      wm.registerToolWindow(toolWindowId, false, ToolWindowAnchor.BOTTOM, project, true);
  Content content = ContentFactory.SERVICE.getInstance().createContent(panel, "", false);
  toolWindow.getContentManager().addContent(content);
  Disposer.register(project, () -> toolWindow.getContentManager().removeAllContents(true));
  updateIcon(panel);
}
 
Example 6
Source File: JSGraphQLLanguageToolWindowManager.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
public synchronized void init() {
    if (!myFirstInitialized || myToolWindow == null) {
        ApplicationManager.getApplication().assertIsDispatchThread();
        ToolWindowManager manager = ToolWindowManager.getInstance(myProject);
        myToolWindow = manager.registerToolWindow(myToolWindowName, true, ToolWindowAnchor.BOTTOM, myProject, true);
        myToolWindow.setIcon(myIcon);
        createSchemasPanel();
        myFirstInitialized = true;
    }
}
 
Example 7
Source File: NoSqlWindowManager.java    From nosql4idea with Apache License 2.0 5 votes vote down vote up
public NoSqlWindowManager(Project project) {
    this.project = project;

    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    noSqlExplorerPanel = new NoSqlExplorerPanel(project, DatabaseVendorClientManager.getInstance(project));
    noSqlExplorerPanel.installActions();
    Content nosqlExplorer = ContentFactory.SERVICE.getInstance().createContent(noSqlExplorerPanel, null, false);

    ToolWindow toolNoSqlExplorerWindow = toolWindowManager.registerToolWindow(NOSQL_EXPLORER, false, ToolWindowAnchor.RIGHT);
    toolNoSqlExplorerWindow.getContentManager().addContent(nosqlExplorer);
    toolNoSqlExplorerWindow.setIcon(NOSQL_ICON);
}
 
Example 8
Source File: FloobitsWindowManager.java    From floobits-intellij with Apache License 2.0 5 votes vote down vote up
protected void createChatWindow(Project project) {
    ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
    toolWindow = toolWindowManager.registerToolWindow("Floobits", true, ToolWindowAnchor.BOTTOM);
    toolWindow.setIcon(IconLoader.getIcon("/icons/floo13.png"));
    Content content = ContentFactory.SERVICE.getInstance().createContent(chatForm.getChatPanel(), "", true);
    toolWindow.getContentManager().addContent(content);
    updateTitle();
}
 
Example 9
Source File: CoverageViewManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public CoverageViewManager(Project project, ToolWindowManager toolWindowManager, CoverageDataManager dataManager) {
  myProject = project;
  myDataManager = dataManager;

  ToolWindow toolWindow = toolWindowManager.registerToolWindow(TOOLWINDOW_ID, true, ToolWindowAnchor.RIGHT, myProject);
  toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowCoverage);
  toolWindow.setSplitMode(true, null);
  myContentManager = toolWindow.getContentManager();
  new ContentManagerWatcher(toolWindow, myContentManager);
}
 
Example 10
Source File: HierarchyBrowserManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Inject
public HierarchyBrowserManager(final Project project) {
  final ToolWindowManager toolWindowManager=ToolWindowManager.getInstance(project);
  final ToolWindow toolWindow = toolWindowManager.registerToolWindow(ToolWindowId.HIERARCHY, true, ToolWindowAnchor.RIGHT, project);
  myContentManager = toolWindow.getContentManager();
  toolWindow.setIcon(AllIcons.Toolwindows.ToolWindowHierarchy);
  new ContentManagerWatcher(toolWindow,myContentManager);
}
 
Example 11
Source File: RNUtil.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private static void processConsole(Project project, ProcessHandler processHandler) {
        ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
        consoleView.clear();
        consoleView.attachToProcess(processHandler);
        processHandler.startNotify();

        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);// TODO add more tabs here?
            return;
        }

        toolWindow = toolWindowManager.registerToolWindow(TOOL_ID, true, ToolWindowAnchor.BOTTOM);
        toolWindow.setTitle("Android....");
        toolWindow.setStripeTitle("Android Console");
        toolWindow.setShowStripeButton(true);
        toolWindow.setIcon(PluginIcons.ICON_TOOL_WINDOW);

        JPanel panel = new JPanel((LayoutManager) new BorderLayout());
        panel.add((Component) consoleView.getComponent(), "Center");

        // Create toolbars
        DefaultActionGroup toolbarActions = new DefaultActionGroup();
        AnAction[]
                consoleActions = consoleView.createConsoleActions();// 必须在 consoleView.getComponent() 调用后组件真正初始化之后调用
        toolbarActions.addAll((AnAction[]) Arrays.copyOf(consoleActions, consoleActions.length));
        toolbarActions.add((AnAction) new StopProcessAction("Stop process", "Stop process", processHandler));
//        toolbarActions.add((AnAction) new CloseAction(defaultExecutor, runDescriptor, project));


        ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("unknown", (ActionGroup) toolbarActions, false);
        toolbar.setTargetComponent(consoleView.getComponent());
        panel.add((Component) toolbar.getComponent(), "West");

        ContentImpl consoleContent = new ContentImpl(panel, "Build", false);
        consoleContent.setManager(toolWindow.getContentManager());

        toolbarActions.add(new CloseTabAction(consoleContent));

//        addAdditionalConsoleEditorActions(consoleView, consoleContent);
//        consoleComponent.setActions();
        toolWindow.getContentManager().addContent(consoleContent);
        toolWindow.getContentManager().addContent(new ContentImpl(new JButton("Test"), "Build2", false));
        toolWindow.show(null);
    }
 
Example 12
Source File: RunDashboardManagerImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void createToolWindow() {
  ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
  ToolWindow toolWindow = toolWindowManager.registerToolWindow(getToolWindowId(), false, ToolWindowAnchor.BOTTOM, myProject, true);
  toolWindow.setIcon(getToolWindowIcon());
  createToolWindowContent(toolWindow);
}