Search in sources :

Example 1 with IHyperlinkListener

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();
}
Also used : ScalingHyperlink(org.eclipse.mylyn.commons.workbench.forms.ScalingHyperlink) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) Color(org.eclipse.swt.graphics.Color) BackingStoreException(org.osgi.service.prefs.BackingStoreException) ArrayList(java.util.ArrayList) Shell(org.eclipse.swt.widgets.Shell) IHyperlinkListener(org.eclipse.ui.forms.events.IHyperlinkListener) NotificationPopup(org.eclipse.mylyn.internal.commons.notifications.ui.popup.NotificationPopup) AbstractNotification(org.eclipse.mylyn.commons.notifications.core.AbstractNotification)

Example 2 with IHyperlinkListener

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();
        }
    });
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) IHyperlinkListener(org.eclipse.ui.forms.events.IHyperlinkListener) Display(org.eclipse.swt.widgets.Display)

Example 3 with IHyperlinkListener

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;
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) IHyperlinkListener(org.eclipse.ui.forms.events.IHyperlinkListener) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink)

Example 4 with IHyperlinkListener

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;
}
Also used : MalformedURLException(java.net.MalformedURLException) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) FormText(org.eclipse.ui.forms.widgets.FormText) IHyperlinkListener(org.eclipse.ui.forms.events.IHyperlinkListener) IWorkbenchBrowserSupport(org.eclipse.ui.browser.IWorkbenchBrowserSupport) IWebBrowser(org.eclipse.ui.browser.IWebBrowser) PartInitException(org.eclipse.ui.PartInitException) URL(java.net.URL)

Example 5 with IHyperlinkListener

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();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ImageHyperlink(org.eclipse.ui.forms.widgets.ImageHyperlink) GridData(org.eclipse.swt.layout.GridData) IHyperlinkListener(org.eclipse.ui.forms.events.IHyperlinkListener) Section(org.eclipse.ui.forms.widgets.Section)

Aggregations

IHyperlinkListener (org.eclipse.ui.forms.events.IHyperlinkListener)8 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)7 Composite (org.eclipse.swt.widgets.Composite)4 Hyperlink (org.eclipse.ui.forms.widgets.Hyperlink)3 ArrayList (java.util.ArrayList)2 AbstractNotification (org.eclipse.mylyn.commons.notifications.core.AbstractNotification)2 NotificationPopup (org.eclipse.mylyn.internal.commons.notifications.ui.popup.NotificationPopup)2 GridData (org.eclipse.swt.layout.GridData)2 GridLayout (org.eclipse.swt.layout.GridLayout)2 Shell (org.eclipse.swt.widgets.Shell)2 FormText (org.eclipse.ui.forms.widgets.FormText)2 EditXObjectAction (com.amalto.workbench.actions.EditXObjectAction)1 TreeObject (com.amalto.workbench.models.TreeObject)1 TreeParent (com.amalto.workbench.models.TreeParent)1 WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)1 WSStoredProcedure (com.amalto.workbench.webservices.WSStoredProcedure)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)1 SourceViewer (org.eclipse.jface.text.source.SourceViewer)1