com.intellij.openapi.wm.StatusBarWidget Java Examples

The following examples show how to use com.intellij.openapi.wm.StatusBarWidget. 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: LineEndingsManager.java    From editorconfig-jetbrains with MIT License 6 votes vote down vote up
private void updateStatusBar() {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
        @Override
        public void run() {
            IdeFrame frame = WindowManager.getInstance().getIdeFrame(project);
            StatusBar statusBar = frame.getStatusBar();
            StatusBarWidget widget = statusBar != null ? statusBar.getWidget("LineSeparator") : null;

            if (widget instanceof LineSeparatorPanel) {
                FileEditorManagerEvent event = new FileEditorManagerEvent(FileEditorManager.getInstance(project),
                                                                          null, null, null, null);
                ((LineSeparatorPanel)widget).selectionChanged(event);
            }
        }
    });
}
 
Example #2
Source File: DvcsStatusWidget.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void removeWidgetFromStatusBar(@Nonnull final Project project, @Nonnull final StatusBarWidget widget) {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
      if (statusBar != null && !isDisposed()) {
        statusBar.removeWidget(widget.ID());
      }
    }
  });
}
 
Example #3
Source File: DvcsStatusWidget.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void installWidgetToStatusBar(@Nonnull final Project project, @Nonnull final StatusBarWidget widget) {
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
      if (statusBar != null && !isDisposed()) {
        statusBar.addWidget(widget, "after " + (SystemInfo.isMac ? "Encoding" : "InsertOverwrite"), project);
        subscribeToMappingChanged();
        subscribeToRepoChangeEvents(project);
        update();
      }
    }
  });
}
 
Example #4
Source File: EditorBasedStatusBarPopup.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public final StatusBarWidget copy() {
  return createInstance(getProject());
}
 
Example #5
Source File: WebStatusBarImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@javax.annotation.Nullable
@Override
public StatusBarWidget getWidget(String id) {
  return null;
}
 
Example #6
Source File: TogglePopupHintsPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
  return new TogglePopupHintsPanel(getProject());
}
 
Example #7
Source File: TogglePopupHintsPanelProvider.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public StatusBarWidget getWidget(@Nonnull Project project) {
  return new TogglePopupHintsPanel(project);
}
 
Example #8
Source File: PositionPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
  return new PositionPanel(getProject());
}
 
Example #9
Source File: EncodingPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected StatusBarWidget createInstance(@Nonnull Project project) {
  return new EncodingPanel(project);
}
 
Example #10
Source File: ToggleReadOnlyAttributePanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
  return new ToggleReadOnlyAttributePanel();
}
 
Example #11
Source File: LineSeparatorPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected StatusBarWidget createInstance(@Nonnull Project project) {
  return new LineSeparatorPanel(project);
}
 
Example #12
Source File: ColumnSelectionModePanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
  return new ColumnSelectionModePanel(getProject());
}
 
Example #13
Source File: EditorBasedStatusBarPopup.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
protected abstract StatusBarWidget createInstance(@Nonnull Project project);
 
Example #14
Source File: TimerStatusBarWidgetProvider.java    From leetcode-editor with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public StatusBarWidget getWidget(@NotNull Project project) {
    return new TimerBarWidget(project);
}
 
Example #15
Source File: ModuleLayerWidget.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
protected StatusBarWidget createInstance(@Nonnull Project project) {
  return new ModuleLayerWidget(project);
}
 
