Java Code Examples for com.intellij.notification.NotificationType#INFORMATION

The following examples show how to use com.intellij.notification.NotificationType#INFORMATION . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerMessageHandler.java    From intellij-quarkus with Eclipse Public License 2.0 6 votes vote down vote up
private static NotificationType messageTypeToNotificationType(MessageType type) {
    NotificationType result = null;

    switch (type) {
        case Error:
            result = NotificationType.ERROR;
            break;
        case Info:
        case Log:
            result = NotificationType.INFORMATION;
            break;
        case Warning:
            result = NotificationType.WARNING;
    }
    return result;
}
 
Example 2
Source File: IncrementalSyncProjectAction.java    From intellij with Apache License 2.0 6 votes vote down vote up
private static void showPopupNotification(Project project) {
  String message =
      String.format(
          "Some relevant files (e.g. BUILD files, .blazeproject file) "
              + "have changed since the last sync. "
              + "Please press the 'Sync' button in the toolbar to re-sync your %s project.",
          ApplicationNamesInfo.getInstance().getFullProductName());
  Notification notification =
      new Notification(
          NOTIFICATION_GROUP.getDisplayId(),
          String.format("Changes since last %s sync", Blaze.buildSystemName(project)),
          message,
          NotificationType.INFORMATION);
  notification.setImportant(true);
  Notifications.Bus.notify(notification, project);
}
 
Example 3
Source File: ProjectOpenActivity.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public PackagesOutOfDateNotification(@NotNull Project project, @NotNull PubRoot root) {
  super("Flutter Packages", FlutterIcons.Flutter, "Flutter pub get.",
        null, "The pubspec.yaml file has been modified since " +
              "the last time 'flutter pub get' was run.",
        NotificationType.INFORMATION, null);

  myProject = project;
  myRoot = root;

  addAction(new AnAction("Run 'flutter pub get'") {
    @Override
    public void actionPerformed(@NotNull AnActionEvent event) {
      expire();

      final FlutterSdk sdk = FlutterSdk.getFlutterSdk(project);
      if (sdk == null) {
        Messages.showErrorDialog(project, "Flutter SDK not found", "Error");
        return;
      }

      if (sdk.startPubGet(root, project) == null) {
        Messages.showErrorDialog("Unable to run 'flutter pub get'", "Error");
      }
    }
  });
}
 
Example 4
Source File: ProjectRefreshListener.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Template came from maven plugin:
 * https://github.com/JetBrains/intellij-community/blob/b5d046018b9a82fccd86bc9c1f1da2e28068440a/plugins/maven/src/main/java/org/jetbrains/idea/maven/utils/MavenImportNotifier.java#L92-L108
 */
static void notify(Project project) {
  if(hasExistingRefreshNotification(project)){
    return;
  }

  Notification notification = new Notification(
    PantsConstants.PANTS,
    NOTIFICATION_TITLE,
    "<a href='refresh'>" + NOTIFICATION_BUTTON_TITLE + "</a> ",
    NotificationType.INFORMATION,
    new ProjectRefreshListener(project)
  );

  notification.notify(project);
}
 
Example 5
Source File: IdeHelper.java    From idea-php-laravel-plugin with MIT License 6 votes vote down vote up
public static void notifyEnableMessage(final Project project) {
    Notification notification = new Notification("Laravel Plugin", "Laravel Plugin", "Enable the Laravel Plugin <a href=\"enable\">with auto configuration now</a>, open <a href=\"config\">Project Settings</a> or <a href=\"dismiss\">dismiss</a> further messages", NotificationType.INFORMATION, (notification1, event) -> {
        // handle html click events
        if("config".equals(event.getDescription())) {

            // open settings dialog and show panel
            LaravelProjectSettingsForm.show(project);
        } else if("enable".equals(event.getDescription())) {
            enablePluginAndConfigure(project);
            Notifications.Bus.notify(new Notification("Laravel Plugin", "Laravel Plugin", "Plugin enabled", NotificationType.INFORMATION), project);
        } else if("dismiss".equals(event.getDescription())) {
            // user dont want to show notification again
            LaravelSettings.getInstance(project).dismissEnableNotification = true;
        }

        notification1.expire();
    });

    Notifications.Bus.notify(notification, project);
}
 
