Java Code Examples for com.intellij.notification.NotificationDisplayType#BALLOON

The following examples show how to use com.intellij.notification.NotificationDisplayType#BALLOON . 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: Notifications.java    From KodeBeagle with Apache License 2.0 6 votes vote down vote up
public final void save() {
    NotificationDisplayType notificationDisplayType = NotificationDisplayType.NONE;

    boolean shouldLog = false;
    propertiesComponent.setValue(RefreshActionBase.NOTIFICATION_CHECKBOX_VALUE,
            String.valueOf(this.getNotificationsCheckBoxValue()));
    propertiesComponent.setValue(RefreshActionBase.LOGGING_CHECKBOX_VALUE,
            String.valueOf(this.getLoggingCheckBoxValue()));

    if (this.getNotificationsCheckBoxValue()) {
        notificationDisplayType = NotificationDisplayType.BALLOON;
    }

    if (this.getLoggingCheckBoxValue()) {
        shouldLog = true;
    }

    NotificationsConfigurationImpl.getNotificationsConfiguration().changeSettings(
            MainWindowBase.KODEBEAGLE, notificationDisplayType, shouldLog, false);
}
 
Example 2
Source File: NotificationSettings.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nullable
public static NotificationSettings load(@Nonnull final Element element) {
  final String displayTypeString = element.getAttributeValue("displayType");
  NotificationDisplayType displayType = NotificationDisplayType.BALLOON;
  boolean shouldLog = !"false".equals(element.getAttributeValue("shouldLog"));
  boolean shouldReadAloud = "true".equals(element.getAttributeValue("shouldReadAloud"));
  if ("BALLOON_ONLY".equals(displayTypeString)) {
    shouldLog = false;
    displayType = NotificationDisplayType.BALLOON;
  }
  else if (displayTypeString != null) {
    try {
      displayType = NotificationDisplayType.valueOf(displayTypeString.toUpperCase());
    }
    catch (IllegalArgumentException ignored) {
    }
  }

  final String groupId = element.getAttributeValue("groupId");
  return groupId != null ? new NotificationSettings(groupId, displayType, shouldLog, shouldReadAloud) : null;
}
 
Example 3
Source File: NotificationSettings.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public Element save() {
  final Element result = new Element("notification");

  result.setAttribute("groupId", getGroupId());
  final NotificationDisplayType displayType = getDisplayType();
  if (displayType != NotificationDisplayType.BALLOON) {
    result.setAttribute("displayType", displayType.toString());
  }
  if (!myShouldLog) {
    result.setAttribute("shouldLog", "false");
  }
  if (myShouldReadAloud) {
    result.setAttribute("shouldReadAloud", "true");
  }

  return result;
}
 
Example 4
Source File: NotificationsConfigurationImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static NotificationSettings getDefaultSettings(String groupId) {
  NotificationGroup group = NotificationGroup.findRegisteredGroup(groupId);
  if (group != null) {
    return new NotificationSettings(groupId, group.getDisplayType(), group.isLogByDefault(), false);
  }
  return new NotificationSettings(groupId, NotificationDisplayType.BALLOON, true, false);
}