Java Code Examples for org.eclipse.swt.widgets.Link#setText()
The following examples show how to use
org.eclipse.swt.widgets.Link#setText() .
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: GenerateConstructorUsingFieldsSelectionDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createLinkControl(Composite composite) { Link link= new Link(composite, SWT.WRAP); link.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_template_link_message); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openCodeTempatePage(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID); } }); link.setToolTipText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_template_link_tooltip); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it link.setLayoutData(gridData); return link; }
Example 2
Source File: DocumentWizardPage.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void createDocumentManageMimeTypeLink(final Composite parent) { manageLinkComposite = new Composite(parent, SWT.NONE); manageLinkComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).create()); manageLinkComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); manageLink = new Link(manageLinkComposite, SWT.NONE); manageLink.setLayoutData(GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).grab(true, false).create()); manageLink.setText("<A>" + Messages.manageMimeType + "</A>"); manageLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent arg0) { updateMimeTypeStack(FIELD); } }); }
Example 3
Source File: StatusWidget.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected void createControls() { setLayout(new GridLayout(2, false)); imageLabel = new Label(this, SWT.NONE); imageLabel.setText(" "); GridData imgLabelLayoutData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); imgLabelLayoutData.widthHint = 20; imageLabel.setLayoutData(imgLabelLayoutData); link = new Link(this, SWT.NONE); GridData linkLayoutData = new GridData(GridData.FILL_HORIZONTAL); linkLayoutData.heightHint = 40; link.setLayoutData(linkLayoutData); link.setFont(getFont()); link.setText("\n\n\n"); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { super.widgetSelected(e); quickFix.apply(); } }); }
Example 4
Source File: AddUnimplementedConstructorsAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override protected Control createLinkControl(Composite composite) { Link link= new Link(composite, SWT.WRAP); link.setText(ActionMessages.AddUnimplementedConstructorsAction_template_link_message); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openCodeTempatePage(CodeTemplateContextType.CONSTRUCTORCOMMENT_ID); } }); link.setToolTipText(ActionMessages.AddUnimplementedConstructorsAction_template_link_tooltip); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= convertWidthInCharsToPixels(40); // only expand further if anyone else requires it link.setLayoutData(gridData); return link; }
Example 5
Source File: PropertiesFileEditorPreferencePage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void createHeader(Composite contents) { String text= PreferencesMessages.PropertiesFileEditorPreferencePage_link; Link link= new Link(contents, SWT.NONE); link.setText(text); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if ("org.eclipse.ui.preferencePages.GeneralTextEditor".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null); else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$ PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, "selectFont:org.eclipse.jdt.ui.PropertiesFileEditor.textfont"); //$NON-NLS-1$ } }); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= 150; // only expand further if anyone else requires it link.setLayoutData(gridData); addFiller(contents); }
Example 6
Source File: OptionsConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected Link createIgnoreOptionalProblemsLink(Composite parent) { final IClasspathEntry sourceFolderEntry= getSourceFolderIgnoringOptionalProblems(); if (sourceFolderEntry != null) { Link link= new Link(parent, SWT.NONE); link.setText(PreferencesMessages.OptionsConfigurationBlock_IgnoreOptionalProblemsLink); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { HashMap<Object, Object> data= new HashMap<Object, Object>(1); data.put(BuildPathsPropertyPage.DATA_REVEAL_ENTRY, sourceFolderEntry); data.put(BuildPathsPropertyPage.DATA_REVEAL_ATTRIBUTE_KEY, IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS); getPreferenceContainer().openPage(BuildPathsPropertyPage.PROP_ID, data); } }); return link; } return null; }
Example 7
Source File: AbstractPage.java From nebula with Eclipse Public License 2.0 | 6 votes |
protected void addActionLink(PageContainer container, Composite parent, String text, SelectionAdapter selectionAdapter) { Composite wrap = new Composite(parent, SWT.NONE); wrap.setLayoutData( new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); container.adapt(wrap); GridLayout layout = new GridLayout(2, false); layout.marginLeft = 8; layout.marginHeight = 0; wrap.setLayout(layout); Label titleImage = new Label(wrap, SWT.WRAP); container.adapt(titleImage); Link link = new Link(wrap, SWT.NONE); container.adapt(link); link.setText(text); link.addSelectionListener(selectionAdapter); }
Example 8
Source File: HyperlinkMessageDialog.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
@Override protected Control createMessageArea(Composite composite) { String message = this.message; this.message = null; Composite messageArea = (Composite) super.createMessageArea(composite); messageLink = new Link(messageArea, getMessageLabelStyle() | SWT.NO_FOCUS); messageLink.setText("<a></a>" + message); //$NON-NLS-1$ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false) .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT) .applyTo(messageLink); messageLink.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { openLink(e); } }); return messageArea; }
Example 9
Source File: WSO2UIToolkit.java From developer-studio with Apache License 2.0 | 6 votes |
public static Link createLink(Composite container, String label, int columns, int horizontalAlignment, Integer verticalIndent, Integer horizontalIndent) { Link linkButton = new Link(container, SWT.CHECK); linkButton.setText(label); if (columns != -1) { GridData gridData = new GridData(); gridData.horizontalSpan = columns; gridData.grabExcessHorizontalSpace = true; gridData.horizontalAlignment = horizontalAlignment; // SWT.FILL; if (verticalIndent != null) { gridData.verticalIndent = verticalIndent; } if (horizontalIndent != null) { gridData.horizontalIndent = horizontalIndent; } linkButton.setLayoutData(gridData); } return linkButton; }
Example 10
Source File: MarkOccurrencesPreferencePage.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
@Override protected Control createContents(final Composite parent) { Composite composite= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); layout.numColumns= 1; layout.marginHeight= 0; layout.marginWidth= 0; composite.setLayout(layout); Link link= new Link(composite, SWT.NONE); link.setText(Messages.MarkOccurrencesPreferencePage_LinkText); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String data= null; AnnotationPreference preference= EditorsUI.getAnnotationPreferenceLookup().getAnnotationPreference("org.eclipse.jdt.ui.occurrences"); //$NON-NLS-1$ if (preference != null) data= preference.getPreferenceLabel(); PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, data); } }); SWTFactory.createLabel(composite, "", 1); //$NON-NLS-1$ cboxOnOff = SWTFactory.createCheckbox(composite, Messages.MarkOccurrencesPreferencePage_MarkOccurrencesOfElement, 1); initFromStore(); return composite; }
Example 11
Source File: CodeAssistConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void createPreferencePageLink(Composite composite, String label, final Map<String, String> targetInfo) { final Link link= new Link(composite, SWT.NONE); link.setText(label); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(link.getShell(), e.text, null, targetInfo); } }); }
Example 12
Source File: WinEmulatorStatusHandler.java From thym with Eclipse Public License 1.0 | 5 votes |
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridLayout layout = (GridLayout) composite.getLayout(); layout.numColumns = 1; Link desc = new Link(composite, SWT.NONE); desc.setText(Messages.WinEmulatorsStatusHandler_Message); desc.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Program.launch(WinConstants.SDK_DOWNLOAD_URL); } }); getShell().setText(Messages.WinEmulatorsStatusHandler_Title); return composite; }
Example 13
Source File: PropToPrefLinkArea.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public PropToPrefLinkArea(Composite parent, int style, final String pageId, String message, final Shell shell, final Object pageData) { /* * breaking new ground yet again - want to link between property and preference paes. ie: project specific debug * engine options to general debugging options */ pageLink = new Link(parent, style); IPreferenceNode node = getPreferenceNode(pageId); String result; if (node == null) { result = NLS.bind(WorkbenchMessages.PreferenceNode_NotFound, pageId); } else { result = MessageFormat.format(message, node.getLabelText()); // only add the selection listener if the node is found pageLink.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(shell, pageId, new String[] { pageId }, pageData).open(); } }); } pageLink.setText(result); }
Example 14
Source File: CloudSdkUpdateNotification.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Override protected void createContentArea(Composite parent) { Link message = new Link(parent, SWT.WRAP); message.setText(Messages.getString("CloudSdkUpdateNotificationMessage", sdkVersion)); message.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); message.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { linkSelected(event.text); } }); }
Example 15
Source File: WinBuildStatusHandler.java From thym with Eclipse Public License 1.0 | 5 votes |
protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); GridLayout layout = (GridLayout) composite.getLayout(); layout.numColumns = 1; Link desc = new Link(composite, SWT.NONE); desc.setText(Messages.WinBuildStatusHandler_Message); desc.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Program.launch(WinConstants.SDK_DOWNLOAD_URL); } }); getShell().setText(Messages.WinBuildStatusHandler_Title); return composite; }
Example 16
Source File: CompletionProposalComputerRegistry.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Log the status and inform the user about a misbehaving extension. * * @param descriptor the descriptor of the misbehaving extension * @param status a status object that will be logged */ void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) { JavaPlugin.log(status); String title= JavaTextMessages.CompletionProposalComputerRegistry_error_dialog_title; CompletionProposalCategory category= descriptor.getCategory(); IContributor culprit= descriptor.getContributor(); Set<String> affectedPlugins= getAffectedContributors(category, culprit); final String avoidHint; final String culpritName= culprit == null ? null : culprit.getName(); if (affectedPlugins.isEmpty()) avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint, new Object[] {culpritName, category.getDisplayName()}); else avoidHint= Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning, new Object[] {culpritName, category.getDisplayName(), toString(affectedPlugins)}); String message= status.getMessage(); // inlined from MessageDialog.openError MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(), title, null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) { @Override protected Control createCustomArea(Composite parent) { Link link= new Link(parent, SWT.NONE); link.setText(avoidHint); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { PreferencesUtil.createPreferenceDialogOn(getShell(), "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null).open(); //$NON-NLS-1$ } }); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); gridData.widthHint= this.getMinimumMessageWidth(); link.setLayoutData(gridData); return link; } }; dialog.open(); }
Example 17
Source File: VersionDialog.java From logbook with MIT License | 4 votes |
/** * Create contents of the dialog. */ private void createContents() { this.shell = new Shell(this.getParent(), this.getStyle()); this.shell.setText(this.getText()); this.shell.setLayout(new GridLayout(1, false)); // バージョン Group versionGroup = new Group(this.shell, SWT.NONE); versionGroup.setText("バージョン"); versionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); versionGroup.setLayout(new GridLayout(2, true)); label(AppConstants.NAME, versionGroup); label(AppConstants.VERSION.toString(), versionGroup); Link gowebsite = new Link(versionGroup, SWT.NONE); gowebsite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, SWT.CENTER, false, false, 2, 1)); gowebsite.setText("<a>クリックするとウェブサイトに移動します</a>"); gowebsite.addSelectionListener((SelectedListener) e -> { try { Desktop.getDesktop().browse(AppConstants.HOME_PAGE_URI); } catch (Exception ex) { } }); // 設定 Group appGroup = new Group(this.shell, SWT.NONE); appGroup.setText("設定"); appGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); appGroup.setLayout(new GridLayout(2, true)); label("鎮守府サーバー", appGroup); label(StringUtils.defaultString(Filter.getServerName(), "未設定"), appGroup); // 設定 Group javaGroup = new Group(this.shell, SWT.NONE); javaGroup.setText("環境"); javaGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); javaGroup.setLayout(new GridLayout(2, true)); double totalMemory = ((double) Runtime.getRuntime().totalMemory()) / 1024 / 1024; double freeMemory = ((double) Runtime.getRuntime().freeMemory()) / 1024 / 1024; label("利用可能メモリサイズ", javaGroup); label(Long.toString(Math.round(totalMemory)) + " MB", javaGroup); label("利用中メモリサイズ", javaGroup); label(Long.toString(Math.round(totalMemory - freeMemory)) + " MB", javaGroup); label("os.name", javaGroup); label(SystemUtils.OS_NAME, javaGroup); label("os.version", javaGroup); label(SystemUtils.OS_VERSION, javaGroup); label("java.vendor", javaGroup); label(SystemUtils.JAVA_VENDOR, javaGroup); label("java.version", javaGroup); label(SystemUtils.JAVA_VERSION, javaGroup); this.shell.pack(); }
Example 18
Source File: CodewindConnectionComposite.java From codewind-eclipse with Eclipse Public License 2.0 | 4 votes |
protected void createControl() { GridLayout layout = new GridLayout(); layout.numColumns = 2; layout.marginHeight = 20; layout.marginWidth = 8; layout.horizontalSpacing = 7; layout.verticalSpacing = 7; this.setLayout(layout); createLabel(Messages.CodewindConnectionComposite_ConnNameLabel, this, 1); connNameText = createConnText(this, SWT.NONE, 1); createLabel(Messages.CodewindConnectionComposite_UrlLabel, this, 1); connURLText = createConnText(this, SWT.NONE, 1); createLabel(Messages.CodewindConnectionComposite_UserLabel, this, 1); connUserText = createConnText(this, SWT.NONE, 1); createLabel(Messages.CodewindConnectionComposite_PasswordLabel, this, 1); connPassText = createConnText(this, SWT.PASSWORD, 1); new Label(this, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1)); Link learnMoreLink = new Link(this, SWT.NONE); learnMoreLink.setText("<a>" + Messages.RegMgmtLearnMoreLink + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ learnMoreLink.setLayoutData(new GridData(GridData.BEGINNING, GridData.END, false, false, 1, 1)); learnMoreLink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { try { IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport(); IWebBrowser browser = browserSupport.getExternalBrowser(); URL url = new URL(UIConstants.REMOTE_SETUP_URL); browser.openURL(url); } catch (Exception e) { Logger.logError("An error occurred trying to open an external browser at: " + UIConstants.TEMPLATES_INFO_URL, e); //$NON-NLS-1$ } } }); // Add Context Sensitive Help PlatformUI.getWorkbench().getHelpSystem().setHelp(this, CodewindUIPlugin.MAIN_CONTEXTID); initialize(); connNameText.setFocus(); }
Example 19
Source File: IssueInformationPage.java From sarl with Apache License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { // create a composite with standard margins and spacing final Composite composite = new Composite(parent, SWT.NONE); final GridLayout layout = new GridLayout(); layout.numColumns = 2; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); if (this.link != null) { final Link linkWidget = new Link(composite, SWT.BORDER); linkWidget.setText(MessageFormat.format(Messages.IssueInformationPage_9, this.link.toString())); linkWidget.setFont(composite.getFont()); final GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; linkWidget.setLayoutData(gd); linkWidget.addSelectionListener(new SelectionAdapter() { @SuppressWarnings("synthetic-access") @Override public void widgetSelected(SelectionEvent event) { try { final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser(); browser.openURL(IssueInformationPage.this.link); final IWizard wizard = IssueInformationPage.this.getWizard(); if (wizard instanceof SubmitEclipseLogWizard) { final WizardDialog dialog = ((SubmitEclipseLogWizard) wizard).getWizardDialog(); if (dialog != null) { dialog.close(); } } } catch (PartInitException e) { // } } }); } SWTFactory.createLabel(composite, Messages.IssueInformationPage_1, 1); this.titleField = SWTFactory.createSingleText(composite, 1); SWTFactory.createLabel(composite, Messages.IssueInformationPage_2, 1); this.descriptionField = SWTFactory.createText(composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL, 1); this.descriptionField.setLayoutData(new GridData(GridData.FILL_BOTH)); SWTFactory.createLabel(composite, Messages.IssueInformationPage_3, 1); this.trackerLogin = SWTFactory.createSingleText(composite, 1); SWTFactory.createLabel(composite, Messages.IssueInformationPage_4, 1); this.trackerPassword = SWTFactory.createSingleText(composite, 1); this.trackerPassword.setEchoChar(ECHO_CHAR); //add the listeners now to prevent them from monkeying with initialized settings this.titleField.addModifyListener(listeningEvent -> { updatePageStatus(); }); this.descriptionField.addModifyListener(listeningEvent -> { updatePageStatus(); }); this.trackerLogin.addModifyListener(listeningEvent -> { updatePageStatus(); }); this.trackerPassword.addModifyListener(listeningEvent -> { updatePageStatus(); }); Dialog.applyDialogFont(composite); setControl(composite); initFields(); updatePageStatus(); }
Example 20
Source File: NewTypeWizardPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 3 votes |
/** * Creates the controls for the preference page links. Expects a <code>GridLayout</code> with * at least 3 columns. * * @param composite the parent composite * @param nColumns number of columns to span * * @since 3.1 */ protected void createCommentControls(Composite composite, int nColumns) { Link link= new Link(composite, SWT.NONE); link.setText(NewWizardMessages.NewTypeWizardPage_addcomment_description); link.addSelectionListener(new TypeFieldsAdapter()); link.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, nColumns, 1)); DialogField.createEmptySpace(composite); fAddCommentButton.doFillIntoGrid(composite, nColumns - 1); }