Example 6
Source File: InitialConfigurationProjectManagerListener.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
private void displayNewUserNotification(Project project, GoogleJavaFormatSettings settings) {
  Notification notification =
      new Notification(
          NOTIFICATION_GROUP.getDisplayId(),
          NOTIFICATION_TITLE,
          "The google-java-format plugin is disabled by default. "
              + "<a href=\"enable\">Enable for this project</a>.",
          NotificationType.INFORMATION,
          (n, e) -> {
            settings.setEnabled(true);
            n.expire();
          });
  notification.notify(project);
}
 
Example 7
Source File: IdeHelper.java    From idea-php-typo3-plugin with MIT License 5 votes vote down vote up
/**
 * @author Daniel Espendiller <[email protected]>
 */
public static void notifyEnableMessage(final Project project) {
    Notification notification = new Notification(
        "TYPO3 CMS Plugin",
        "TYPO3 CMS Plugin",
        "Enable the TYPO3 CMS Plugin <a href=\"enable\">with auto configuration now</a>, open <a href=\"config\">Project Settings</a> or <a href=\"dismiss\">dismiss</a> further messages",
        NotificationType.INFORMATION,
        (notification1, event) -> {
            // handle html click events
            if ("config".equals(event.getDescription())) {
                // open settings dialog and show panel
                TYPO3CMSProjectSettings.showSettings(project);
            } else if ("enable".equals(event.getDescription())) {
                enablePluginAndConfigure(project);

                Notifications.Bus.notify(new Notification("TYPO3 CMS Plugin", "TYPO3 CMS Plugin", "Plugin enabled", NotificationType.INFORMATION), project);
            } else if ("dismiss".equals(event.getDescription())) {
                // user doesn't want to show notification again
                TYPO3CMSProjectSettings.getInstance(project).dismissEnableNotification = true;
            }

            notification1.expire();
        }
    );

    Notifications.Bus.notify(notification, project);
}
 
Example 8
Source File: GraphQLRelayModernEnableStartupActivity.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
@Override
public void runActivity(@NotNull Project project) {
    final GraphQLSettings settings = GraphQLSettings.getSettings(project);
    if (settings.isEnableRelayModernFrameworkSupport()) {
        // already enabled Relay Modern
        return;
    }
    try {
        final GlobalSearchScope scope = GlobalSearchScope.projectScope(project);
        for (VirtualFile virtualFile : FilenameIndex.getVirtualFilesByName(project, "package.json", scope)) {
            if (!virtualFile.isDirectory() && virtualFile.isInLocalFileSystem()) {
                try (InputStream inputStream = virtualFile.getInputStream()) {
                    final String packageJson = IOUtils.toString(inputStream, virtualFile.getCharset());
                    if (packageJson.contains("\"react-relay\"") || packageJson.contains("\"relay-compiler\"")) {
                        final Notification enableRelayModern = new Notification("GraphQL", "Relay Modern project detected", "<a href=\"enable\">Enable Relay Modern</a> GraphQL tooling", NotificationType.INFORMATION, (notification, event) -> {
                            settings.setEnableRelayModernFrameworkSupport(true);
                            ApplicationManager.getApplication().saveSettings();
                            notification.expire();
                            DaemonCodeAnalyzer.getInstance(project).restart();
                            EditorNotifications.getInstance(project).updateAllNotifications();
                        });
                        enableRelayModern.setImportant(true);
                        Notifications.Bus.notify(enableRelayModern);
                        break;
                    }
                }
            }
        }
    } catch (Exception e) {
        log.error("Unable to detect Relay Modern", e);
    }
}
 
