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


Java Notifications类代码示例

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


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

示例1: extractResponse

import com.intellij.notification.Notifications; //导入依赖的package包/类
@Nullable
private JsonNode extractResponse(JsonNode merlinResult) {
    // !! handle notifications

    JsonNode classField = merlinResult.get("class");
    if (classField == null) {
        return null;
    }
    JsonNode value = merlinResult.get("value");

    String responseType = classField.textValue();
    if ("return".equals(responseType)) {
        return value;
    }

    // Something went wrong with merlin, it can be: failure|error|exception
    // https://github.com/ocaml/merlin/blob/master/doc/dev/PROTOCOL.md#answers
    if ("error".equals(responseType)) {
        Notifications.Bus.notify(new RmlNotification("Merlin", responseType, value.toString(), NotificationType.ERROR, null));
    }

    // failure or error should not be reported to the user
    return null;
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:25,代码来源:MerlinProcess3.java

示例2: initComponent

import com.intellij.notification.Notifications; //导入依赖的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

示例3: showDiscountOffer

import com.intellij.notification.Notifications; //导入依赖的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

示例4: projectOpened

import com.intellij.notification.Notifications; //导入依赖的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

示例5: createChat

import com.intellij.notification.Notifications; //导入依赖的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

示例6: addToolsJar

import com.intellij.notification.Notifications; //导入依赖的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

示例7: notifyEnableMessage

import com.intellij.notification.Notifications; //导入依赖的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

示例8: apply

import com.intellij.notification.Notifications; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
    try {
        PropertiesComponent.getInstance().setValue(KEY_RULES_PATH, rulesPath.getText());
        if (!TextUtils.isEmpty(rulesPath.getText())) {
            load(rulesPath.getText());
            DirectiveLint.prepare();
        } else {
            DirectiveLint.reset();
        }
    } catch (Exception e) {
        ProjectUtil.guessCurrentProject(select).getMessageBus().syncPublisher(Notifications.TOPIC).notify(
                new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID,
                        "Weex language support - bad rules",
                        e.toString(),
                        NotificationType.ERROR));
    }
    savePaths();
}
 
开发者ID:misakuo,项目名称:weex-language-support,代码行数:20,代码来源:Settings.java

示例9: notifyUser

import com.intellij.notification.Notifications; //导入依赖的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

示例10: setSelected

