@Override protected Composite createViewerToolTipContentArea(Event event, ViewerCell cell, Composite parent) { final Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(2, false)); composite.setBackground(rowColorBack); Plugin plugin = (Plugin) cell.getElement(); Hyperlink button = new Hyperlink(composite, SWT.FLAT); button.setText("\uf05A"); button.setFont(fontAwesome); button.setBackground(composite.getBackground()); button.setForeground(rowColorTitle); button.setUnderlined(false); button.addListener (SWT.MouseDown, e -> Program.launch(GLUON_PLUGIN_URL + plugin.getUrl())); button.setToolTipText("Click to access the service's JavaDoc"); Label text = new Label(composite, SWT.LEFT); final String description = plugin.getDescription(); text.setText(description.contains(".") ? description.substring(0, description.indexOf(".")) : description); text.setBackground(composite.getBackground()); text.setForeground(rowColorTitle); composite.pack(); return composite; }
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 () ); } } ); }
/** * Supposed to create a hyperlink with left aligned text. It doesn't. On * Windows Vista Version 6.0 (Build 6002: Service Pack 2) last patched in * June 2010, it puts the hyperlink in the center. The arguments of the * GridData constructor are obviously bogus, since the second argument is * supposed to control the vertical positioning, not the horizontal * positioning. However, every combination of arguments that I tried * either produced the same result, or produced nothing or something unreadable. * Apparently, another Eclipse feature. * * @param title * @param parent * @param toolkit * @return */ public static Hyperlink createHyperlinkLeft(String title, Composite parent, FormToolkit toolkit) { Label createLabel = toolkit.createLabel(parent, title); GridData gd = new GridData(); createLabel.setLayoutData(gd); gd.verticalAlignment = SWT.TOP; Hyperlink hyperlink = toolkit.createHyperlink(parent, "", SWT.RIGHT); gd = new GridData(SWT.FILL, SWT.LEFT, true, false); gd.horizontalIndent = 30; gd.verticalAlignment = SWT.TOP; gd.horizontalAlignment = SWT.RIGHT; gd.minimumWidth = 300; hyperlink.setLayoutData(gd); return hyperlink; }
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(); fireSortEvent(h.getText()); } }); 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()); } }
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); } }); }
private Hyperlink createDqEntryRow(Composite parent) { UI.formLabel(parent, toolkit, M.DataQualityEntry); Hyperlink link = UI.formLink(parent, toolkit, getDqEntryLabel()); Controls.onClick(link, e -> { if (getModel().dqSystem == null) { Error.showBox("Please select a data quality system first"); return; } String oldVal = getModel().dqEntry; DQSystem system = getModel().dqSystem; String entry = getModel().dqEntry; DataQualityShell shell = DataQualityShell.withoutUncertainty(parent.getShell(), system, entry); shell.onOk = InfoPage.this::onDqEntryDialogOk; shell.onDelete = InfoPage.this::onDqEntryDialogDelete; shell.addDisposeListener(e2 -> { if (Objects.equals(oldVal, getModel().dqEntry)) return; link.setText(getDqEntryLabel()); getEditor().setDirty(true); }); shell.open(); }); new CommentControl(parent, getToolkit(), "dqEntry", getComments()); return link; }
AllSlotsDisplay(final Overview parent, final Composite c) { super(c, SWT.NONE); self = this; this.parent = parent; setLayout(new GridLayout(4, true)); hl = new RowSelector(); Hyperlink hlLinks = tk.createHyperlink(this, Messages.AllSlotsDisplay_left, SWT.CENTER); hlLinks.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); hlLinks.addHyperlinkListener(hl); Hyperlink hlVorne = tk.createHyperlink(this, Messages.AllSlotsDisplay_front, SWT.CENTER); hlVorne.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); hlVorne.addHyperlinkListener(hl); Hyperlink hlRechts = tk.createHyperlink(this, Messages.AllSlotsDisplay_right, SWT.CENTER); hlRechts.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); hlRechts.addHyperlinkListener(hl); Hyperlink hlHinten = tk.createHyperlink(this, Messages.AllSlotsDisplay_back, SWT.CENTER); hlHinten.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); hlHinten.addHyperlinkListener(hl); }
@Override public Composite getPageContent( final FormToolkit toolkit, final Composite parent, final int style, final TeamExplorerContext context) { final Composite composite = toolkit.createComposite(parent); // Form-style border painting not enabled (0 pixel margins OK) because // no applicable controls in this composite SWTUtil.gridLayout(composite, 3, false, 0, 5); // Create the new work item hyper-link final String linkText = Messages.getString("TeamExplorerWorkItemPage.NewWorkItemLinkText"); //$NON-NLS-1$ final Menu menu = createNewWorkItemMenu(composite.getShell(), context); final ImageHyperlink link = PageHelpers.createDropHyperlink(toolkit, composite, linkText, menu); GridDataBuilder.newInstance().applyTo(link); final Label separator = toolkit.createLabel(composite, "|", SWT.VERTICAL); //$NON-NLS-1$ GridDataBuilder.newInstance().vFill().applyTo(separator); // Create the new query hyper-link. final String title = Messages.getString("TeamExplorerWorkItemsQueriesSection.NewQueryLinkText"); //$NON-NLS-1$ final Hyperlink newQueryHyperlink = toolkit.createHyperlink(composite, title, SWT.WRAP); newQueryHyperlink.setUnderlined(false); newQueryHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e) { WorkItemHelpers.openNewQuery(context); } }); GridDataBuilder.newInstance().applyTo(newQueryHyperlink); CodeMarkerDispatch.dispatch(WORKITEMS_PAGE_LOADED); return composite; }
@Override public Composite getPageContent( final FormToolkit toolkit, final Composite parent, final int style, final TeamExplorerContext context) { final Composite composite = toolkit.createComposite(parent); // Form-style border painting not enabled (0 pixel margins OK) because // no applicable controls in this composite SWTUtil.gridLayout(composite, 1, true, 0, 5); final Hyperlink link = toolkit.createHyperlink( composite, Messages.getString("TeamExplorerReportsSection.GoToReportsSite"), //$NON-NLS-1$ SWT.WRAP); link.setUnderlined(false); link.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e) { final TFSTeamProjectCollection connection = context.getServer().getConnection(); final GUID projectGUID = new GUID(context.getCurrentProjectInfo().getGUID()); final String folderPath = ReportUtils.getProjectReportFolder(connection, projectGUID); final String reportManagerUrl = ReportUtils.getReportManagerURL(context.getServer().getConnection()); final String path = ReportUtils.formatReportManagerPath(reportManagerUrl, folderPath); ReportsHelper.openReport(composite.getShell(), path); } }); return composite; }
@Override public Composite getPageContent( final FormToolkit toolkit, final Composite parent, final int style, final TeamExplorerContext context) { final Composite composite = toolkit.createComposite(parent); // Form-style border painting not enabled (0 pixel margins OK) because // no applicable controls in this composite SWTUtil.gridLayout(composite, 1, true, 0, 5); final Hyperlink link = toolkit.createHyperlink( composite, Messages.getString("TeamExplorerDocumentsPage.ShowProjectPortal"), //$NON-NLS-1$ SWT.WRAP); link.setUnderlined(false); link.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e) { final TFSTeamProjectCollection connection = context.getServer().getConnection(); final ProjectInfo projectInfo = context.getCurrentProjectInfo(); final String path = WSSUtils.getWSSURL(connection, projectInfo); Launcher.launch(path); } }); return composite; }
@Override public void createCompositeHeader( final FormToolkit toolkit, final Composite composite, final TeamExplorerContext context) { final Composite headerComposite = toolkit.createComposite(composite); // Form-style border painting not enabled (0 pixel margins OK) because // no applicable controls in this composite SWTUtil.gridLayout(headerComposite, 3, false, 0, 0); GridDataBuilder.newInstance().applyTo(headerComposite); final String title = Messages.getString("TeamExplorerPendingChangesIncludedSection.ExcludeAllLinkText"); //$NON-NLS-1$ final Hyperlink includeAllHyperlink = toolkit.createHyperlink(headerComposite, title, SWT.WRAP); includeAllHyperlink.setUnderlined(false); AutomationIDHelper.setWidgetID(includeAllHyperlink, EXCLUDE_ALL_HYPERLINK_ID); includeAllHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e) { getModel().excludeAllPendingChanges(); clearFilterTextbox(); TeamExplorerHelpers.updateContainingSectionTitle(treeComposite, getTitle()); } }); GridDataBuilder.newInstance().applyTo(includeAllHyperlink); final Label separator = toolkit.createLabel(headerComposite, "|", SWT.VERTICAL); //$NON-NLS-1$ GridDataBuilder.newInstance().vFill().applyTo(separator); final String linkText = Messages.getString("TeamExplorerPendingChangesIncludedSection.FilterLinkText"); //$NON-NLS-1$ final Menu menu = createFilterMenu(composite.getShell()); final ImageHyperlink link = PageHelpers.createDropHyperlink(toolkit, headerComposite, linkText, menu); GridDataBuilder.newInstance().applyTo(link); }
private Hyperlink createFilterHyperlink( final Composite parent, final FormToolkit toolkit, final String text, final String filter, final String localizedValue, final String tooltip) { final Hyperlink link = toolkit.createHyperlink(parent, text, SWT.NONE); link.setToolTipText(tooltip); // Pack the data in the href object link.setHref(new String[] { filter, localizedValue }); link.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e) { if (searchControl.isDisposed()) { return; } final String[] values = (String[]) e.getHref(); searchControl.appendFilter(values[0], values[1]); } }); return link; }
public String getPrefix(final Control c) { final Composite parent = c.getParent(); final Control[] siblings = parent.getChildren(); for (int i = 0; i < siblings.length; i++) { if (siblings[i] == c) { // this is us - go backward until you hit // a label-like widget for (int j = i - 1; j >= 0; j--) { final Control label = siblings[j]; String ltext = null; if (label instanceof Label) { ltext = ((Label) label).getText(); } else if (label instanceof Hyperlink) { ltext = ((Hyperlink) label).getText(); } else if (label instanceof CLabel) { ltext = ((CLabel) label).getText(); } if (ltext != null) { if (!ltext.endsWith(":")) //$NON-NLS-1$ return ltext + ": "; //$NON-NLS-1$ return ltext + " "; //$NON-NLS-1$ } } break; } } return null; }
/** * 'Associates' the given hyper-link with the given text. * * This method should be called instead of calling <code>setText</code> * on the hyper-link. By using this method, the text shown in the hyper-link * will be updated immediately when the given text is changed. */ public void associate(final Hyperlink link, ITranslatableText localizableText) { associate(link, new TranslatableTextInput(localizableText) { @Override public void updateControl(String text) { link.setText(text); } }); }
@Override public Control createControl(Composite parent) { Hyperlink link = toolkit.createHyperlink(parent, hyperlinkText, SWT.NONE); link.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { execute(); } }); return link; }
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(); }
private void forInputParameter(Composite comp) { doubleText(comp, M.Value, "value"); UI.formLabel(comp, toolkit, M.Uncertainty); Hyperlink link = UI.formLink(comp, toolkit, UncertaintyLabel.get(getModel().getUncertainty())); Controls.onClick(link, e -> { UncertaintyDialog dialog = new UncertaintyDialog(UI.shell(), getModel().getUncertainty()); if (dialog.open() != IDialogConstants.OK_ID) return; getModel().setUncertainty(dialog.getUncertainty()); link.setText(UncertaintyLabel.get(getModel().getUncertainty())); getEditor().setDirty(true); }); UI.filler(comp, toolkit); }
@Override protected void makeLink(Composite comp) { Hyperlink link = new Hyperlink(comp, SWT.NONE); link.setText(M.ErrorPopupMessage); link.setForeground(comp.getDisplay().getSystemColor(SWT.COLOR_BLUE)); Controls.onClick(link, evt -> { try { File workspaceDir = Platform.getLocation().toFile(); File logFile = new File(workspaceDir, "log.html"); Desktop.browse(logFile.toURI().toString()); } catch (Exception e) { log.error("Writing file failed", e); } }); }
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); } }); }
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; }
@Override protected Control createDialogArea(Composite parent){ Composite ret = new Composite(parent, SWT.NONE); ret.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); ret.setLayout(new GridLayout(2, false)); Hyperlink hb = UiDesk.getToolkit().createHyperlink(ret, Messages.getString("RechnungsPrefs.FinanceInst"), SWT.NONE); //$NON-NLS-1$ hb.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e){ KontaktSelektor ksl = new KontaktSelektor(getShell(), Organisation.class, Messages .getString("RechnungsPrefs.paymentinst"), Messages .getString("RechnungsPrefs.PleseChooseBank"), new String[] { Organisation.FLD_NAME1, Organisation.FLD_NAME2 }); //$NON-NLS-1$ //$NON-NLS-2$ if (ksl.open() == Dialog.OK) { actBank = (Kontakt) ksl.getSelection(); actMandant.setInfoElement(ta.RNBANK, actBank.getId()); setMandant(actMandant); exTable.setKontakt(actMandant); } } }); banklabel = new Label(ret, SWT.NONE); banklabel.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); exTable = new KontaktExtDialog.ExtInfoTable(parent, flds); exTable.setLayoutData(SWTHelper.getFillGridData(2, true, 1, true)); exTable.setKontakt(actMandant); return ret; }
@Override protected void hookAddToDialogArea(final Composite dialogArea) { final GridLayout layout = new GridLayout(3, false); layout.marginWidth = getHorizontalMargin(); layout.marginHeight = getVerticalMargin(); layout.horizontalSpacing = getHorizontalSpacing(); layout.verticalSpacing = getVerticalSpacing(); dialogArea.setLayout(layout); final Label verificationUrlLabel = SWTUtil.createLabel(dialogArea, Messages.getString("OAuth2DeviceFlowCallbackDialog.DeviceLoginUrlText")); //$NON-NLS-1$ GridDataBuilder.newInstance().hSpan(layout).hFill().hGrab().applyTo(verificationUrlLabel); final String urlLinkText = this.response.getVerificationUri().toString(); final Hyperlink verificationUrlLink = this.toolkit.createHyperlink(dialogArea, urlLinkText, SWT.WRAP | SWT.CENTER); GridDataBuilder.newInstance().hSpan(layout).hAlignCenter().applyTo(verificationUrlLink); verificationUrlLink.setUnderlined(false); verificationUrlLink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(final HyperlinkEvent e) { try { PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(e.getLabel())); } catch (PartInitException pie) { log.error("Failed to open the verification url in browser.", pie); //$NON-NLS-1$ } catch (MalformedURLException mue) { log.error("Failed to open the verification url in browser: " + e.getLabel(), mue); //$NON-NLS-1$ } } }); final Label codeNameLabel = SWTUtil.createLabel( dialogArea, MessageFormat.format( Messages.getString("OAuth2DeviceFlowCallbackDialog.DeviceUserCodeTextFormat"), //$NON-NLS-1$ this.response.getExpiresIn() / 60)); GridDataBuilder.newInstance().hSpan(layout).hFill().hGrab().applyTo(codeNameLabel); final Text deviceCodeText = new Text(dialogArea, SWT.READ_ONLY | SWT.BORDER); GridDataBuilder.newInstance().hSpan(layout).hFill().applyTo(deviceCodeText); deviceCodeText.setText(this.response.getUserCode()); deviceCodeText.setFocus(); final Label finishFlowLabel = SWTUtil.createLabel(dialogArea, Messages.getString("OAuth2DeviceFlowCallbackDialog.SelectOkText")); //$NON-NLS-1$ GridDataBuilder.newInstance().hSpan(layout).hFill().hGrab().applyTo(finishFlowLabel); }
protected Control createDialogArea(Composite parent) { getShell().setText(Messages.LoadErrorDialog_0); Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label problemLabel = new Label(composite, SWT.WRAP); problemLabel.setText(Messages.LoadErrorDialog_1); GridData gd = new GridData(); gd.widthHint = 500; problemLabel.setLayoutData(gd); new Label(composite, SWT.NONE); Label linkLabel = new Label(composite, SWT.WRAP); linkLabel.setText(Messages.LoadErrorDialog_2); gd = new GridData(); gd.widthHint = 500; linkLabel.setLayoutData(gd); new Label(composite, SWT.NONE); FormToolkit toolkit = new FormToolkit(parent.getDisplay()); toolkit.setBackground(parent.getBackground()); Hyperlink infoLink = toolkit.createHyperlink(composite, "http://subclipse.tigris.org/wiki/JavaHL", SWT.NONE); //$NON-NLS-1$ infoLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent evt) { try { PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("http://subclipse.tigris.org/wiki/JavaHL")); //$NON-NLS-1$ } catch (Exception e) {} } }); new Label(composite, SWT.NULL); Group errorGroup = new Group(composite, SWT.NULL); GridLayout errorLayout = new GridLayout(); errorGroup.setLayout(errorLayout); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); errorGroup.setLayoutData(gd); errorGroup.setText(Messages.LoadErrorDialog_4); Text errorText = new Text(errorGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL); gd.heightHint = 300; errorText.setLayoutData(gd); if (loadErrors != null) { errorText.setText(loadErrors); } return composite; }
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); }
protected Control createDialogArea(Composite parent) { getShell().setText(Messages.UnsupportedPasswordStoresDialog_0); Composite composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Label problemLabel = new Label(composite, SWT.WRAP); problemLabel.setText(Messages.UnsupportedPasswordStoresDialog_1); GridData gd = new GridData(); gd.widthHint = 500; problemLabel.setLayoutData(gd); new Label(composite, SWT.NONE); Composite linkGroup = new Composite(composite, SWT.NULL); GridLayout linkLayout = new GridLayout(); linkLayout.numColumns = 2; linkLayout.marginWidth = 0; linkLayout.marginHeight = 0; linkGroup.setLayout(linkLayout); gd = new GridData(GridData.FILL_HORIZONTAL); linkGroup.setLayoutData(gd); Label linkLabel = new Label(linkGroup, SWT.NONE); linkLabel.setText(Messages.UnsupportedPasswordStoresDialog_2); FormToolkit toolkit = new FormToolkit(parent.getDisplay()); toolkit.setBackground(parent.getBackground()); Hyperlink infoLink = toolkit.createHyperlink(linkGroup, Messages.UnsupportedPasswordStoresDialog_3, SWT.NONE); infoLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent evt) { try { PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("http://subclipse.tigris.org/wiki/JavaHL#head-3a1d2d3c54791d2d751794e5d6645f1d77d95b32")); //$NON-NLS-1$ } catch (Exception e) {} } }); new Label(linkGroup, SWT.NONE); Group configGroup = new Group(composite, SWT.NULL); GridLayout configLayout = new GridLayout(); configLayout.numColumns = 2; configLayout.marginWidth = 0; configLayout.marginHeight = 0; configGroup.setLayout(configLayout); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); configGroup.setLayoutData(gd); configGroup.setText(Messages.UnsupportedPasswordStoresDialog_5); Label fileLabel = new Label(configGroup, SWT.NONE); fileLabel.setText(Messages.UnsupportedPasswordStoresDialog_6); Text fileText = new Text(configGroup, SWT.READ_ONLY | SWT.BORDER); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.setText(SVNUIPlugin.getPlugin().getConfigFile().getAbsolutePath()); Label storesLabel = new Label(configGroup, SWT.NONE); storesLabel.setText(Messages.UnsupportedPasswordStoresDialog_7); Text storesText = new Text(configGroup, SWT.READ_ONLY | SWT.BORDER); gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); storesText.setLayoutData(gd); String passwordStores = SVNUIPlugin.getPlugin().getPasswordStores(); if (passwordStores == null) { passwordStores = "gnome-keyring"; } storesText.setText(passwordStores); new Label(composite, SWT.NONE); Label editLabel = new Label(composite, SWT.WRAP); editLabel.setText(Messages.UnsupportedPasswordStoresDialog_8); gd = new GridData(); gd.widthHint = 500; editLabel.setLayoutData(gd); fileText.setFocus(); return composite; }
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); }
@Override protected Control createDialogArea(Composite parent) { Composite container = new Composite(parent, SWT.NONE); UI.gridLayout(container, 3); UI.formLabel(container, M.ServerUrl); ConfigViewer configViewer = new ConfigViewer(container); configViewer.setInput(CloudConfigurations.get()); configViewer.addSelectionChangedListener((config) -> { if (config == null) { serverUrl = null; username = null; password = null; return; } serverUrl = config.getUrl(); username = config.getUser(); password = config.getPassword(); checkValid(); }); configViewer.select(CloudConfigurations.getDefault()); Hyperlink editConfig = UI.formLink(container, 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()); } }); Text repoText = UI.formText(container, M.RepositoryPath); repoText.addModifyListener((event) -> { repositoryId = repoText.getText(); if (repositoryId != null) repositoryId.trim(); checkValid(); }); if (username != null) { repoText.setText(username + "/" + Database.get().getName()); } return container; }
public static Hyperlink formLink(Composite parent, String label) { return formLink(parent, null, label); }
/** * 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; }