本文整理匯總了Java中com.intellij.notification.NotificationType類的典型用法代碼示例。如果您正苦於以下問題:Java NotificationType類的具體用法?Java NotificationType怎麽用?Java NotificationType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NotificationType類屬於com.intellij.notification包,在下文中一共展示了NotificationType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: extractResponse
import com.intellij.notification.NotificationType; //導入依賴的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;
}
示例2: initComponent
import com.intellij.notification.NotificationType; //導入依賴的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));
}
});
}
示例3: scanAndUpdate
import com.intellij.notification.NotificationType; //導入依賴的package包/類
/**
* Scan and update dependency components.
*/
private void scanAndUpdate(boolean quickScan, ProgressIndicator indicator, @Nullable Collection<DataNode<LibraryDependencyData>> libraryDependencies) {
// Don't scan if Xray is not configured
if (!GlobalSettings.getInstance().isCredentialsSet()) {
Utils.notify(logger, "JFrog Xray scan failed", "Xray server is not configured.", NotificationType.ERROR);
return;
}
// Prevent multiple simultaneous scans
if (!scanInProgress.compareAndSet(false, true)) {
if (!quickScan) {
Utils.notify(logger, "JFrog Xray", "Scan already in progress.", NotificationType.INFORMATION);
}
return;
}
try {
// Refresh dependencies -> Collect -> Scan and store to cache -> Update view
refreshDependencies(getRefreshDependenciesCbk(quickScan, indicator), libraryDependencies);
} finally {
scanInProgress.set(false);
}
}
示例4: notifyImportFinished
import com.intellij.notification.NotificationType; //導入依賴的package包/類
private void notifyImportFinished(@NotNull Project project) {
final String notificationName = refresh
? message("project.refresh.finished")
: message("project.import.finished");
final String notificationTitle = refresh
? message("project.refresh.notification.title")
: message("project.import.notification.title");
NotificationUtil.NOTIFICATION_GROUP.createNotification(
notificationTitle,
notificationName,
NotificationType.INFORMATION,
null
).notify(project);
showSystemNotificationIfNotActive(project, notificationName, notificationTitle, notificationName);
}
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:20,代碼來源:DefaultHybrisProjectImportBuilder.java
示例5: showDiscountOffer
import com.intellij.notification.NotificationType; //導入依賴的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
示例6: projectOpened
import com.intellij.notification.NotificationType; //導入依賴的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));
}
}));
}
示例7: createChat
import com.intellij.notification.NotificationType; //導入依賴的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);
});
}
示例8: addToolsJar
import com.intellij.notification.NotificationType; //導入依賴的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();
}
示例9: notifyEnableMessage
import com.intellij.notification.NotificationType; //導入依賴的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);
}
示例10: checkFsSanity
import com.intellij.notification.NotificationType; //導入依賴的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);
}
}
示例11: createNotification
import com.intellij.notification.NotificationType; //導入依賴的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);
}
示例12: doNotify
import com.intellij.notification.NotificationType; //導入依賴的package包/類
private static void doNotify(@NotNull final Set<String> macros, @NotNull final Project project,
@NotNull final Map<TrackingPathMacroSubstitutor, IComponentStore> substitutorToStore) {
String format = "<p><i>%s</i> %s undefined. <a href=\"define\">Fix it</a></p>";
String productName = ApplicationNamesInfo.getInstance().getProductName();
String content = String.format(format, StringUtil.join(macros, ", "), macros.size() == 1 ? "is" : "are") +
"<br>Path variables are used to substitute absolute paths " +
"in " + productName + " project files " +
"and allow project file sharing in version control systems.<br>" +
"Some of the files describing the current project settings contain unknown path variables " +
"and " + productName + " cannot restore those paths.";
new UnknownMacroNotification("Load Error", "Load error: undefined path variables", content, NotificationType.ERROR,
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
checkUnknownMacros(project, true, macros, substitutorToStore);
}
}, macros).notify(project);
}
示例13: apply
import com.intellij.notification.NotificationType; //導入依賴的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();
}
示例14: reportResult
import com.intellij.notification.NotificationType; //導入依賴的package包/類
private String reportResult(GeneralCommitProcessor processor) {
final List<Change> changesFailedToCommit = processor.getChangesFailedToCommit();
int failed = changesFailedToCommit.size();
int committed = myIncludedChanges.size() - failed;
String text = committed + " " + StringUtil.pluralize("file", committed) + " committed";
if (failed > 0) {
text += ", " + failed + " " + StringUtil.pluralize("file", failed) + " failed to commit";
}
StringBuilder content = new StringBuilder(StringUtil.isEmpty(myCommitMessage) ? text : text + ": " + escape(myCommitMessage));
for (String s : myFeedback) {
content.append("\n");
content.append(s);
}
NotificationType notificationType = resolveNotificationType(processor);
VcsBalloonProblemNotifier.NOTIFICATION_GROUP.createNotification(content.toString(), notificationType).notify(myProject);
return text;
}
示例15: showPopupWithDetails
import com.intellij.notification.NotificationType; //導入依賴的package包/類
public void showPopupWithDetails(String message,
String title,
String details,
NotificationType notificationType) {
Project currentProject = new ObjectFinder().findCurrentProject();
Icon icon = iconForNotificationType(notificationType);
ApplicationManager.getApplication().invokeLater(() -> Messages.showDialog(
currentProject,
message,
title,
details,
new String[] { Messages.OK_BUTTON },
0,
0,
icon
));
}