Java Code Examples for com.intellij.openapi.wm.StatusBar#addWidget()

The following examples show how to use com.intellij.openapi.wm.StatusBar#addWidget() . 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: LSPServerStatusWidget.java    From lsp4intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a widget given a LanguageServerWrapper and adds it to the status bar
 *
 * @param wrapper The wrapper
 * @return The widget
 */
public static LSPServerStatusWidget createWidgetFor(LanguageServerWrapper wrapper) {
    LSPServerStatusWidget widget = new LSPServerStatusWidget(wrapper);
    Project project = wrapper.getProject();
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);

    if (widgetIDs.get(project) == null || widgetIDs.get(project).isEmpty()) {
        ArrayList<String> list = new ArrayList<>();
        list.add("Position");
        widgetIDs.put(project, list);
    }

    statusBar.addWidget(widget, "before " + widgetIDs.get(project).get(0));
    widgetIDs.get(project).add(0, widget.ID());
    return widget;
}
 
Example 2
Source File: GTMProject.java    From gtm-jetbrains-plugin with MIT License 6 votes vote down vote up
private void installGtmWidget() {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
    if (statusBar != null) {
        statusBar.addWidget(myStatusWidget, myProject);
        myStatusWidget.installed();
        if (!GTMRecord.initGtmExePath()) {
            JBPopupFactory.getInstance()
                    .createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmNotFound, ERROR, null)
                    .setFadeoutTime(30000)
                    .createBalloon()
                    .show(RelativePoint.getSouthEastOf(statusBar.getComponent()),
                            Balloon.Position.atRight);
            return;
        }
        if (!GTMRecord.checkVersion()) {
            JBPopupFactory.getInstance()
                    .createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmVerOutdated, WARNING, null)
                    .setFadeoutTime(30000)
                    .createBalloon()
                    .show(RelativePoint.getSouthEastOf(statusBar.getComponent()),
                            Balloon.Position.atRight);
        }
    }
}
 
Example 3
Source File: Symfony2ProjectComponent.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
public void projectOpened() {
    this.checkProject();

    // attach toolbar popup (right bottom)
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(this.project);
    if(statusBar == null) {
        return;
    }

    // clean bar on project open; we can have multiple projects att some time
    if(statusBar.getWidget(SymfonyProfilerWidget.ID) != null) {
        statusBar.removeWidget(SymfonyProfilerWidget.ID);
    }

    if(isEnabled()) {
        SymfonyProfilerWidget symfonyProfilerWidget = new SymfonyProfilerWidget(this.project);
        statusBar.addWidget(symfonyProfilerWidget);
    }

}
 
Example 4
Source File: StatusBarManager.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
private static void updateWidgets(final StatusBar statusBar, final Project project, final boolean allowPrompt) {
    // Update the build widget
    BuildWidget buildWidget = (BuildWidget) statusBar.getWidget(BuildWidget.getID());
    if (buildWidget == null) {
        buildWidget = new BuildWidget();
        statusBar.addWidget(buildWidget, project);
    }
    // Attempt to get the current repository context (if none, then the status stays as it was)
    final RepositoryContext repositoryContext = VcsHelper.getRepositoryContext(project);
    if (repositoryContext != null) {
        final BuildWidget widget = buildWidget;

        // Create the operation and start the background work to get the latest build information
        final BuildStatusLookupOperation op = OperationFactory.createBuildStatusLookupOperation(repositoryContext, allowPrompt);
        op.addListener(new Operation.Listener() {
            @Override
            public void notifyLookupStarted() { /* do nothing */ }

            @Override
            public void notifyLookupCompleted() { /* do nothing */ }

            @Override
            public void notifyLookupResults(final Operation.Results results) {
                updateBuildWidget(project, statusBar, widget, (BuildStatusLookupOperation.BuildStatusResults) results);
            }
        });
        op.doWorkAsync(null);

    } else {
        // The repository hasn't been opened yet, we should get an event when it is opened
    }
}
 
Example 5
Source File: ProjectComponent.java    From silex-idea-plugin with MIT License 5 votes vote down vote up
public void projectOpened() {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    if (statusBar != null) {
        ContainerStatusBarWidget containerStatusBarWidget = new ContainerStatusBarWidget(project);
        statusBar.addWidget(containerStatusBarWidget);

        containerStatusBarWidget.setText("");
    }

    ContainerResolver.put(project, new JsonFileContainer(project, Configuration.getInstance(project).containerDefinitionFileName));
}
 
Example 6
Source File: SvnToolBoxProject.java    From SVNToolBox with Apache License 2.0 5 votes vote down vote up
@Override
public void projectOpened() {
    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
        myBranchWidget = new SvnBranchWidget(myProject);
        StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
        if (statusBar != null) {
            statusBar.addWidget(myBranchWidget, myProject);
        }
    }
    LOG.debug("Project opened");
}
 
Example 7
Source File: ActionMacroManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void startRecording(String macroName) {
  LOG.assertTrue(!myIsRecording);
  myIsRecording = true;
  myRecordingMacro = new ActionMacro(macroName);

  final StatusBar statusBar = WindowManager.getInstance().getIdeFrame(null).getStatusBar();
  myWidget = new Widget(statusBar);
  statusBar.addWidget(myWidget);
}
 
Example 8
Source File: StatusIndicator.java    From spring-javaformat with Apache License 2.0 4 votes vote down vote up
private void show(StatusBar statusBar) {
	if (this.widget == null) {
		this.widget = new Widget();
		statusBar.addWidget(this.widget, this.project);
	}
}
 
Example 9
Source File: GraphConsoleView.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 4 votes vote down vote up
private void initializeWidgets(Project project) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    executionStatusBarWidget = new ExecutionStatusBarWidget(project.getMessageBus());
    statusBar.addWidget(executionStatusBarWidget, "before Position");
}