Java Code Examples for org.eclipse.swt.widgets.Link#setFont()
The following examples show how to use
org.eclipse.swt.widgets.Link#setFont() .
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: 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 2
Source File: NewJavaProjectWizardPageOne.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public Control createControl(Composite composite) { fGroup= new Group(composite, SWT.NONE); fGroup.setFont(composite.getFont()); fGroup.setLayout(initGridLayout(new GridLayout(2, false), true)); fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_title); fUseEEJRE.doFillIntoGrid(fGroup, 1); Combo eeComboControl= fEECombo.getComboControl(fGroup); eeComboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); fUseProjectJRE.doFillIntoGrid(fGroup, 1); Combo comboControl= fJRECombo.getComboControl(fGroup); comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); fUseDefaultJRE.doFillIntoGrid(fGroup, 1); fPreferenceLink= new Link(fGroup, SWT.NONE); fPreferenceLink.setFont(fGroup.getFont()); fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_link_description); fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false)); fPreferenceLink.addSelectionListener(this); updateEnableState(); return fGroup; }
Example 3
Source File: SortMembersMessageDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private Control createLinkControl(Composite composite) { Link link= new Link(composite, SWT.WRAP | SWT.RIGHT); link.setText(DialogsMessages.SortMembersMessageDialog_description); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openMembersSortOrderPage(); } }); link.setToolTipText(DialogsMessages.SortMembersMessageDialog_link_tooltip); GridData gridData= new GridData(GridData.FILL, GridData.CENTER, true, false); gridData.widthHint= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);//convertWidthInCharsToPixels(60); link.setLayoutData(gridData); link.setFont(composite.getFont()); return link; }
Example 4
Source File: OptionsConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
protected Link addLink(Composite parent, String label, Key key, SelectionListener linkListener, int indent, int widthHint) { GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.horizontalSpan= 3; gd.horizontalIndent= indent; gd.widthHint= widthHint; Link link= new Link(parent, SWT.NONE); link.setFont(JFaceResources.getDialogFont()); link.setText(label); link.setData(key); link.setLayoutData(gd); link.addSelectionListener(linkListener); makeScrollableCompositeAware(link); fLinks.add(link); return link; }
Example 5
Source File: BrowserEnvironmentWarningDialog.java From hop with Apache License 2.0 | 5 votes |
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) { link = new Link( shell, SWT.SINGLE | SWT.WRAP ); link.setText( helpLink ); if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) { FontData[] fD = link.getFont().getFontData(); fD[ 0 ].setHeight( 13 ); link.setFont( new Font( display, fD[ 0 ] ) ); } FormData fdlink = new FormData(); fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon fdlink.top = new FormAttachment( description, margin ); fdlink.width = maxTextWidth; link.setLayoutData( fdlink ); props.setLook( link ); link.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { if ( Desktop.isDesktopSupported() ) { try { Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) ); } catch ( Exception e ) { log.logError( "Error opening external browser", e ); } } } } ); }
Example 6
Source File: SWTFactory.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
/** * Creates a new link widget * @param parent the parent composite to add this link widget to * @param text the text for the link * @param hspan the horizontal span to take up in the parent composite * @return the new link */ public static Link createLink(Composite parent, String text, int hspan, SelectionAdapter listener) { Link l = new Link(parent, SWT.NONE); l.setFont(parent.getFont()); l.setText(text); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = hspan; gd.grabExcessHorizontalSpace = false; l.setLayoutData(gd); l.addSelectionListener(listener); return l; }
Example 7
Source File: SWTFactory.java From tlaplus with MIT License | 5 votes |
public static Link createLink(Composite parent, String text, Font font, int hspan, int fill) { Link l = new Link(parent, SWT.UNDERLINE_LINK); l.setFont(font); l.setText(text); GridData gd = new GridData(fill); gd.horizontalSpan = hspan; l.setLayoutData(gd); return l; }
Example 8
Source File: DomainStatusLabel.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void createLink(DomainStatus status) { link = new Link(this, SWT.NONE); link.setFont(DOMAIN_STATUS_FONT); link.setBackground(ColorConstants.white); link.setText(getMessage(status)); link.setForeground(getSeverityColor(status.getSeverity())); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { status.handleLink(); } }); }
Example 9
Source File: ToolkitControl.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
private void initControl() { GridLayoutFactory.fillDefaults().numColumns(3).spacing(3, 2).applyTo(this); GridLayout layout = (GridLayout) this.getLayout(); layout.marginLeft = 7; layout.marginTop = 2; layout.marginBottom = 2; Label iconLabel = new Label(this, SWT.NULL); iconLabel.setBackground(getBackground()); GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.BEGINNING).span(1, 2).applyTo( iconLabel); listenTo(iconLabel); Link nameLabel = new Link(this, SWT.NONE); nameLabel.setText(wbToolkit.getName()); nameLabel.setBackground(getBackground()); nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); nameLabel.setFont(getBoldFont(getFont())); listenTo(nameLabel); Label providerLabel = new Label(this, SWT.NONE); providerLabel.setText(wbToolkit.getProviderDescription()); providerLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); providerLabel.setBackground(getBackground()); providerLabel.setForeground(Display.getDefault().getSystemColor( SWT.COLOR_GRAY)); listenTo(providerLabel); Label summaryLabel = new Label(this, SWT.WRAP); String description = stripCRLF(wbToolkit.getDescription()); summaryLabel.setText(description); summaryLabel.setBackground(getBackground()); GridDataFactory.fillDefaults().grab(true, false).span(2, 1).hint(100, SWT.DEFAULT).applyTo(summaryLabel); listenTo(summaryLabel); listenTo(this); }
Example 10
Source File: EditboxPreferencePage.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected Control createContents(final Composite parent) { noDefaultAndApplyButton(); final Composite c = new Composite(parent, SWT.NONE); c.setLayout(new GridLayout(1, false)); final Link link = new Link(c, SWT.NONE); link.setText("Turn off current line highlighting <A>here</A>."); final FontData[] fontData = link.getFont().getFontData(); for (final FontData fd : fontData) { fd.setHeight(10); fd.setStyle(SWT.BOLD); } link.setFont(new Font(getShell().getDisplay(), fontData)); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer(); container.openPage("org.eclipse.ui.preferencePages.GeneralTextEditor", null); } }); folder = new TabFolder(c, SWT.NONE); folder.setLayoutData(new GridData(GridData.FILL_BOTH)); final TabItem ti = new TabItem(folder, SWT.NONE); ti.setText("Themes"); ti.setControl(createCategoryControl(folder)); folder.pack(); return c; }
Example 11
Source File: BrowserEnvironmentWarningDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) { link = new Link( shell, SWT.SINGLE | SWT.WRAP ); link.setText( helpLink ); if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) { FontData[] fD = link.getFont().getFontData(); fD[0].setHeight( 13 ); link.setFont( new Font( display, fD[0] ) ); } FormData fdlink = new FormData(); fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon fdlink.top = new FormAttachment( description, margin ); fdlink.width = maxTextWidth; link.setLayoutData( fdlink ); props.setLook( link ); link.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { if ( Desktop.isDesktopSupported() ) { try { Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) ); } catch ( Exception e ) { log.logError( "Error opening external browser", e ); } } } } ); }
Example 12
Source File: CompilationUnitEditor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * Opens a warning dialog informing about a failure during handling of save listeners. * * @param title the dialog title * @param message the message to display * @param exception the exception to handle * @since 3.4 */ private void openSaveListenerWarningDialog(String title, String message, CoreException exception) { final String linkText; final IJavaProject javaProject= getInputJavaElement().getJavaProject(); IProject project= javaProject != null ? javaProject.getProject() : null; final boolean hasProjectSettings= project != null && CleanUpPreferenceUtil.hasSettingsInScope(new ProjectScope(project)); if (exception.getStatus().getCode() == IJavaStatusConstants.EDITOR_POST_SAVE_NOTIFICATION) { message= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_message; if (hasProjectSettings) linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_property_link; else linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_link; } else { message= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_message; if (hasProjectSettings) linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_property_link; else linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_link; } IStatus status= exception.getStatus(); int mask= IStatus.WARNING | IStatus.ERROR; ErrorDialog dialog= new ErrorDialog(getSite().getShell(), title, message, status, mask) { @Override protected Control createMessageArea(Composite parent) { Control result= super.createMessageArea(parent); // Panic code: use 'parent' instead of 'result' in case super implementation changes in the future new Label(parent, SWT.NONE); // filler as parent has 2 columns (icon and label) Link link= new Link(parent, SWT.NONE); link.setText(linkText); link.setFont(parent.getFont()); link.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (hasProjectSettings) PreferencesUtil.createPropertyDialogOn(getShell(), javaProject, SaveParticipantPreferencePage.PROPERTY_PAGE_ID, null, null).open(); else PreferencesUtil.createPreferenceDialogOn(getShell(), SaveParticipantPreferencePage.PREFERENCE_PAGE_ID, null, null).open(); } }); GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false); link.setLayoutData(gridData); return result; } @Override protected Image getImage() { return getWarningImage(); } }; dialog.open(); }
Example 13
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 14
Source File: SWTFactory.java From tlaplus with MIT License | 3 votes |
/** * Creates a new link widget * * @param parent the parent composite to add this label widget to * @param text the text for the label * @param font the font for the label * @param hspan the horizontal span to take up in the parent composite * @return the new label */ public static Link createLink(Composite parent, String text, Font font, int hspan) { Link l = new Link(parent, SWT.UNDERLINE_LINK); l.setFont(font); l.setText(text); GridData gd = new GridData(GridData.BEGINNING, GridData.VERTICAL_ALIGN_CENTER, true, false, hspan, 1); l.setLayoutData(gd); return l; }