use of com.intellij.notification.NotificationDisplayType in project intellij-community by JetBrains.
the class NotificationSettings method save.
@NotNull
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;
}
use of com.intellij.notification.NotificationDisplayType in project intellij-community by JetBrains.
the class NotificationSettings method load.
@Nullable
public static NotificationSettings load(@NotNull 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;
}
Aggregations