use of org.eclipse.mylyn.commons.workbench.forms.ScalingHyperlink 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();
}
Aggregations