import com.intellij.notification.Notifications; //导入依赖的package包/类
@Override
public void setSelected(AnActionEvent e, boolean state) {
  if (state) {
    if (myInspector == null) {
      myInspector = new UiInspector();
    }

    UiInspectorNotification[] existing =
      NotificationsManager.getNotificationsManager().getNotificationsOfType(UiInspectorNotification.class, null);
    if (existing.length == 0) {
      Notifications.Bus.notify(new UiInspectorNotification(), null);
    }
  }
  else {
    UiInspector inspector = myInspector;
    myInspector = null;
    if (inspector != null) {
      Disposer.dispose(inspector);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:UiInspectorAction.java

示例11: checkFsSanity

import com.intellij.notification.Notifications; //导入依赖的package包/类
private void checkFsSanity() {
  try {
    String path = myProject.getProjectFilePath();
    if (path == null || FileUtil.isAncestor(PathManager.getConfigPath(), path, true)) {
      return;
    }

    boolean actual = FileUtil.isFileSystemCaseSensitive(path);
    LOG.info(path + " case-sensitivity: " + actual);
    if (actual != SystemInfo.isFileSystemCaseSensitive) {
      int prefix = SystemInfo.isFileSystemCaseSensitive ? 1 : 0;  // IDE=true -> FS=false -> prefix='in'
      String title = ApplicationBundle.message("fs.case.sensitivity.mismatch.title");
      String text = ApplicationBundle.message("fs.case.sensitivity.mismatch.message", prefix);
      Notifications.Bus.notify(
        new Notification(Notifications.SYSTEM_MESSAGES_GROUP_ID, title, text, NotificationType.WARNING, NotificationListener.URL_OPENING_LISTENER),
        myProject);
    }
  }
  catch (FileNotFoundException e) {
    LOG.warn(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StartupManagerImpl.java

示例12: actionPerformed

import com.intellij.notification.Notifications; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  Notifications.Bus.notify(new Notification("Android", "ADB", "ADB requested.", NotificationType.INFORMATION));
  Project project = getEventProject(e);
  File adb = project == null ? null : AndroidSdkUtils.getAdb(project);
  if (adb == null) {
    return;
  }

  ListenableFuture<AndroidDebugBridge> bridge = AdbService.getInstance().getDebugBridge(adb);
  Futures.addCallback(bridge, new FutureCallback<AndroidDebugBridge>() {
    @Override
    public void onSuccess(AndroidDebugBridge result) {
      Notifications.Bus.notify(new Notification("Android", "ADB", "ADB obtained", NotificationType.INFORMATION));
    }

    @Override
    public void onFailure(Throwable t) {
      Notifications.Bus.notify(new Notification("Android", "ADB", "ADB error: " + t.toString(), NotificationType.INFORMATION));
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GetAdbAction.java

示例13: testNotifications

import com.intellij.notification.Notifications; //导入依赖的package包/类
public void testNotifications() throws Exception {

    final Ref<Notification> notificationRef = new Ref<Notification>();
    getProject().getMessageBus().connect(getTestRootDisposable()).subscribe(Notifications.TOPIC, new NotificationsAdapter() {
      @Override
      public void notify(@NotNull Notification notification) {
        notificationRef.set(notification);
      }
    });

    TestRepository repository = new TestRepository() {
      @Override
      public Task[] getIssues(@Nullable String query, int max, long since) throws Exception {
        throw new Exception();
      }
    };
    ((TaskManagerImpl)myTaskManager).setRepositories(Collections.singletonList(repository));

    myTaskManager.updateIssues(null);

    assertNull(notificationRef.get());

    myTaskManager.getIssues("");

    assertNotNull(notificationRef.get());
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:TaskManagerTest.java

示例14: activate

import com.intellij.notification.Notifications; //导入依赖的package包/类
public void activate() {
  if (SystemInfo.isWindows) {
    if (!SVNJNAUtil.isJNAPresent()) {
      Notifications.Bus.notify(new Notification(myVcs.getDisplayName(), "Subversion plugin: no JNA",
                                                "A problem with JNA initialization for SVNKit library. Encryption is not available.",
                                                NotificationType.WARNING), myProject);
    }
    else if (!SVNJNAUtil.isWinCryptEnabled()) {
      Notifications.Bus.notify(new Notification(myVcs.getDisplayName(), "Subversion plugin: no encryption",
                                                "A problem with encryption module (Crypt32.dll) initialization for SVNKit library. " +
                                                "Encryption is not available.",
                                                NotificationType.WARNING
      ), myProject);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnKitManager.java

示例15: actionPerformed

import com.intellij.notification.Notifications; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  List<String> fileNames = findTestDataFiles(dataContext);
  if (fileNames == null || fileNames.isEmpty()) {
    String testData = guessTestData(dataContext);
    if (testData == null) {
      String message = "Cannot find testdata files for class";
      final Notification notification = new Notification("testdata", "Found no testdata files", message, NotificationType.INFORMATION);
      Notifications.Bus.notify(notification, project);
      return;
    }
    fileNames = Collections.singletonList(testData);
  }

  final Editor editor = e.getData(CommonDataKeys.EDITOR);
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  final RelativePoint point = editor != null ? popupFactory.guessBestPopupLocation(editor) : popupFactory.guessBestPopupLocation(dataContext);

  TestDataNavigationHandler.navigate(point, fileNames, project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:NavigateToTestDataAction.java


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