Example 9
Source File: GaugeNotification.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
public NotificationType getType() {
    switch (type) {
        case "error":
            return NotificationType.ERROR;
        case "warning":
            return NotificationType.WARNING;
        case "info":
            return NotificationType.INFORMATION;
        default:
            return NotificationType.INFORMATION;

    }

}
 
Example 10
Source File: ConsoleLogModel.java    From aem-ide-tooling-4-intellij with Apache License 2.0 5 votes vote down vote up
void addNotification(Notification notification) {
    long stamp = System.currentTimeMillis();
    if(myProject != null) {
        SlingServerTreeSelectionHandler selectionHandler = ComponentProvider.getComponent(myProject, SlingServerTreeSelectionHandler.class);
        if(selectionHandler != null) {
            ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration();
            ServerConfiguration.LogFilter logFilter = serverConfiguration != null ? serverConfiguration.getLogFilter() : ServerConfiguration.LogFilter.info;
            switch(logFilter) {
                case debug:
                    add(notification);
                    break;
                case info:
                    if(!(notification instanceof DebugNotification)) {
                        add(notification);
                    }
                    break;
                case warning:
                    if(notification.getType() != NotificationType.INFORMATION) {
                        add(notification);
                    }
                    break;
                case error:
                default:
                    if(notification.getType() == NotificationType.ERROR) {
                        add(notification);
                    }
                    break;
            }
        }
        myStamps.put(notification, stamp);
        myStatuses.put(notification, ConsoleLog.formatForLog(notification, "").status);
        setStatusMessage(notification, stamp);
        fireModelChanged();
    }
}
 
Example 11
Source File: FlutterMessages.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void showInfo(String title, String message) {
  final Notification notification = new Notification(
    FLUTTER_NOTIFICATION_GROUP_ID,
    title,
    message,
    NotificationType.INFORMATION);
  notification.setIcon(FlutterIcons.Flutter);
  Notifications.Bus.notify(notification);
}
 
Example 12
Source File: AbstractLayoutCodeProcessor.java    From consulo with Apache License 2.0 5 votes vote down vote up
void handleFileTooBigException(Logger logger, FilesTooBigForDiffException e, @Nonnull 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());
  }
}
 
Example 13
Source File: ErrorMessageService.java    From tmc-intellij with MIT License 5 votes vote down vote up
private Icon iconForNotificationType(NotificationType type) {
    if (type == NotificationType.WARNING) {
        return Messages.getWarningIcon();
    } else if (type == NotificationType.ERROR) {
        return Messages.getErrorIcon();
    } else if (type == NotificationType.INFORMATION) {
        return Messages.getInformationIcon();
    } else {
        return Messages.getErrorIcon();
    }
}
 
Example 14
Source File: CommitHelper.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static NotificationType resolveNotificationType(@Nonnull GeneralCommitProcessor processor) {
  boolean hasExceptions = !processor.getVcsExceptions().isEmpty();
  boolean hasOnlyWarnings = doesntContainErrors(processor.getVcsExceptions());

  return hasExceptions ? (hasOnlyWarnings ? NotificationType.WARNING : NotificationType.ERROR) : NotificationType.INFORMATION;
}
 
Example 15
Source File: APIKitScaffoldingAction.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
@Override
public void debug(CharSequence charSequence, Throwable throwable) {
    Notification notification = new Notification("APIKit Scaffolding", "APIKit", charSequence.toString() + " : " + throwable.toString(), NotificationType.INFORMATION);
    Notifications.Bus.notify(notification);
    notification.getBalloon().hide();
}
 
Example 16
Source File: BuildTemplateAction.java    From react-templates-plugin with MIT License 4 votes vote down vote up
public static void info(Project project, String msg) {
    Notification errorNotification1 = new Notification("React-Templates plugin", "React-Templates plugin", msg, NotificationType.INFORMATION);
    Notifications.Bus.notify(errorNotification1, project);
}
 
