當前位置: 首頁>>代碼示例>>Java>>正文


Java Notification.notify方法代碼示例

本文整理匯總了Java中com.intellij.notification.Notification.notify方法的典型用法代碼示例。如果您正苦於以下問題:Java Notification.notify方法的具體用法?Java Notification.notify怎麽用?Java Notification.notify使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.notification.Notification的用法示例。


在下文中一共展示了Notification.notify方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showNotification

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void showNotification(@NotNull DiffViewerBase viewer, @NotNull Notification notification) {
  JComponent component = viewer.getComponent();

  Window window = UIUtil.getWindow(component);
  if (window instanceof IdeFrame && NotificationsManagerImpl.findWindowForBalloon(viewer.getProject()) == window) {
    notification.notify(viewer.getProject());
    return;
  }

  Balloon balloon = NotificationsManagerImpl.createBalloon(component, notification, false, true);
  Disposer.register(viewer, balloon);

  Dimension componentSize = component.getSize();
  Dimension balloonSize = balloon.getPreferredSize();

  int width = Math.min(balloonSize.width, componentSize.width);
  int height = Math.min(balloonSize.height, componentSize.height);

  // top-right corner, 20px to the edges
  RelativePoint point = new RelativePoint(component, new Point(componentSize.width - 20 - width / 2, 20 + height / 2));
  balloon.show(point, Balloon.Position.above);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:AnnotateDiffViewerAction.java

示例2: showErrorNotification

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void showErrorNotification(@NotNull Project project, String message, String responseString) {
  final JsonObject details = new JsonParser().parse(responseString).getAsJsonObject();
  final String detailString = details.get("detail").getAsString();
  final Notification notification =
    new Notification("Push.course", message, detailString, NotificationType.ERROR);
  notification.notify(project);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:8,代碼來源:CCStepicConnector.java

示例3: showStepicNotification

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void showStepicNotification(@NotNull Project project,
                                           @NotNull NotificationType notificationType, @NotNull String failedActionName) {
  String text = "Log in to Stepik to " + failedActionName;
  Notification notification = new Notification("Stepik", "Failed to " + failedActionName, text, notificationType);
  notification.addAction(new AnAction("Log in") {

    @Override
    public void actionPerformed(AnActionEvent e) {
      EduStepicConnector.doAuthorize(() -> showOAuthDialog());
      notification.expire();
    }
  });

  notification.notify(project);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:16,代碼來源:CCStepicConnector.java

示例4: printToEventLog

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private void printToEventLog(String message) {
  NotificationGroup group = NotificationGroup.logOnlyGroup("typing-delay-stats");
  Notification notification = group.createNotification(message, NotificationType.INFORMATION);
  notification.setImportant(true);
  notification.notify(myEditor.getProject());
  notification.hideBalloon();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:ImmediatePainter.java

示例5: handleFileTooBigException

import com.intellij.notification.Notification; //導入方法依賴的package包/類
protected void handleFileTooBigException(Logger logger, FilesTooBigForDiffException e, @NotNull PsiFile file) {
  logger.info("Error while calculating changed ranges for: " + file.getVirtualFile(), e);
  if (!ApplicationManager.getApplication().isUnitTestMode()) {
    Notification notification = new Notification(ApplicationBundle.message("reformat.changed.text.file.too.big.notification.groupId"),
                                                 ApplicationBundle.message("reformat.changed.text.file.too.big.notification.title"),
                                                 ApplicationBundle.message("reformat.changed.text.file.too.big.notification.text", file.getName()),
                                                 NotificationType.INFORMATION);
    notification.notify(file.getProject());
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:AbstractLayoutCodeProcessor.java

示例6: updateCourse

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private void updateCourse() {
  final Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course == null) {
    return;
  }
  final File resourceDirectory = new File(course.getCourseDirectory());
  if (!resourceDirectory.exists()) {
    return;
  }
  StudyLanguageManager manager = StudyUtils.getLanguageManager(course);
  if (manager == null) {
    LOG.info("Study Language Manager is null for " + course.getLanguageById().getDisplayName());
    return;
  }
  final File[] files = resourceDirectory.listFiles();
  if (files == null) return;
  for (File file : files) {
    String testHelper = manager.getTestHelperFileName();
    if (file.getName().equals(testHelper)) {
      copyFile(file, new File(myProject.getBasePath(), testHelper));
    }
    if (file.getName().startsWith(EduNames.LESSON)) {
      final File[] tasks = file.listFiles();
      if (tasks == null) continue;
      for (File task : tasks) {
        final File taskDescr = new File(task, EduNames.TASK_HTML);
        String testFileName = manager.getTestFileName();
        final File taskTests = new File(task, testFileName);
        copyFile(taskDescr, new File(new File(new File(myProject.getBasePath(), file.getName()), task.getName()), EduNames.TASK_HTML));
        copyFile(taskTests, new File(new File(new File(myProject.getBasePath(), file.getName()), task.getName()),
                                     testFileName));
      }
    }
  }

  final Notification notification =
    new Notification("Update.course", "Course update", "Current course is synchronized", NotificationType.INFORMATION);
  notification.notify(myProject);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:StudyProjectComponent.java

示例7: showBalloon

import com.intellij.notification.Notification; //導入方法依賴的package包/類
public void showBalloon(@NotNull String title,
                        @NotNull String text,
                        @NotNull NotificationType type,
                        @NotNull NotificationGroup group,
                        @Nullable NotificationListener listener) {
  final Notification notification = group.createNotification(title, text, type, listener);
  Runnable notificationTask = new Runnable() {
    @Override
    public void run() {
      if (!myProject.isDisposed() && myProject.isOpen()) {
        Notification old = myNotification;
        if (old != null) {
          boolean similar = Objects.equal(notification.getContent(), old.getContent());
          if (similar) {
            old.expire();
          }
        }
        myNotification = notification;
        notification.notify(myProject);
      }
    }
  };
  Application application = ApplicationManager.getApplication();
  if (application.isDispatchThread()) {
    notificationTask.run();
  }
  else {
    application.invokeLater(notificationTask);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:31,代碼來源:AndroidGradleNotification.java

示例8: notifyUser

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void notifyUser(DataContext context, MavenProject mavenProject, MavenProject aggregator) {
  String aggregatorDescription = " (" + aggregator.getMavenId().getDisplayString() + ')';
  Notification notification = new Notification(MavenUtil.MAVEN_NOTIFICATION_GROUP, "Failed to remove project",
                                               "You can not remove " + mavenProject.getName() + " because it's " +
                                               "imported as a module of another project" +
                                               aggregatorDescription
                                               + ". You can use Ignore action. Only root project can be removed.",
                                               NotificationType.ERROR
  );

  notification.setImportant(true);
  notification.notify(MavenActionUtil.getProject(context));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:RemoveManagedFilesAction.java

示例9: notifyFailed

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void notifyFailed(Project project, String message) {
  Notification notification =
      NOTIFICATION_GROUP.createNotification(
          "Failed to add source file to project",
          message,
          NotificationType.WARNING,
          /* listener */ null);
  notification.notify(project);
}
 
開發者ID:bazelbuild,項目名稱:intellij,代碼行數:10,代碼來源:AddSourceToProjectHelper.java

示例10: showStepicNotification

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void showStepicNotification(@NotNull NotificationType notificationType, @NotNull String text) {
  Notification notification = new Notification("Stepik", "Stepik", text, notificationType);
  notification.notify(null);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:5,代碼來源:EduStepikRestService.java

示例11: showNotification

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private static void showNotification(@NotNull Project project, String message) {
  final Notification notification =
    new Notification("Push.course", message, message, NotificationType.INFORMATION);
  notification.notify(project);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:6,代碼來源:CCStepicConnector.java

示例12: notify

import com.intellij.notification.Notification; //導入方法依賴的package包/類
public void notify(String section, String title, String text, NotificationType type) {
    Notification notification = new Notification(section, title, text, type);
    notification.notify(ProjectManager.getInstance().getDefaultProject());
}
 
開發者ID:smelukov,項目名稱:intellij-basisjs-plugin,代碼行數:5,代碼來源:Notificator.java

示例13: showMessage

import com.intellij.notification.Notification; //導入方法依賴的package包/類
public Notification showMessage(String message, MessageType messageType, @Nullable NotificationListener listener) {
  NotificationGroup notificationGroup = NotificationGroup.balloonGroup(myNotificationDisplayId);
  Notification notification = notificationGroup.createNotification("", message, messageType.toNotificationType(), listener);
  notification.notify(null);
  return notification;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:7,代碼來源:CloudNotifier.java

示例14: applyNotification

import com.intellij.notification.Notification; //導入方法依賴的package包/類
private void applyNotification(@NotNull final Notification notification) {
  if (!myProject.isDisposed() && myProject.isOpen()) {
    notification.notify(myProject);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:6,代碼來源:ExternalSystemNotificationManager.java


注:本文中的com.intellij.notification.Notification.notify方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。