Example usage for com.intellij.openapi.wm StatusBar addWidget

List of usage examples for com.intellij.openapi.wm StatusBar addWidget

Introduction

In this page you can find the example usage for com.intellij.openapi.wm StatusBar addWidget.

Prototype

@Deprecated
@ApiStatus.ScheduledForRemoval
void addWidget(@NotNull StatusBarWidget widget, @NotNull String anchor, @NotNull Disposable parentDisposable);

Source Link

Usage

From source file:com.chrisrm.idea.status.MTStatusBarManager.java

License:Open Source License

void install() {
    final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    if (statusBar != null) {
        statusBar.addWidget(mtStatusWidget, "before Position", project);
    }/*from  w w w.j a  va 2s  .  c  om*/
}

From source file:com.intellij.dvcs.DvcsUtil.java

License:Apache License

public static void installStatusBarWidget(@NotNull Project project, @NotNull StatusBarWidget widget) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    if (statusBar != null) {
        statusBar.addWidget(widget, "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), project);
    }//from ww w .  ja  v  a 2  s  .  co  m
}

From source file:net.groboclown.idea.p4ic.extension.P4Vcs.java

License:Apache License

@Override
protected void activate() {
    tempFileWatchDog.start();/*from   w  ww  .j  a  v a2 s  .  c  o m*/

    synchronized (vcsRootsCache) {
        vcsRootsCache.clear();
        vcsRootsCache
                .addAll(Arrays.asList(ProjectLevelVcsManager.getInstance(myProject).getRootsUnderVcs(this)));
    }

    if (myVFSListener == null) {
        myVFSListener = fileExtensions.createVcsVFSListener();
    }

    VcsCompat.getInstance().setupPlugin(myProject);
    ChangeListManager.getInstance(myProject).addChangeListListener(changelistListener);

    projectMessageBusConnection = myProject.getMessageBus().connect();
    appMessageBusConnection = ApplicationManager.getApplication().getMessageBus().connect();

    // Keep our cache up-to-date
    projectMessageBusConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, new VcsListener() {
        @Override
        public void directoryMappingChanged() {
            final VirtualFile[] cache = ProjectLevelVcsManager.getInstance(myProject)
                    .getRootsUnderVcs(P4Vcs.this);
            synchronized (vcsRootsCache) {
                vcsRootsCache.clear();
                vcsRootsCache.addAll(Arrays.asList(cache));
            }
        }
    });

    if (!ApplicationManager.getApplication().isHeadlessEnvironment()) {
        final StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
        if (statusBar != null) {
            connectionWidget = new P4MultipleConnectionWidget(this, myProject);
            ApplicationManager.getApplication().invokeAndWait(new Runnable() {
                @Override
                public void run() {
                    statusBar.addWidget(connectionWidget,
                            "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), myProject);
                }
            }, ModalityState.NON_MODAL);
            // Initialize the widget separately.
        }
    }

    /*
            
    // Look at adding file annotations (locally checked out or open for delete).
    if (myRepositoryForAnnotationsListener == null) {
    myRepositoryForAnnotationsListener = new P4RepositoryForAnnotationsListener(myProject);
    }
            
    // Activate any other services that are required.
    */

    // This is a good time to check for passwords and connectivity
    // See bugs #81, #84
    // But, additionally, bug #110 which can cause a deadlock when this
    // is done in the activation thread.  So instead, push this to the
    // background.

    ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
        @Override
        public void run() {
            refreshServerConnectivity();

            if (connectionWidget != null) {
                // This widget needs to be initialized outside the activation thread.
                // Do not block on running this, as it can indirectly run the password
                // store, and cause a deadlock (bug #110).
                ApplicationManager.getApplication().invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        connectionWidget.setValues();
                    }
                });
            }
        }
    });

}

From source file:org.community.intellij.plugins.communitycase.checkout.branches.BranchesWidget.java

License:Apache License

/**
 * Create and install widget//from  w w  w .  j  a  v  a2 s. co  m
 *
 * @param project        the context project
 * @param configurations the configurations to use
 * @return the action that uninstalls widget
 */
static Runnable install(final Project project, final BranchConfigurations configurations) {
    final Ref<BranchesWidget> widget = new Ref<BranchesWidget>();
    com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(new Runnable() {
        @Override
        public void run() {
            StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
            if (statusBar != null) {
                final BranchesWidget w = new BranchesWidget(project, statusBar, configurations);
                statusBar.addWidget(w, "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), project);
                widget.set(w);
            }
        }
    });
    return new Runnable() {
        @Override
        public void run() {
            if (widget.get() != null) {
                com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(new Runnable() {
                    @Override
                    public void run() {
                        Disposer.dispose(widget.get());
                    }
                });
            }
        }
    };

}