Java Code Examples for com.intellij.openapi.wm.ToolWindow#setIcon()

The following examples show how to use com.intellij.openapi.wm.ToolWindow#setIcon() . 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: FlutterView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void updateForEmptyContent(ToolWindow toolWindow) {
  // There's a possible race here where the tool window gets disposed while we're displaying contents.
  if (toolWindow.isDisposed()) {
    return;
  }

  toolWindow.setIcon(FlutterIcons.Flutter_13);

  // Display a 'No running applications' message.
  final ContentManager contentManager = toolWindow.getContentManager();
  final JPanel panel = new JPanel(new BorderLayout());
  final JBLabel label = new JBLabel("No running applications", SwingConstants.CENTER);
  label.setForeground(UIUtil.getLabelDisabledForeground());
  panel.add(label, BorderLayout.CENTER);
  emptyContent = contentManager.getFactory().createContent(panel, null, false);
  contentManager.addContent(emptyContent);
}
 
Example 3
Source File: FlutterPerformanceView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void updateForEmptyContent(ToolWindow toolWindow) {
  // There's a possible race here where the tool window gets disposed while we're displaying contents.
  if (toolWindow.isDisposed()) {
    return;
  }

  toolWindow.setIcon(FlutterIcons.Flutter_13);

  // Display a 'No running applications' message.
  final ContentManager contentManager = toolWindow.getContentManager();
  final JPanel panel = new JPanel(new BorderLayout());
  final JBLabel label = new JBLabel("No running applications", SwingConstants.CENTER);
  label.setForeground(UIUtil.getLabelDisabledForeground());
  panel.add(label, BorderLayout.CENTER);
  emptyContent = contentManager.getFactory().createContent(panel, null, false);
  contentManager.addContent(emptyContent);
}
 
Example 4
Source File: FlutterView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void updateForEmptyContent(ToolWindow toolWindow) {
  // There's a possible race here where the tool window gets disposed while we're displaying contents.
  if (toolWindow.isDisposed()) {
    return;
  }

  toolWindow.setIcon(FlutterIcons.Flutter_13);

  // Display a 'No running applications' message.
  final ContentManager contentManager = toolWindow.getContentManager();
  final JPanel panel = new JPanel(new BorderLayout());
  final JBLabel label = new JBLabel("No running applications", SwingConstants.CENTER);
  label.setForeground(UIUtil.getLabelDisabledForeground());
  panel.add(label, BorderLayout.CENTER);
  emptyContent = contentManager.getFactory().createContent(panel, null, false);
  contentManager.addContent(emptyContent);
}
 
Example 5
Source File: FlutterPerformanceView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void updateForEmptyContent(ToolWindow toolWindow) {
  // There's a possible race here where the tool window gets disposed while we're displaying contents.
  if (toolWindow.isDisposed()) {
    return;
  }

  toolWindow.setIcon(FlutterIcons.Flutter_13);

  // Display a 'No running applications' message.
  final ContentManager contentManager = toolWindow.getContentManager();
  final JPanel panel = new JPanel(new BorderLayout());
  final JBLabel label = new JBLabel("No running applications", SwingConstants.CENTER);
  label.setForeground(UIUtil.getLabelDisabledForeground());
  panel.add(label, BorderLayout.CENTER);
  emptyContent = contentManager.getFactory().createContent(panel, null, false);
  contentManager.addContent(emptyContent);
}
 
Example 6
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 7
Source File: Runner.java    From phpstorm-plugin with MIT License 5 votes vote down vote up
public ToolWindow getToolWindow() {
    ToolWindow toolWindow;

    String windowId = "atoum";
    if (!Arrays.asList(ToolWindowManager.getInstance(project).getToolWindowIds()).contains(windowId)) {
        toolWindow = ToolWindowManager.getInstance(project).registerToolWindow(windowId, false, ToolWindowAnchor.BOTTOM);
    } else {
        toolWindow = ToolWindowManager.getInstance(project).getToolWindow(windowId);
    }

    toolWindow.setIcon(Icons.ATOUM);
    toolWindow.show(null);

    return toolWindow;
}
 
