org.eclipse.ui.forms.widgets.Hyperlink Java Examples
The following examples show how to use
org.eclipse.ui.forms.widgets.Hyperlink.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConfigurationFormToolkit.java From neoscada with Eclipse Public License 1.0 | 6 votes |
public void createStandardLinkText ( final Composite parent, final String linkFactory, final String attributeName, final String label, final String textMessage, final ConfigurationEditorInput input, final Object valueType ) { this.toolkit.createLabel ( parent, label + ":" ); final Text text = this.toolkit.createText ( parent, "" ); text.setMessage ( textMessage ); text.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, true, true ) ); text.setToolTipText ( textMessage ); final IObservableValue value = Observables.observeMapEntry ( input.getDataMap (), attributeName, valueType ); this.dbc.bindValue ( WidgetProperties.text ( SWT.Modify ).observe ( text ), value ); final Hyperlink link = this.toolkit.createHyperlink ( parent, "link", SWT.NONE ); link.setLayoutData ( new GridData ( GridData.FILL, GridData.BEGINNING, false, false ) ); link.addHyperlinkListener ( new HyperlinkAdapter () { @Override public void linkActivated ( final HyperlinkEvent e ) { EditorHelper.handleOpen ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getActivePage (), input.getConnectionUri (), linkFactory, text.getText () ); } } ); }
Example #2
Source File: DefaultControlFieldProvider.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
private void populateInnerComposite(){ for (String l : fields) { Hyperlink hl = tk.createHyperlink(inner, l, SWT.NONE); hl.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e){ Hyperlink h = (Hyperlink) e.getSource(); String dbField = getDbFieldForField(h.getText()); fireSortEvent(dbField); } }); hl.setBackground(inner.getBackground()); } createSelectors(fields.length); for (int i = 0; i < selectors.length; i++) { selectors[i] = new ElexisText(tk.createText(inner, "", SWT.BORDER)); //$NON-NLS-1$ selectors[i].addModifyListener(ml); selectors[i].addSelectionListener(sl); selectors[i].setToolTipText(Messages.DefaultControlFieldProvider_enterFilter); //$NON-NLS-1$ selectors[i].setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); SWTHelper.setSelectOnFocus((Text) selectors[i].getWidget()); } }
Example #3
Source File: AddRepositoryDialog.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void createConfigViewer(Composite container, FormToolkit toolkit) { UI.formLabel(container, toolkit, M.ServerUrl); configViewer = new ConfigViewer(container); configViewer.setInput(CloudConfigurations.get()); Hyperlink editConfig = UI.formLink(container, toolkit, M.Edit); editConfig.setForeground(Colors.linkBlue()); editConfig.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, CloudPreferencePage.ID, null, null); dialog.setBlockOnOpen(true); dialog.open(); configViewer.setInput(CloudConfigurations.get()); configViewer.select(CloudConfigurations.getDefault()); } }); }
Example #4
Source File: DatabasePropertiesDialog.java From olca-app with Mozilla Public License 2.0 | 6 votes |
private void renderFolderLink(DerbyConfiguration conf, Composite parent, FormToolkit toolkit) { File folder = DatabaseDir.getRootFolder(conf.getName()); String path = folder.toURI().toString(); Hyperlink link = new Hyperlink(parent, SWT.NONE); toolkit.adapt(link); link.setText(Strings.cut(path, 75)); link.setToolTipText(path); Controls.onClick(link, e -> { try { Desktop.browse(path); } catch (Exception ex) { Logger log = LoggerFactory.getLogger(getClass()); log.error("failed to open folder", ex); } }); }
Example #5
Source File: WelcomePageEditorPart.java From codewind-eclipse with Eclipse Public License 2.0 | 5 votes |
private void setHyperlinkAction(Hyperlink link, LinkAction action) { link.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent arg0) { action.execute(); } }); }
Example #6
Source File: DialogCellEditor.java From olca-app with Mozilla Public License 2.0 | 5 votes |
protected Hyperlink createLink(Composite parent) { Hyperlink link = new Hyperlink(parent, SWT.NONE); link.setText(M.Edit); link.setBackground(Colors.white()); link.setForeground(Colors.linkBlue()); return link; }
Example #7
Source File: Controls.java From olca-app with Mozilla Public License 2.0 | 5 votes |
public static void onClick(Hyperlink link, Consumer<HyperlinkEvent> fn) { if (link == null || fn == null) return; link.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { fn.accept(e); } }); }
Example #8
Source File: FormPictureControl.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override protected void addModifyImageHandler(Hyperlink modifyImageLink) { modifyImageLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { handleModifyImage(); } }); }
Example #9
Source File: FormPictureControl.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override protected void addDeleteImageHandler(Hyperlink deleteImageLink) { deleteImageLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { handleDeleteImage(); } }); }
Example #10
Source File: ListDisplay.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
private void enableHyperlinks(boolean bEnable){ cLinks.setEnabled(bEnable); for (Control c : cLinks.getChildren()) { Hyperlink hl = (Hyperlink) c; if (bEnable) { hl.setForeground(UiDesk.getColor(UiDesk.COL_BLUE)); } else { hl.setForeground(UiDesk.getColor(UiDesk.COL_GREY)); } c.setEnabled(bEnable); } cLinks.redraw(); }
Example #11
Source File: InfoPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private Hyperlink createDqEntryRow(Composite parent, FormToolkit tk) { UI.formLabel(parent, tk, M.DataQualityEntry); Supplier<String> dqLabel = () -> { Process p = getModel(); return p.dqSystem == null || Strings.nullOrEmpty(p.dqEntry) ? "(not specified)" : p.dqSystem.applyScoreLabels(p.dqEntry); }; Hyperlink link = UI.formLink(parent, tk, dqLabel.get()); Controls.onClick(link, e -> { if (getModel().dqSystem == null) { MsgBox.info("No data quality system is selected"); return; } String oldVal = getModel().dqEntry; DQSystem system = getModel().dqSystem; String entry = getModel().dqEntry; DataQualityShell shell = DataQualityShell.withoutUncertainty( parent.getShell(), system, entry); shell.onOk = (_shell) -> { getModel().dqEntry = _shell.getSelection(); }; shell.onDelete = (_shell) -> { getModel().dqEntry = null; }; shell.addDisposeListener(_e -> { if (Objects.equals(oldVal, getModel().dqEntry)) return; link.setText(dqLabel.get()); link.pack(); getEditor().setDirty(true); }); shell.open(); }); new CommentControl(parent, getToolkit(), "dqEntry", getComments()); return link; }
Example #12
Source File: GlobalParameterInfoPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void forInputParameter(Composite comp) { doubleText(comp, M.Value, "value"); UI.formLabel(comp, toolkit, M.Uncertainty); Hyperlink link = UI.formLink(comp, toolkit, Uncertainty.string(getModel().uncertainty)); Controls.onClick(link, e -> { UncertaintyDialog dialog = new UncertaintyDialog(UI.shell(), getModel().uncertainty); if (dialog.open() != IDialogConstants.OK_ID) return; getModel().uncertainty = dialog.getUncertainty(); link.setText(Uncertainty.string(getModel().uncertainty)); getEditor().setDirty(true); }); UI.filler(comp, toolkit); }
Example #13
Source File: ResultPage.java From olca-app with Mozilla Public License 2.0 | 5 votes |
private void renderPager() { if (pageCount < 2) return; int start = currentPage > 5 ? currentPage - 5 : 0; int end = start + 10; if (end >= pageCount) { end = pageCount - 1; } Composite pager = tk.createComposite(pageComposite); UI.gridLayout(pager, end - start + 1); for (int i = start; i <= end; i++) { String label; if ((i == start && start > 0) || (i == end && end < (pageCount - 1))) { label = "..."; } else { label = Integer.toString(i + 1); } if (i == currentPage) { tk.createLabel(pager, label) .setFont(UI.boldFont()); continue; } int pageNumber = i; Hyperlink link = tk.createHyperlink(pager, label, SWT.NONE); Controls.onClick(link, e -> { currentPage = pageNumber; renderPage(); }); } }
Example #14
Source File: MemoryError.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override protected void createFormContent(IManagedForm mform) { String message = M.CouldNotAllocateMemoryError; FormToolkit toolkit = mform.getToolkit(); mform.getForm().setText(M.OutOfMemory); Composite comp = UI.formBody(mform.getForm(), mform.getToolkit()); UI.gridLayout(comp, 1); Label label = toolkit.createLabel(comp, message, SWT.WRAP); UI.gridData(label, true, false); Hyperlink link = UI.formLink(comp, toolkit, "Open preference dialog"); Controls.onClick(link, e -> openPreferences()); }
Example #15
Source File: ApplicationOverviewEditorPart.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
public ProjectLinkSection(Composite parent, FormToolkit toolkit, int hSpan, int vSpan) { Section section = toolkit.createSection(parent, ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR); section.setText(Messages.AppOverviewEditorProjectLinksSection); section.setLayoutData(new GridData(SWT.FILL,SWT.FILL, true, false, hSpan, vSpan)); section.setExpanded(true); Composite composite = toolkit.createComposite(section); GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 5; layout.marginWidth = 10; layout.verticalSpacing = 10; layout.horizontalSpacing = 10; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); toolkit.paintBordersFor(composite); section.setClient(composite); // Link description and manage link toLinkDescriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY); toLinkDescriptionText.setText(Messages.AppOverviewEditorProjectLinksNoLinks); toLinkDescriptionText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); toLinkDescriptionText.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false)); IDEUtil.paintBackgroundToMatch(toLinkDescriptionText, composite); Hyperlink manageLink = toolkit.createHyperlink(composite, Messages.AppOverviewEditorProjectLinksManageLinks, SWT.WRAP); GridData data = new GridData(GridData.END, GridData.BEGINNING, false, false); manageLink.setLayoutData(data); manageLink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) { final CodewindConnection conn = getConn(); final CodewindApplication app = getApp(conn); ManageLinksAction.openManageLinksDialog(app); } }); // Link table toLinkTable = new LinkTable(composite, toolkit, Messages.LinkMgmtProjectColumn); // From link description fromLinkDescriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY); fromLinkDescriptionText.setText(Messages.AppOverviewEditorProjectLinksNoFromLinks); fromLinkDescriptionText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); fromLinkDescriptionText.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1)); IDEUtil.paintBackgroundToMatch(fromLinkDescriptionText, composite); // From link table fromLinkTable = new LinkTable(composite, toolkit, Messages.AppOverviewEditorProjectLinksSourceProject); // Initialize toLinkTable.tableComp.setVisible(false); ((GridData) toLinkTable.tableComp.getLayoutData()).exclude = true; fromLinkTable.tableComp.setVisible(false); ((GridData) fromLinkTable.tableComp.getLayoutData()).exclude = true; }
Example #16
Source File: UI.java From olca-app with Mozilla Public License 2.0 | 4 votes |
public static Hyperlink formLink(Composite parent, String label) { return formLink(parent, null, label); }
Example #17
Source File: KontaktBlatt.java From elexis-3-core with Eclipse Public License 1.0 | 4 votes |
public KontaktBlatt(Composite parent, int style, IViewSite vs){ super(parent, style); site = vs; tk = UiDesk.getToolkit(); setLayout(new FillLayout()); form = tk.createScrolledForm(this); Composite body = form.getBody(); body.setLayout(new GridLayout()); Composite cTypes = tk.createComposite(body, SWT.BORDER); for (int i = 0; i < types.length; i++) { bTypes[i] = tk.createButton(cTypes, typLabels[i], SWT.CHECK); bTypes[i].addSelectionListener(tba); bTypes[i].setData(types[i]); if (types[i].equalsIgnoreCase(IS_USER)) { bTypes[i].setEnabled(false); } } cTypes.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); cTypes.setLayout(new FillLayout()); Composite bottom = tk.createComposite(body); bottom.setLayout(new FillLayout()); bottom.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); actKontakt = (Kontakt) ElexisEventDispatcher.getSelected(Kontakt.class); afDetails = new AutoForm(bottom, def); Composite cAnschrift = tk.createComposite(body); cAnschrift.setLayout(new GridLayout(2, false)); cAnschrift.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Hyperlink hAnschrift = tk.createHyperlink(cAnschrift, Messages.KontaktBlatt_Postal, SWT.NONE); //$NON-NLS-1$ hAnschrift.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e){ if (actKontakt != null) { new AnschriftEingabeDialog(getShell(), actKontakt).open(); ElexisEventDispatcher.fireSelectionEvent(actKontakt); } } }); lbAnschrift = tk.createLabel(cAnschrift, StringConstants.EMPTY, SWT.WRAP); lbAnschrift.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); setOrganisationFieldsVisible(false); def[19].getWidget().setVisible(false); //field is only added for UI presentation reasons GlobalEventDispatcher.addActivationListener(this, site.getPart()); setUnlocked(false); }
Example #18
Source File: ConfigurationWizardRepositorySourceProviderPage.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public void createControl(Composite parent) { Composite outerContainer = new Composite(parent,SWT.NONE); outerContainer.setLayout(new GridLayout()); outerContainer.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); Composite treeGroup = new Composite(outerContainer, SWT.NONE); GridLayout treeLayout = new GridLayout(); treeLayout.numColumns = 1; treeGroup.setLayout(treeLayout); treeGroup.setLayoutData( new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); treeViewer = new TreeViewer(treeGroup, SWT.BORDER | SWT.SINGLE); treeViewer.setLabelProvider(new RepositorySourceLabelProvider()); treeViewer.setContentProvider(new RepositorySourceContentProvider()); treeViewer.setUseHashlookup(true); GridData layoutData = new GridData(); layoutData.grabExcessHorizontalSpace = true; layoutData.grabExcessVerticalSpace = true; layoutData.horizontalAlignment = GridData.FILL; layoutData.verticalAlignment = GridData.FILL; layoutData.minimumHeight = 300; layoutData.minimumWidth = 300; treeViewer.getControl().setLayoutData(layoutData); treeViewer.setInput(this); treeViewer.setSelection(new StructuredSelection("URL")); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object selectedObject = ((IStructuredSelection)treeViewer.getSelection()).getFirstElement(); if (selectedObject instanceof ISVNRepositorySourceProvider) { selectedRepositorySourceProvider = (ISVNRepositorySourceProvider)selectedObject; } else { selectedRepositorySourceProvider = null; } setPageComplete(!treeViewer.getSelection().isEmpty()); } }); Hyperlink repositoryProviderLink = new Hyperlink(treeGroup, SWT.NONE); repositoryProviderLink.setUnderlined(true); repositoryProviderLink.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); repositoryProviderLink.setText("Click here to see the list of available providers."); repositoryProviderLink.setToolTipText(REPOSITORY_PROVIDERS_WIKI_URL); repositoryProviderLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent evt) { showAvailableProviders(); } }); Composite cloudForgeComposite = new CloudForgeComposite(outerContainer, SWT.NONE); GridData data = new GridData(GridData.VERTICAL_ALIGN_END | GridData.GRAB_VERTICAL | GridData.FILL_VERTICAL); cloudForgeComposite.setLayoutData(data); setControl(outerContainer); }
Example #19
Source File: FormPictureControl.java From nebula with Eclipse Public License 2.0 | 4 votes |
@Override protected void setLinkText(Hyperlink link, String text) { link.setText(text); }
Example #20
Source File: FormPictureControl.java From nebula with Eclipse Public License 2.0 | 4 votes |
@Override protected Hyperlink createLink(Composite parent, int style) { return toolkit.createHyperlink(parent, "", style); }
Example #21
Source File: WidgetFactory.java From elexis-3-core with Eclipse Public License 1.0 | 2 votes |
/** * Hyperlink in der Form erzeugen * * @param text * Angezeigter und anklickbarer Text * @param lis * HyperlinkListener oder (einfacher) HyperlinkAdapter, der die Klicks verarbeiten * kann */ public Hyperlink createHyperlink(String text, IHyperlinkListener lis){ Hyperlink ret = tk.createHyperlink(form.getBody(), text, SWT.WRAP); ret.addHyperlinkListener(lis); return ret; }