use of org.eclipse.ui.forms.events.IHyperlinkListener 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.ui.forms.events.IHyperlinkListener in project ecf by eclipse.
the class WorkbenchAwareResourcesShare method handleStartMessage.
protected void handleStartMessage(final StartMessage msg) {
final Display display = SyncResourcesUI.getDefault().getDisplay();
display.asyncExec(new Runnable() {
public void run() {
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
NotificationDialog dialog = new NotificationDialog(window.getShell(), msg.getFromId(), msg.getProjectName(), new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
boolean b = MessageDialog.openConfirm(window.getShell(), null, "Are you sure you wish to share the '" + msg.getProjectName() + "' project with " + msg.getFromId() + "?");
if (b) {
WorkbenchAwareResourcesShare.this.sendResponse(true, msg.getProjectName());
WorkbenchAwareResourcesShare.super.handleStartMessage(msg);
} else {
WorkbenchAwareResourcesShare.this.sendResponse(false, msg.getProjectName());
}
}
});
dialog.open();
}
});
}
use of org.eclipse.ui.forms.events.IHyperlinkListener in project eclipse-integration-commons by spring-projects.
the class EditorToolkit method createHyperlink.
public Hyperlink createHyperlink(Composite parent, final String hyperlinkText, final String url) {
Hyperlink link = toolkit.createHyperlink(parent, hyperlinkText, SWT.NONE);
link.addHyperlinkListener(new IHyperlinkListener() {
public void linkActivated(HyperlinkEvent e) {
TasksUiUtil.openUrl(url);
}
public void linkEntered(HyperlinkEvent e) {
// Nothing to do
}
public void linkExited(HyperlinkEvent e) {
// Nothing to do
}
});
return link;
}
use of org.eclipse.ui.forms.events.IHyperlinkListener in project cubrid-manager by CUBRID.
the class NoticeDashboardPage method createFormText.
private FormText createFormText(Composite composite) {
FormText text = toolkit.createFormText(composite, true);
text.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
String href = (String) e.getHref();
String url = CommonUITool.urlEncodeForSpaces(href);
try {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(url));
} catch (PartInitException e1) {
LOGGER.error("Can not initialize web browser on the application.", e1);
} catch (MalformedURLException e2) {
LOGGER.error("The url {} is invalid.", url, e2);
}
}
});
return text;
}
use of org.eclipse.ui.forms.events.IHyperlinkListener in project cubrid-manager by CUBRID.
the class NoticeDashboardPage method createActionSection.
@SuppressWarnings("unused")
private void createActionSection(Composite parent) {
Section section = createStaticSection(parent, Messages.titleCommonAction);
Composite composite = toolkit.createComposite(section);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setClient(composite);
GridData data = new GridData(GridData.BEGINNING);
data.widthHint = 200;
ImageHyperlink addHost = toolkit.createImageHyperlink(composite, SWT.NONE);
addHost.setLayoutData(data);
addHost.setImage(CommonUIPlugin.getImageDescriptor("icons/action/host_add.png").createImage());
addHost.setText(Messages.titleAddHostBtn);
addHost.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction("com.cubrid.cubridmanager.ui.host.action.AddHostAction").run();
}
});
ImageHyperlink connectHost = toolkit.createImageHyperlink(composite, SWT.NONE);
connectHost.setLayoutData(data);
connectHost.setImage(CommonUIPlugin.getImageDescriptor("icons/action/host_connect.png").createImage());
connectHost.setText(Messages.titleConHostBtn);
connectHost.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction("com.cubrid.cubridmanager.ui.host.action.ConnectHostAction").run();
}
});
ImageHyperlink preferences = toolkit.createImageHyperlink(composite, SWT.NONE);
preferences.setLayoutData(data);
preferences.setImage(CommonUIPlugin.getImageDescriptor("icons/action/property.png").createImage());
preferences.setText(Messages.titlePreferencesBtn);
preferences.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction("preferences").run();
}
});
ImageHyperlink help = toolkit.createImageHyperlink(composite, SWT.NONE);
help.setLayoutData(data);
help.setImage(CommonUIPlugin.getImageDescriptor("icons/action/help.png").createImage());
help.setText(Messages.titleHelpBtn);
help.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction(HelpDocumentAction.ID).run();
}
});
}
Aggregations