コード例 #1
0
 @Override
 public boolean runProcessWithProgressSynchronously(
     @NotNull final Task task, @Nullable final JComponent parentComponent) {
   final long start = System.currentTimeMillis();
   final boolean result = super.runProcessWithProgressSynchronously(task, parentComponent);
   if (result) {
     final long end = System.currentTimeMillis();
     final Task.NotificationInfo notificationInfo = task.notifyFinished();
     long time = end - start;
     if (notificationInfo != null
         && time > 5000) { // show notification only if process took more than 5 secs
       final JFrame frame = WindowManager.getInstance().getFrame(task.getProject());
       if (frame != null && !frame.hasFocus()) {
         systemNotify(notificationInfo);
       }
     }
   }
   return result;
 }
コード例 #2
0
 protected void showErrors(final CvsHandler handler, final CvsTabbedWindow tabbedWindow) {
   final List<VcsException> errors = handler.getErrorsExceptAborted();
   if (!myShowErrors || myIsQuietOperation) return;
   if (tabbedWindow == null) {
     if (errors.isEmpty()) return;
     final List<String> messages = new ArrayList<String>();
     for (VcsException error : errors) {
       if (!StringUtil.isEmptyOrSpaces(error.getMessage())) {
         messages.add(error.getMessage());
       }
     }
     final String errorMessage = StringUtil.join(messages, "\n");
     Messages.showErrorDialog(errorMessage, "CVS Error");
     return;
   }
   if (errors.isEmpty()) {
     tabbedWindow.hideErrors();
   } else {
     ErrorTreeView errorTreeView = tabbedWindow.getErrorsTreeView();
     for (final VcsException exception : errors) {
       final String groupName =
           DateFormatUtil.formatDateTime(System.currentTimeMillis()) + ' ' + handler.getTitle();
       if (exception.isWarning()) {
         errorTreeView.addMessage(
             MessageCategory.WARNING,
             exception.getMessages(),
             groupName,
             DummyNavigatable.INSTANCE,
             null,
             null,
             exception);
       } else {
         errorTreeView.addMessage(
             MessageCategory.ERROR,
             exception.getMessages(),
             groupName,
             DummyNavigatable.INSTANCE,
             null,
             null,
             exception);
       }
     }
     tabbedWindow.ensureVisible(myProject);
   }
 }