当前位置: 首页>>代码示例>>Java>>正文


Java Notification类代码示例

本文整理汇总了Java中com.intellij.notification.Notification的典型用法代码示例。如果您正苦于以下问题:Java Notification类的具体用法?Java Notification怎么用?Java Notification使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Notification类属于com.intellij.notification包,在下文中一共展示了Notification类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initComponent

import com.intellij.notification.Notification; //导入依赖的package包/类
@Override
public void initComponent() {
    MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    connection = bus.connect();

    ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerListener() {
        @Override
        public void projectOpened(Project project) {
            Config config = Config.getInstance(project);

            if(config == null) {
                return;
            }

            if(!config.isConfigFilled()) {
                Notifications.Bus.notify(
                        new Notification("Settings Error", "Gherkin TS Runner", "Settings have to be filled.", NotificationType.WARNING)
                );
                return;
            }

            connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new GherkinFileEditorManagerListener(project));
        }
    });

}
 
开发者ID:KariiO,项目名称:Gherkin-TS-Runner,代码行数:27,代码来源:MainComponent.java

示例2: showDiscountOffer

import com.intellij.notification.Notification; //导入依赖的package包/类
private void showDiscountOffer(final Project project) {
    final PropertiesComponent properties = PropertiesComponent.getInstance();
    final long lastNotificationTime = properties.getOrInitLong(LAST_DISCOUNT_OFFER_TIME_PROPERTY, 0);
    final long currentTime = System.currentTimeMillis();

    if (currentTime - lastNotificationTime >= DateFormatUtil.MONTH) {
        properties.setValue(LAST_DISCOUNT_OFFER_TIME_PROPERTY, String.valueOf(currentTime));

        final Notification notification = notificationGroup.createNotification(
            HybrisI18NBundleUtils.message("evaluation.license.discount.offer.bubble.title"),
            HybrisI18NBundleUtils.message("evaluation.license.discount.offer.bubble.text"),
            NotificationType.INFORMATION,
            (myNotification, myHyperlinkEvent) -> goToDiscountOffer(myHyperlinkEvent)
        );
        notification.setImportant(true);
        Notifications.Bus.notify(notification, project);

        ApplicationManager.getApplication().invokeLater(() -> {
            if (!notificationClosingAlarm.isDisposed()) {
                notificationClosingAlarm.addRequest(notification::hideBalloon, 3000);
            }
        });

    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:26,代码来源:HybrisProjectManagerListener.java

示例3: projectOpened

import com.intellij.notification.Notification; //导入依赖的package包/类
@Override
public void projectOpened() {
  ApplicationManager.getApplication().invokeLater((DumbAwareRunnable)() -> ApplicationManager.getApplication().runWriteAction(
    (DumbAwareRunnable)() -> {
      if (PropertiesComponent.getInstance().getBoolean(ourShowPopup, true)) {
        final String content = "<html>If you'd like to learn more about PyCharm Edu, " +
                               "click <a href=\"https://www.jetbrains.com/pycharm-edu/quickstart/\">here</a> to watch a tutorial</html>";
        final Notification notification = new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION,
                                                           new NotificationListener.UrlOpeningListener(true));
        StartupManager.getInstance(myProject).registerPostStartupActivity(() -> Notifications.Bus.notify(notification));
        Balloon balloon = notification.getBalloon();
        if (balloon != null) {
          balloon.addListener(new JBPopupAdapter() {
            @Override
            public void onClosed(LightweightWindowEvent event) {
              notification.expire();
            }
          });
        }
        notification.whenExpired(() -> PropertiesComponent.getInstance().setValue(ourShowPopup, false, true));
      }
    }));
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:24,代码来源:PyStudyShowTutorial.java

示例4: createChat

import com.intellij.notification.Notification; //导入依赖的package包/类
private void createChat(MMUserStatus user) throws IOException, URISyntaxException {
    Channel.ChannelData channel = client.createChat(user.userId());
    if (channel == null) {
        Notifications.Bus.notify(new Notification("mattermost", "channel error", "no channel found for " + user.username(), NotificationType.ERROR));
        return;
    }
    SwingUtilities.invokeLater(() -> {
        String name = user.username();
        Chat chat = this.channelIdChatMap.computeIfAbsent(channel.getId(), k -> new Chat());
        chat.channelId = channel.getId();
        if (this.toolWindow.getContentManager().getContent(chat) == null) {
            Content messages = ContentFactory.SERVICE.getInstance().createContent(chat, name, false);
            messages.setIcon(TEAM);
            this.toolWindow.getContentManager().addContent(messages);
            this.toolWindow.getContentManager().setSelectedContent(messages);
        } else {
            Content c = this.toolWindow.getContentManager().getContent(chat);
            this.toolWindow.getContentManager().setSelectedContent(c);
        }
        SwingUtilities.invokeLater(chat.inputArea::grabFocus);
    });
}
 
开发者ID:stefandotti,项目名称:intellij-mattermost-plugin,代码行数:23,代码来源:MattermostClientWindow.java

示例5: addToolsJar

import com.intellij.notification.Notification; //导入依赖的package包/类
static void addToolsJar( @NotNull ModifiableRootModel rootModel )
{
  if( hasToolsJar( rootModel ) )
  {
    return;
  }

  VirtualFile toolsJarFile = findToolsJarFile( rootModel.getProject() );
  if( toolsJarFile == null )
  {
    Notifications.Bus.notify( new Notification( "Project JDK", "tools.jar not found!", "Please add tools.jar to your JDK", NotificationType.ERROR ) );
    return;
  }

  SdkModificator sdkModificator = rootModel.getSdk().getSdkModificator();
  sdkModificator.addRoot( toolsJarFile, OrderRootType.CLASSES );
  sdkModificator.commitChanges();
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:19,代码来源:ManSupportProvider.java

示例6: notifyEnableMessage

import com.intellij.notification.Notification; //导入依赖的package包/类
public static void notifyEnableMessage(@NotNull final Project project) {
    Notification notification = new Notification("Grav Plugin", "Grav Plugin",
            "<a href=\"enable\">Enable</a> the Grav Plugin now, or open <a href=\"config\">Project Settings</a>. <br/>" +
                    "<a href=\"dismiss\">Do not</a> ask again.", NotificationType.INFORMATION, (notification1, event) -> {
        // handle html click events
        if ("config".equals(event.getDescription())) {
            // open settings dialog and show panel
            GravProjectConfigurable.show(project);
        } else if ("enable".equals(event.getDescription())) {
            enablePluginAndConfigure(project);
            Notifications.Bus.notify(new Notification("Grav Plugin", "Grav Plugin", "Plugin enabled", NotificationType.INFORMATION), project);
        } else if ("dismiss".equals(event.getDescription())) {
            // user dont want to show notification again
            GravProjectSettings.getInstance(project).dismissEnableNotification = true;
        }
        notification1.expire();
    });

    Notifications.Bus.notify(notification, project);
}
 
开发者ID:PioBeat,项目名称:GravSupport,代码行数:21,代码来源:IdeHelper.java

示例7: 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

示例8: validateLocale

import com.intellij.notification.Notification; //导入依赖的package包/类
@Nullable
private Notification validateLocale() throws SvnBindException {
  ProcessOutput versionOutput = getVersionClient().runCommand(false);
  Notification result = null;

  Matcher matcher = INVALID_LOCALE_WARNING_PATTERN.matcher(versionOutput.getStderr());
  if (matcher.find()) {
    LOG.info(matcher.group());

    result = new ExecutableNotValidNotification(prepareDescription(UIUtil.getHtmlBody(matcher.group()), false), NotificationType.WARNING);
  }
  else if (!isEnglishOutput(versionOutput.getStdout())) {
    LOG.info("\"svn --version\" command contains non-English output " + versionOutput.getStdout());

    result = new ExecutableNotValidNotification(prepareDescription(SvnBundle.message("non.english.locale.detected.warning"), false),
                                                NotificationType.WARNING);
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SvnExecutableChecker.java

示例9: notifyOnPowerSaveMode

import com.intellij.notification.Notification; //导入依赖的package包/类
static void notifyOnPowerSaveMode(Project project) {
  if (PropertiesComponent.getInstance().getBoolean(IGNORE_POWER_SAVE_MODE)) {
    return;
  }
  
  String message = "Code insight and other background tasks are disabled." +
                   "<br/><a href=\"ignore\">Do not show again</a>" +
                   "<br/><a href=\"turnOff\">Disable Power Save Mode</a>";
  POWER_SAVE_MODE.createNotification("Power save mode is on", message, NotificationType.WARNING, new NotificationListener() {
    @Override
    public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
      final String description = event.getDescription();
      if ("ignore".equals(description)) {
        PropertiesComponent.getInstance().setValue(IGNORE_POWER_SAVE_MODE, true);
        notification.expire();
      }
      else if ("turnOff".equals(description)) {
        PowerSaveMode.setEnabled(false);
        notification.expire();
      }
    }
  }).notify(project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:PowerSaveModeNotifier.java

示例10: createNotification

import com.intellij.notification.Notification; //导入依赖的package包/类
@NonNull
@Override
public Notification createNotification(@NotNull final String groupDisplayId,
                                       @Nullable NotificationListener listener) {
  final String fullProductName = ApplicationNamesInfo.getInstance().getFullProductName();
  final String companyName = ApplicationInfo.getInstance().getCompanyName();

  String text =
    "<html>Please click <a href='allow'>I agree</a> if you want to help make " + fullProductName +
    " better or <a href='decline'>I don't agree</a> otherwise. <a href='settings'>more...</a></html>";

  String title = "Help improve " + fullProductName + " by sending usage statistics to " + companyName;

  return new Notification(groupDisplayId, title,
                          text,
                          NotificationType.INFORMATION,
                          listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:AndroidStatisticsService.java

示例11: hyperlinkActivated

import com.intellij.notification.Notification; //导入依赖的package包/类
@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
  if (event.getDescription().equals("configure") && !myProject.isDisposed()) {
    ShowSettingsUtil.getInstance().showSettingsDialog(myProject, ActionsBundle.message("group.VcsGroup.text"));
    Collection<VcsRootError> errorsAfterPossibleFix = getInstance(myProject).scan();
    if (errorsAfterPossibleFix.isEmpty() && !notification.isExpired()) {
      notification.expire();
    }
  }
  else if (event.getDescription().equals("ignore")) {
    mySettings.addIgnoredUnregisteredRoots(ContainerUtil.map(myImportantUnregisteredRoots, PATH_FROM_ROOT_ERROR));
    notification.expire();
  }
  else if (event.getDescription().equals("add")) {
    List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
    for (VcsRootError root : myImportantUnregisteredRoots) {
      mappings = VcsUtil.addMapping(mappings, root.getMapping(), root.getVcsKey().getName());
    }
    myVcsManager.setDirectoryMappings(mappings);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsRootProblemNotifier.java

示例12: onThreadBlocked

import com.intellij.notification.Notification; //导入依赖的package包/类
private void onThreadBlocked(@NotNull final ThreadReference blockedThread,
                             @NotNull final ThreadReference blockingThread,
                             final DebugProcessImpl process) {
  XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(
    DebuggerBundle.message("status.thread.blocked.by", blockedThread.name(), blockingThread.name()),
    DebuggerBundle.message("status.thread.blocked.by.resume", blockingThread.name()),
    NotificationType.INFORMATION, new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          notification.expire();
          process.getManagerThread().schedule(new DebuggerCommandImpl() {
            @Override
            protected void action() throws Exception {
              ThreadReferenceProxyImpl threadProxy = process.getVirtualMachineProxy().getThreadReferenceProxy(blockingThread);
              SuspendContextImpl suspendingContext = SuspendManagerUtil.getSuspendingContext(process.getSuspendManager(), threadProxy);
              process.getManagerThread()
                .invoke(process.createResumeThreadCommand(suspendingContext, threadProxy));
            }
          });
        }
      }
    }).notify(process.getProject());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ThreadBlockedMonitor.java

示例13: validate

import com.intellij.notification.Notification; //导入依赖的package包/类
@Override
@Nullable
protected Notification validate(@NotNull String executable) {
  Notification result = createDefaultNotification();

  // Necessary executable path will be taken from settings while command execution
  final Version version = getConfiguredClientVersion();
  if (version != null) {
    try {
      result = validateVersion(version);

      if (result == null) {
        result = validateLocale();
      }
    }
    catch (Throwable e) {
      LOG.info(e);
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:SvnExecutableChecker.java

示例14: notifyUnresolvedRemain

import com.intellij.notification.Notification; //导入依赖的package包/类
@Override
protected void notifyUnresolvedRemain() {
  VcsNotifier.getInstance(myProject).notifyImportantWarning("Conflicts were not resolved during unstash",
                                                            "Unstash is not complete, you have unresolved merges in your working tree<br/>" +
                                                            "<a href='resolve'>Resolve</a> conflicts.", new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          if (event.getDescription().equals("resolve")) {
            new UnstashConflictResolver(myProject, myRoot, myStashInfo).mergeNoProceed();
          }
        }
      }
    }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GitUnstashDialog.java

示例15: notifyUser

import com.intellij.notification.Notification; //导入依赖的package包/类
public static void notifyUser(String message) {
  final String logFile = PathManager.getLogPath();
  /*String createIssuePart = "<br>" +
                           "<br>" +
                           "Please attach log files from <a href=\"file\">" + logFile + "</a><br>" +
                           "to the <a href=\"url\">YouTrack issue</a>";*/
  Notifications.Bus.notify(new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
                                            "Local History is broken",
                                            message /*+ createIssuePart*/,
                                            NotificationType.ERROR,
                                            new NotificationListener() {
                                              @Override
                                              public void hyperlinkUpdate(@NotNull Notification notification,
                                                                          @NotNull HyperlinkEvent event) {
                                                if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                                                  if ("url".equals(event.getDescription())) {
                                                    BrowserUtil.browse("http://youtrack.jetbrains.net/issue/IDEA-71270");
                                                  }
                                                  else {
                                                    File file = new File(logFile);
                                                    ShowFilePathAction.openFile(file);
                                                  }
                                                }
                                              }
                                            }), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ChangeListStorageImpl.java


注:本文中的com.intellij.notification.Notification类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。