Example #16
Source File: StatusBarManagerTest.java    From azure-devops-intellij with MIT License 4 votes vote down vote up
@Before
public void setupLocalTests() {
    MockitoAnnotations.initMocks(this);
    buildStatusLookupOperation = new MyBuildStatusLookupOperation();

    PowerMockito.mockStatic(WindowManager.class);
    when(WindowManager.getInstance()).thenReturn(windowManager);
    when(windowManager.getStatusBar(any(Project.class))).thenReturn(statusBar);
    when(statusBar.getWidget(anyString()))
            .thenReturn(null) // First time return null
            .thenReturn(new BuildWidget()); // All other calls should return something other than null
    doNothing().when(statusBar).addWidget(any(StatusBarWidget.class));
    doNothing().when(statusBar).updateWidget(anyString());

    PowerMockito.mockStatic(ProjectManager.class);
    when(ProjectManager.getInstance()).thenReturn(projectManager);
    when(projectManager.getOpenProjects()).thenReturn(new Project[]{project});

    PowerMockito.mockStatic(VcsHelper.class);
    when(VcsHelper.getRepositoryContext(any(Project.class)))
            .thenReturn(
                    RepositoryContext.createGitContext(
                            "/root/one",
                            "repo1",
                            "branch1",
                            URI.create("http://repoUrl1")));

    PowerMockito.mockStatic(GitBranchUtil.class);
    when(GitBranchUtil.getCurrentRepository(any(Project.class))).thenReturn(gitRepository);
    when(GitBranchUtil.getDisplayableBranchText(any(GitRepository.class))).thenReturn("branch");

    when(applicationNamesInfo.getProductName()).thenReturn("IDEA");
    PowerMockito.mockStatic(ApplicationNamesInfo.class);
    when(ApplicationNamesInfo.getInstance()).thenReturn(applicationNamesInfo);

    when(gitRepository.getRemotes()).thenReturn(Collections.singletonList(
            new GitRemote("origin", Collections.singletonList("https://test.visualstudio.com/"),
                    Collections.singletonList("https://test.visualstudio.com/"),
                    Collections.singletonList("https://test.visualstudio.com/"),
                    Collections.singletonList("https://test.visualstudio.com/"))));

    PowerMockito.mockStatic(OperationFactory.class);
    when(OperationFactory.createBuildStatusLookupOperation(any(RepositoryContext.class), anyBoolean())).thenReturn(buildStatusLookupOperation);
}
 
Example #17
Source File: TimerBarWidget.java    From leetcode-editor with Apache License 2.0 4 votes vote down vote up
@Nullable
public StatusBarWidget.WidgetPresentation getPresentation() {
    return this.getPresentation(SystemInfo.isMac ? StatusBarWidget.PlatformType.MAC : StatusBarWidget.PlatformType.DEFAULT);
}
 
Example #18
Source File: TimerBarWidget.java    From leetcode-editor with Apache License 2.0 4 votes vote down vote up
@Nullable
public StatusBarWidget.WidgetPresentation getPresentation(@NotNull StatusBarWidget.PlatformType type) {
    return null;
}
 
Example #19
Source File: GTMStatusWidget.java    From gtm-jetbrains-plugin with MIT License 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
    return new GTMStatusWidget(myProject);
}
 
Example #20
Source File: TimeTrackerWidgetFactory.java    From DarkyenusTimeTracker with The Unlicense 4 votes vote down vote up
@Override
public void disposeWidget(@NotNull StatusBarWidget widget) {
	// Nothing to dispose
}
 
Example #21
Source File: TestWindowManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget getWidget(String id) {
  return null;
}
 
Example #22
Source File: GitStatusWidget.java    From GitToolBox with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
  return new GitStatusWidget(myProject);
}
 
Example #23
Source File: SymfonyProfilerWidget.java    From idea-php-symfony2-plugin with MIT License 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
    return new SymfonyProfilerWidget(getProject());
}
 
Example #24
Source File: SvnBranchWidget.java    From SVNToolBox with Apache License 2.0 4 votes vote down vote up
@Override
public StatusBarWidget copy() {
    return new SvnBranchWidget(myProject);
}
 
Example #25
Source File: TestWindowManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addWidget(@Nonnull StatusBarWidget widget, @Nonnull Disposable parentDisposable) {
  Disposer.register(parentDisposable, widget);
}
 
Example #26
Source File: TestWindowManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addWidget(@Nonnull StatusBarWidget widget, @Nonnull String anchor, @Nonnull Disposable parentDisposable) {
  Disposer.register(parentDisposable, widget);
}
 
Example #27
Source File: TestWindowManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addWidget(@Nonnull StatusBarWidget widget) {
}
 
Example #28
Source File: TestWindowManager.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void addWidget(@Nonnull StatusBarWidget widget, @Nonnull String anchor) {
}
 
Example #29
Source File: WebStatusBarImpl.java    From consulo with Apache License 2.0 2 votes vote down vote up
@Override
public void addWidget(@Nonnull StatusBarWidget widget) {

}
 
Example #30
Source File: WebStatusBarImpl.java    From consulo with Apache License 2.0 2 votes vote down vote up
@Override
public void addWidget(@Nonnull StatusBarWidget widget, @Nonnull String anchor) {

}