Search in sources :

Example 1 with Hyperlink

use of org.eclipse.ui.forms.widgets.Hyperlink in project tdi-studio-se by Talend.

the class AbstractTabPage method createMessageLabel.

/**
     * Creates the message label.
     */
private void createMessageLabel() {
    messagePage = new Composite(this, SWT.NONE);
    messagePage.setLayout(new GridLayout(3, false));
    messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    FormToolkit toolkit = new FormToolkit(Display.getDefault());
    toolkit.createLabel(messagePage, Messages.patckagesNotSpecifiedMsg);
    Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.selectPackagesMsg, SWT.NONE);
    hyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            new ConfigureCpuProfilerAction(cpuSection).run();
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) ConfigureCpuProfilerAction(org.talend.designer.runtime.visualization.internal.ui.properties.cpu.actions.ConfigureCpuProfilerAction) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 2 with Hyperlink

use of org.eclipse.ui.forms.widgets.Hyperlink in project tdi-studio-se by Talend.

the class RuntimeGraphcsComposite method createMessagePage.

private Composite createMessagePage(Composite parent) {
    messagePage = new Composite(parent, SWT.NONE);
    FormLayout messageLayout = new FormLayout();
    messageLayout.marginHeight = 0;
    messageLayout.marginWidth = 0;
    messagePage.setLayout(messageLayout);
    messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    FormToolkit toolkit = new FormToolkit(Display.getDefault());
    Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.loadDefaultChartSetLabel, SWT.NONE);
    hyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent event) {
            try {
                new LoadChartAction(RuntimeGraphcsComposite.this).loadDefaultChartSet();
            } catch (JvmCoreException e) {
                Activator.log(Messages.loadChartSetFailedMsg, e);
            }
        }
    });
    return messagePage;
}
Also used : FormLayout(org.eclipse.swt.layout.FormLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) LoadChartAction(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.LoadChartAction) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 3 with Hyperlink

use of org.eclipse.ui.forms.widgets.Hyperlink in project tdi-studio-se by Talend.

the class TimelineSection method createMessagePage.

/**
     * Creates the message page.
     * 
     * @return The message page
     */
private Composite createMessagePage() {
    messagePage = new Composite(timelinePageBook, SWT.NONE);
    messagePage.setLayout(new GridLayout(3, false));
    messagePage.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    FormToolkit toolkit = new FormToolkit(Display.getDefault());
    Hyperlink hyperlink = toolkit.createHyperlink(messagePage, Messages.loadDefaultChartSetLabel, SWT.NONE);
    hyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent event) {
            try {
                new LoadChartSetAction(TimelineSection.this).loadDefaultChartSet();
            } catch (JvmCoreException e) {
                Activator.log(Messages.loadChartSetFailedMsg, e);
            }
        }
    });
    return messagePage;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Composite(org.eclipse.swt.widgets.Composite) ExpandableComposite(org.eclipse.ui.forms.widgets.ExpandableComposite) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter) JvmCoreException(org.talend.designer.runtime.visualization.JvmCoreException)

Example 4 with Hyperlink

use of org.eclipse.ui.forms.widgets.Hyperlink in project liferay-ide by liferay.

the class LiferayProjectPropertyPage method createInfoGroup.

