use of org.eclipse.mylyn.commons.notifications.core.AbstractNotification in project liferay-ide by liferay.
the class Java8requiredSink method showPopup.
@Override
public void showPopup() {
if (_popup != null) {
_popup.close();
}
Shell shell = new Shell(PlatformUI.getWorkbench().getDisplay());
_popup = new NotificationPopup(shell) {
@Override
protected void createContentArea(Composite parent) {
super.createContentArea(parent);
Composite composite = (Composite) parent;
ScalingHyperlink hyperlink = new ScalingHyperlink(composite, SWT.NONE);
hyperlink.setText("Got it, please don't show this alert again.");
hyperlink.setForeground(new Color(null, 12, 81, 172));
hyperlink.registerMouseTrackListener();
hyperlink.addHyperlinkListener(new IHyperlinkListener() {
@Override
public void linkActivated(HyperlinkEvent e) {
_preventShowNotifications();
if (_popup != null) {
_popup.close();
}
}
@Override
public void linkEntered(HyperlinkEvent e) {
}
@Override
public void linkExited(HyperlinkEvent e) {
}
private void _preventShowNotifications() {
try {
IEclipsePreferences prefs = ConfigurationScope.INSTANCE.getNode(NotificationsCore.PLUGIN_ID);
prefs.putBoolean(NotificationsCore.SHOULD_SHOW_NOTIFICATIONS, false);
prefs.flush();
} catch (BackingStoreException bse) {
NotificationsCore.logError(bse);
}
}
});
}
@Override
protected String getPopupShellTitle() {
return "Liferay IDE Notification";
}
};
_popup.setFadingEnabled(isAnimationsEnabled());
List<AbstractNotification> toDisplay = new ArrayList<>(getNotifications());
Collections.sort(toDisplay);
_popup.setContents(toDisplay);
getNotifications().clear();
_popup.setBlockOnOpen(false);
_popup.setDelayClose(60 * 1000);
_popup.open();
}
use of org.eclipse.mylyn.commons.notifications.core.AbstractNotification in project liferay-ide by liferay.
the class ImportGlobalSettingsNotificationSink method showPopup.
@Override
public void showPopup() {
if (popup != null) {
popup.close();
}
Shell shell = new Shell(PlatformUI.getWorkbench().getDisplay());
popup = new NotificationPopup(shell) {
@Override
protected void createContentArea(Composite parent) {
super.createContentArea(parent);
hookHyperlink(parent);
}
@Override
protected String getPopupShellTitle() {
return "Liferay IDE Notification";
}
private void hookHyperlink(Composite parent) {
Hyperlink hyperlink = null;
for (Control child : parent.getChildren()) {
if (child instanceof Hyperlink) {
hyperlink = (Hyperlink) child;
hyperlink.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
if (popup != null) {
popup.closeFade();
}
}
});
return;
} else if (child instanceof Composite) {
hookHyperlink((Composite) child);
}
}
}
};
popup.setFadingEnabled(isAnimationsEnabled());
List<AbstractNotification> toDisplay = new ArrayList<AbstractNotification>(getNotifications());
Collections.sort(toDisplay);
popup.setContents(toDisplay);
getNotifications().clear();
popup.setBlockOnOpen(false);
popup.setDelayClose(60 * 1000);
popup.open();
}
Aggregations