Example 17
Source File: APIKitScaffoldingAction.java    From mule-intellij-plugins with Apache License 2.0 4 votes vote down vote up
@Override
public void info(CharSequence charSequence, Throwable throwable) {
    Notification notification = new Notification("APIKit Scaffolding", "APIKit", charSequence.toString() + " : " + throwable.toString(), NotificationType.INFORMATION);
    Notifications.Bus.notify(notification);
    notification.getBalloon().hide();
}
 
Example 18
Source File: GenerateParserAction.java    From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void actionPerformed(final AnActionEvent e) {
	Project project = e.getData(PlatformDataKeys.PROJECT);
	if ( project==null ) {
		LOG.error("actionPerformed no project for "+e);
		return; // whoa!
	}
	VirtualFile grammarFile = MyActionUtils.getGrammarFileFromEvent(e);
	LOG.info("actionPerformed "+(grammarFile==null ? "NONE" : grammarFile));
	if ( grammarFile==null ) return;
	String title = "ANTLR Code Generation";
	boolean canBeCancelled = true;

	// commit changes to PSI and file system
	PsiDocumentManager psiMgr = PsiDocumentManager.getInstance(project);
	FileDocumentManager docMgr = FileDocumentManager.getInstance();
	Document doc = docMgr.getDocument(grammarFile);
	if ( doc==null ) return;

	boolean unsaved = !psiMgr.isCommitted(doc) || docMgr.isDocumentUnsaved(doc);
	if ( unsaved ) {
		// save event triggers ANTLR run if autogen on
		psiMgr.commitDocument(doc);
		docMgr.saveDocument(doc);
	}

	boolean forceGeneration = true; // from action, they really mean it
	RunANTLROnGrammarFile gen =
		new RunANTLROnGrammarFile(grammarFile,
								  project,
								  title,
								  canBeCancelled,
								  forceGeneration);

	boolean autogen = ANTLRv4GrammarPropertiesStore.getGrammarProperties(project, grammarFile).shouldAutoGenerateParser();
	if ( !unsaved || !autogen ) {
		// if everything already saved (not stale) then run ANTLR
		// if had to be saved and autogen NOT on, then run ANTLR
		// Otherwise, the save file event will have or will run ANTLR.
		ProgressManager.getInstance().run(gen); //, "Generating", canBeCancelled, e.getData(PlatformDataKeys.PROJECT));

		// refresh from disk to see new files
		Set<File> generatedFiles = new HashSet<>();
		generatedFiles.add(new File(gen.getOutputDirName()));
		LocalFileSystem.getInstance().refreshIoFiles(generatedFiles, true, true, null);
		// pop up a notification
		Notification notification =
			new Notification(RunANTLROnGrammarFile.groupDisplayId,
							 "parser for " + grammarFile.getName() + " generated",
							 "to " + gen.getOutputDirName(),
							 NotificationType.INFORMATION);
		Notifications.Bus.notify(notification, project);
	}
}
 
Example 19
Source File: Notifications.java    From SmartIM4IntelliJ with Apache License 2.0 4 votes vote down vote up
public static void notify(final String title, final CharSequence text) {
    com.intellij.notification.Notifications.Bus.register("SmartIM", NotificationDisplayType.BALLOON);
    Notification n = new Notification("SmartIM", title, StringUtils.isEmpty(text) ? "" : text.toString(),
        NotificationType.INFORMATION);
    com.intellij.notification.Notifications.Bus.notify(n);
}
 
Example 20
Source File: BuildTemplateAction.java    From react-templates-plugin with MIT License 4 votes vote down vote up
public static void info(Project project, String msg) {
    Notification errorNotification1 = new Notification("React-Templates plugin", "React-Templates plugin", msg, NotificationType.INFORMATION);
    Notifications.Bus.notify(errorNotification1, project);
}