use of com.intellij.ui.AppIcon in project intellij-community by JetBrains.
the class CompilerTask method addIndicatorDelegate.
private void addIndicatorDelegate() {
ProgressIndicator indicator = myIndicator;
if (!(indicator instanceof ProgressIndicatorEx)) {
return;
}
((ProgressIndicatorEx) indicator).addStateDelegate(new AbstractProgressIndicatorExBase() {
@Override
public void cancel() {
super.cancel();
selectFirstMessage();
stopAppIconProgress();
}
@Override
public void stop() {
super.stop();
if (!isCanceled()) {
selectFirstMessage();
}
stopAppIconProgress();
}
private void selectFirstMessage() {
if (!isHeadlessMode()) {
SwingUtilities.invokeLater(() -> {
if (myProject != null && myProject.isDisposed()) {
return;
}
synchronized (myMessageViewLock) {
if (myErrorTreeView != null) {
myErrorTreeView.selectFirstMessage();
}
}
});
}
}
private void stopAppIconProgress() {
UIUtil.invokeLaterIfNeeded(() -> {
if (myProject != null && myProject.isDisposed()) {
return;
}
final AppIcon appIcon = AppIcon.getInstance();
if (appIcon.hideProgress(myProject, APP_ICON_ID)) {
if (myErrorCount > 0) {
appIcon.setErrorBadge(myProject, String.valueOf(myErrorCount));
appIcon.requestAttention(myProject, true);
} else if (!myCompilationStartedAutomatically) {
appIcon.setOkBadge(myProject, true);
appIcon.requestAttention(myProject, false);
}
}
});
}
@Override
public void setText(final String text) {
super.setText(text);
updateProgressText();
}
@Override
public void setText2(final String text) {
super.setText2(text);
updateProgressText();
}
@Override
public void setFraction(final double fraction) {
super.setFraction(fraction);
updateProgressText();
GuiUtils.invokeLaterIfNeeded(() -> AppIcon.getInstance().setProgress(myProject, APP_ICON_ID, AppIconScheme.Progress.BUILD, fraction, true), ModalityState.any());
}
@Override
protected void onProgressChange() {
prepareMessageView();
}
});
}
use of com.intellij.ui.AppIcon in project intellij-community by JetBrains.
the class TestsUIUtil method showIconProgress.
public static void showIconProgress(Project project, int n, final int maximum, final int problemsCounter, boolean updateWithAttention) {
AppIcon icon = AppIcon.getInstance();
if (n < maximum || !updateWithAttention) {
if (!updateWithAttention || icon.setProgress(project, TESTS, AppIconScheme.Progress.TESTS, (double) n / (double) maximum, problemsCounter == 0)) {
if (problemsCounter > 0) {
icon.setErrorBadge(project, String.valueOf(problemsCounter));
}
}
} else {
if (icon.hideProgress(project, TESTS)) {
if (problemsCounter > 0) {
icon.setErrorBadge(project, String.valueOf(problemsCounter));
icon.requestAttention(project, false);
} else {
icon.setOkBadge(project, true);
icon.requestAttention(project, false);
}
}
}
}
Aggregations