Example 8
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 9
Source File: RunContentManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
private void registerToolWindow(@Nonnull final Executor executor, @Nonnull ToolWindowManagerEx toolWindowManager) {
  final String toolWindowId = executor.getToolWindowId();
  if (toolWindowManager.getToolWindow(toolWindowId) != null) {
    return;
  }

  final ToolWindow toolWindow = toolWindowManager.registerToolWindow(toolWindowId, true, ToolWindowAnchor.BOTTOM, this, true);
  final ContentManager contentManager = toolWindow.getContentManager();
  contentManager.addDataProvider(new DataProvider() {
    private int myInsideGetData = 0;

    @Override
    public Object getData(@Nonnull Key<?> dataId) {
      myInsideGetData++;
      try {
        if (PlatformDataKeys.HELP_ID == dataId) {
          return executor.getHelpId();
        }
        else {
          return myInsideGetData == 1 ? DataManager.getInstance().getDataContext(contentManager.getComponent()).getData(dataId) : null;
        }
      }
      finally {
        myInsideGetData--;
      }
    }
  });

  toolWindow.setIcon(executor.getToolWindowIcon());
  new ContentManagerWatcher(toolWindow, contentManager);
  initToolWindow(executor, toolWindowId, executor.getToolWindowIcon(), contentManager);
}
 
Example 10
Source File: IdeNotificationArea.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
private void applyIconToStatusAndToolWindow(Project project, Image icon) {
  if (UISettings.getInstance().HIDE_TOOL_STRIPES || UISettings.getInstance().PRESENTATION_MODE) {
    myLabel.setVisible(true);
    myLabel.setImage(icon);
  }
  else {
    ToolWindow eventLog = EventLog.getEventLog(project);
    if (eventLog != null) {
      eventLog.setIcon(icon);
    }
    myLabel.setVisible(false);
  }
}
 
Example 11
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 12
Source File: BuckToolWindowFactory.java    From buck with Apache License 2.0 5 votes vote down vote up
@Override
public void createToolWindowContent(final Project project, ToolWindow toolWindow) {
  toolWindow.setAvailable(true, null);
  toolWindow.setToHideOnEmptyContent(true);
  toolWindow.setIcon(BuckIcons.BUCK_TOOL_WINDOW_ICON);

  BuckProjectSettingsProvider settingsProvider = BuckProjectSettingsProvider.getInstance(project);
  BuckUIManager buckUIManager = BuckUIManager.getInstance(project);

  // Init tool window
  buckUIManager.initBuckToolWindow(settingsProvider.isShowDebugWindow());
}
 
Example 13
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 14
Source File: ReactNativeConsole.java    From react-native-console with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
     * Init and show this console pane.
     * @param toolWindow
     */
    public void init(final ToolWindow toolWindow) {
        toolWindow.setToHideOnEmptyContent(true);
        toolWindow.setStripeTitle("RN Console");
        toolWindow.setIcon(PluginIcons.React);
        Content content = createConsoleTabContent(toolWindow, true, "Welcome", null);
//        toolWindow.getContentManager().addContent(content);
//        toolWindow.getContentManager().addContent(new ContentImpl(new JButton("Test"), "Build2", false));

        // ======= test a terminal create ======
//        LocalTerminalDirectRunner terminalRunner = LocalTerminalDirectRunner.createTerminalRunner(myProject);
//        Content testTerminalContent = createTerminalInContentPanel(terminalRunner, toolWindow);
//        toolWindow.getContentManager().addContent(testTerminalContent);

//        SimpleTerminal term  = new SimpleTerminal();
//        term.sendString("ls\n");
//        toolWindow.getContentManager().addContent(new ContentImpl(term.getComponent(), "terminal", false));
        toolWindow.setShowStripeButton(true);// if set to false, then sometimes the window will be hidden from the dock area for ever 2017-05-26
//        toolWindow.setTitle(" - ");
        // TODO Change to Eventbus
        ((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(RNToolWindowFactory.TOOL_WINDOW_ID);
                if (window != null) {
                    boolean visible = window.isVisible();
                    if (visible && toolWindow.getContentManager().getContentCount() == 0) {
                        init(window);
                    }
                }
            }
        });
        toolWindow.show(null);
    }
 