protected void createInfoGroup(final Composite parent) {
    new Label(parent, SWT.LEFT).setText(Msgs.liferayPluginTypeLabel);
    final Text pluginTypeLabel = new Text(parent, SWT.READ_ONLY | SWT.BORDER);
    pluginTypeLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
    final IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(getFacetedProject());
    if (liferayFacet != null) {
        pluginTypeLabel.setText(liferayFacet.getLabel());
    }
    final IProject proj = getProject();
    if ((proj != null) && ProjectUtil.isLiferayFacetedProject(proj)) {
        try {
            if (!ProjectUtil.isMavenProject(proj)) {
                final SDK projectSdk = SDKUtil.getSDK(getProject());
                new Label(parent, SWT.LEFT).setText(Msgs.liferaySdkLabel);
                _sdkLabel = new Text(parent, SWT.READ_ONLY | SWT.BORDER);
                if (projectSdk != null) {
                    _sdkLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
                    _sdkLabel.setText(projectSdk.getName());
                } else {
                    _sdkLabel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
                    _sdkLabel.setText("");
                    final Hyperlink link = new Hyperlink(parent, SWT.NULL);
                    link.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false, 1, 1));
                    link.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLUE));
                    link.setUnderlined(true);
                    link.setText(Msgs.changeliferaySdk);
                    link.addHyperlinkListener(new HyperlinkAdapter() {

                        public void linkActivated(HyperlinkEvent e) {
                            String dialogId = new String("com.liferay.ide.project.ui.dialog.SelectPluginsSDKDialog");
                            final LiferayPluginSDKOp op = (LiferayPluginSDKOp) (LiferayPluginSDKOp.TYPE.instantiate().initialize());
                            DefinitionLoader sdefLoader = DefinitionLoader.context(getClass()).sdef(dialogId);
                            final Reference<DialogDef> dialogRef = sdefLoader.dialog("ConfigureLiferaySDK");
                            final SapphireDialog dialog = new SapphireDialog(UIUtil.getActiveShell(), op, dialogRef);
                            dialog.setBlockOnOpen(true);
                            final int result = dialog.open();
                            if (result != SapphireDialog.CANCEL) {
                                _sdkLabel.setText(op.getPluginsSDKName().content());
                            }
                        }
                    });
                }
                if (CoreUtil.compareVersions(new Version(projectSdk.getVersion()), ILiferayConstants.V700) < 0) {
                    new Label(parent, SWT.LEFT).setText(Msgs.liferayRuntimeLabel);
                    _runtimeCombo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
                    _runtimeCombo.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
                    String currentRuntimeName = null;
                    try {
                        ILiferayRuntime liferayRuntime = ServerUtil.getLiferayRuntime(getProject());
                        if (liferayRuntime != null) {
                            currentRuntimeName = liferayRuntime.getRuntime().getName();
                        }
                    } catch (Exception e) {
                        ProjectUI.logError("Could not determine liferay runtime", e);
                    }
                    List<String> runtimeNames = new ArrayList<>();
                    int selectionIndex = -1;
                    for (IRuntime runtime : ServerCore.getRuntimes()) {
                        if (ServerUtil.isLiferayRuntime(runtime) && FileUtil.exists(runtime.getLocation()) && (LiferayServerCore.newPortalBundle(runtime.getLocation()) == null)) {
                            runtimeNames.add(runtime.getName());
                            if (runtime.getName().equals(currentRuntimeName)) {
                                selectionIndex = runtimeNames.size() - 1;
                            }
                        }
                    }
                    if (ListUtil.isEmpty(runtimeNames)) {
                        runtimeNames.add("No Liferay runtimes available.");
                    }
                    _runtimeCombo.setItems(runtimeNames.toArray(new String[0]));
                    if (selectionIndex > -1) {
                        _runtimeCombo.select(selectionIndex);
                    }
                }
            }
        } catch (Exception e) {
            ProjectUI.logError("Could not determine whether its a maven project ", e);
        }
    }
}
Also used : HyperlinkEvent(org.eclipse.ui.forms.events.HyperlinkEvent) Reference(org.eclipse.sapphire.ui.def.DefinitionLoader.Reference) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) LiferayPluginSDKOp(com.liferay.ide.project.core.model.LiferayPluginSDKOp) Text(org.eclipse.swt.widgets.Text) Combo(org.eclipse.swt.widgets.Combo) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) BackingStoreException(org.osgi.service.prefs.BackingStoreException) IRuntime(org.eclipse.wst.server.core.IRuntime) Version(org.osgi.framework.Version) DefinitionLoader(org.eclipse.sapphire.ui.def.DefinitionLoader) ILiferayRuntime(com.liferay.ide.server.core.ILiferayRuntime) GridData(org.eclipse.swt.layout.GridData) IProjectFacet(org.eclipse.wst.common.project.facet.core.IProjectFacet) SDK(com.liferay.ide.sdk.core.SDK) SapphireDialog(org.eclipse.sapphire.ui.forms.swt.SapphireDialog) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink) HyperlinkAdapter(org.eclipse.ui.forms.events.HyperlinkAdapter)

Example 5 with Hyperlink

use of org.eclipse.ui.forms.widgets.Hyperlink in project liferay-ide by liferay.

the class FormEntry method _createControl.

/**
 * Create all the controls in the provided parent.
 *
 * @param parent
 * @param toolkit
 * @param labelText
 * @param span
 * @param browseText
 * @param linkLabel
 */
private void _createControl(Composite parent, FormToolkit toolkit, String labelText, int style, String browseText, boolean linkLabel, int indent, int tcolspan) {
    if (linkLabel) {
        Hyperlink link = toolkit.createHyperlink(parent, labelText, SWT.NULL);
        _fLabel = link;
    } else {
        if (labelText != null) {
            _fLabel = toolkit.createLabel(parent, labelText);
            _fLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
        }
    }
    _fText = toolkit.createText(parent, "", style);
    _addListeners();
    if (browseText != null) {
        _fBrowse = toolkit.createButton(parent, browseText, SWT.PUSH);
        _fBrowse.addSelectionListener(new SelectionAdapter() {

            public void widgetSelected(SelectionEvent e) {
                if (_fListener != null) {
                    _fListener.browseButtonSelected(FormEntry.this);
                }
            }
        });
    }
    _fillIntoGrid(parent, indent, tcolspan);
    // Set the default text width hint and let clients modify accordingly
    // after the fact
    setTextWidthHint(F_DEFAULT_TEXT_WIDTH_HINT);
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Hyperlink(org.eclipse.ui.forms.widgets.Hyperlink)

Aggregations

Hyperlink (org.eclipse.ui.forms.widgets.Hyperlink)28 HyperlinkEvent (org.eclipse.ui.forms.events.HyperlinkEvent)18 Composite (org.eclipse.swt.widgets.Composite)17 HyperlinkAdapter (org.eclipse.ui.forms.events.HyperlinkAdapter)16 GridLayout (org.eclipse.swt.layout.GridLayout)12 GridData (org.eclipse.swt.layout.GridData)11 Label (org.eclipse.swt.widgets.Label)8 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)7 IStatus (org.eclipse.core.runtime.IStatus)6 Status (org.eclipse.core.runtime.Status)6 SelectionEvent (org.eclipse.swt.events.SelectionEvent)6 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)5 ArrayList (java.util.ArrayList)4 EntityNameCombo (org.eclipse.jpt.jpa.ui.internal.details.EntityNameCombo)4 IdClassChooser (org.eclipse.jpt.jpa.ui.internal.details.IdClassChooser)4 HibernateTableComposite (org.jboss.tools.hibernate.jpt.ui.internal.details.HibernateTableComposite)4 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 AccessTypeComboViewer (org.eclipse.jpt.jpa.ui.internal.details.AccessTypeComboViewer)3 PartInitException (org.eclipse.ui.PartInitException)3 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)3