Example 15
Source File: SymfonyWebProfilerWindowFactory.java    From idea-php-symfony2-plugin with MIT License 4 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
    SymfonyWebProfilerPane symfony2SearchPane = new SymfonyWebProfilerPane(project);
    setUpContent((ToolWindowEx)toolWindow, symfony2SearchPane);
    toolWindow.setIcon(TOOLWINDOW_ICON);
}
 
Example 16
Source File: LogviewFactory.java    From logviewer with Apache License 2.0 4 votes vote down vote up
@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {

    final File adb = AndroidSdkUtils.getAdb(project);
    ExecutionManager.getInstance(project).getContentManager();

    RunnerLayoutUi layoutUi = RunnerLayoutUi.Factory.getInstance(project).create("LogViewer", TOOL_WINDOW_ID, "Logview Tools", project);

    toolWindow.setIcon(LogviewerPluginIcons.TOOL_ICON);
    toolWindow.setAvailable(true, null);
    toolWindow.setToHideOnEmptyContent(true);
    toolWindow.setTitle(TOOL_WINDOW_ID);


    DeviceContext deviceContext = new DeviceContext();

    Content logcatContent = createLogcatContent(layoutUi, project, deviceContext);
    final LogView logcatView = logcatContent.getUserData(LOG_VIEW_KEY);
    layoutUi.addContent(logcatContent, 0, PlaceInGrid.center, false);

    final JBLoadingPanel loadingPanel = new JBLoadingPanel(new BorderLayout(), project);
    loadingPanel.add(layoutUi.getComponent(), BorderLayout.CENTER);

    final ContentManager contentManager = toolWindow.getContentManager();
    Content c = contentManager.getFactory().createContent(loadingPanel, "", true);
    c.putUserData(LOG_VIEW_KEY, logcatView);
    contentManager.addContent(c);
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            logcatView.activate();
        }
    }, project.getDisposed());


    if (adb != null) {
        loadingPanel.setLoadingText("Initializing ADB");
        loadingPanel.startLoading();

        //ListenableFuture<AndroidDebugBridge> future = AdbService.getInstance().getDebugBridge(adb);
        ListenableFuture<AndroidDebugBridge> future = AdbBridgeFactory.getAdb(adb);
        Futures.addCallback(future, new FutureCallback<AndroidDebugBridge>() {
            @Override
            public void onSuccess(@Nullable AndroidDebugBridge bridge) {
                Logger.getInstance(LogviewFactory.class).info("Successfully obtained debug bridge");
                loadingPanel.stopLoading();
            }

            @Override
            public void onFailure(@NotNull Throwable t) {
                loadingPanel.stopLoading();
                Logger.getInstance(LogviewFactory.class).info("Unable to obtain debug bridge", t);
                String msg;
                if (t.getMessage() != null) {
                    msg = t.getMessage();
                } else {
                    msg = String.format("Unable to establish a connection to adb",
                            ApplicationNamesInfo.getInstance().getProductName(), adb.getAbsolutePath());
                }
                Messages.showErrorDialog(msg, "ADB Connection Error");
            }
        }, EdtExecutor.INSTANCE);
    } else {
        logcatView.showHint("No adb connection!.\n\nDrag and drop log files to view them.");
    }
}
 
Example 17
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);
}
 
Example 18
Source File: ORToolWindowFactory.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@Override
public void init(ToolWindow window) {
    window.setIcon(getIcon());
    window.setTitle(getTitle());
    window.setStripeTitle(getStripeTitle());
}
 
Example 19
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);
    }