org.eclipse.swt.widgets.Link Java Examples

The following examples show how to use org.eclipse.swt.widgets.Link. 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: ContractPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createBdmTipsSection(Composite parent) {
    final Section bdmTipsSection = getWidgetFactory().createSection(parent, Section.NO_TITLE);
    bdmTipsSection.setLayout(GridLayoutFactory.fillDefaults().create());
    bdmTipsSection.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create());

    CreateBusinessDataProposalListener createBusinessDataProposalListener = new CreateBusinessDataProposalListener();
    DocumentProposalListener documentProposalListener = new DocumentProposalListener();

    Link tips = new Link(bdmTipsSection, SWT.None);
    tips.setText(getBdmTipsMessage());
    getWidgetFactory().adapt(tips, true, true);
    tips.addListener(SWT.Selection, e -> {
        if (Objects.equals(e.text, "documents")) {
            documentProposalListener.handleEvent((EObject) poolSelectionProvider.getAdapter(EObject.class),
                    "");
        } else {
            createBusinessDataProposalListener.handleEvent((EObject) poolSelectionProvider.getAdapter(EObject.class),
                    "");
        }
    });
    selectionProvider.addSelectionChangedListener(e -> tips.setText(getBdmTipsMessage()));

    bdmTipsSection.setClient(tips);
}
 
Example #2
Source File: AbstractPage.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
protected Link addInfoText(PageContainer container, Composite parent,
		String text) {
	Link link = new Link(parent, SWT.WRAP | SWT.MULTI);
	container.adapt(link);
	GridData layoutData = new GridData(GridData.FILL, GridData.BEGINNING,
			true, false, 2, 1);
	link.setLayoutData(layoutData);
	link.setText(text);
	link.addListener(SWT.Selection, event -> {
		try {
			if (event.text != null && event.text.length() > 0) {
				Program.launch(event.text);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	});

	return link;
}
 
Example #3
Source File: AbstractPage.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
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 #4
Source File: SortMembersMessageDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 #5
Source File: YAMLPreferencePage.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	parent.setLayoutData(new GridData(SWT.NONE, SWT.TOP, true, false));
	Composite container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(1, false));
	Link yamlSchemasLink = new Link(container, SWT.NONE);
	yamlSchemasLink.setText("See <A>'Schemas'</A> to associate schemas to YAML files in the current workspace");
	yamlSchemasLink.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
		if (getContainer() instanceof IWorkbenchPreferenceContainer) {
			((IWorkbenchPreferenceContainer) getContainer())
					.openPage("org.eclipse.wildwebdeveloper.yaml.YAMLSchemaPreferencePage", null);
		}
	}));

	return parent;
}
 
Example #6
Source File: OverrideMethodDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(JavaUIMessages.OverrideMethodDialog_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.OVERRIDECOMMENT_ID);
		}
	});
	link.setToolTipText(JavaUIMessages.OverrideMethodDialog_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 #7
Source File: MessageArea.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected void createControls() {
	group = new Group(this, SWT.NONE);
	group.setLayout(new GridLayout(3, false));
	imageLabel = new Label(group, SWT.NONE);
	GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(imageLabel);
	textLabel = new Link(group, SWT.WRAP);
	textLabel.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			if (DOWNLOAD_LINK.equals(e.text)) {
				Program.launch(DOWNLOAD_LINK);
			} else {
				PreferenceDialog dialog = createPreferencePageDialog();
				dialog.open();
			}
		}
	});
	GridDataFactory.fillDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(textLabel);
	button = new Button(group, SWT.FLAT);
	button.setText("Download");
	GridDataFactory.fillDefaults().grab(false, false).align(SWT.END, SWT.CENTER).applyTo(button);
}
 
Example #8
Source File: CoreUtil.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public static Control addLinkToDialog(Composite parent, String linkLabel, String linkUrl) {
	Link link = new Link(parent, SWT.WRAP);
	link.setText("<a>" + linkLabel + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			try {
				IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
				IWebBrowser browser = browserSupport.getExternalBrowser();
				URL url = new URL(linkUrl);
				browser.openURL(url);
			} catch (Exception e) {
				Logger.logError("An error occurred trying to open an external browser at: " + link, e); //$NON-NLS-1$
			}
		}
	});
	return link;
}
 
Example #9
Source File: JavaEditorAppearanceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createHeader(Composite contents) {
	final Shell shell= contents.getShell();
	String text= PreferencesMessages.JavaEditorPreferencePage_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(shell, e.text, null, null);
			else if ("org.eclipse.ui.preferencePages.ColorsAndFonts".equals(e.text)) //$NON-NLS-1$
				PreferencesUtil.createPreferenceDialogOn(shell, e.text, null, "selectFont:org.eclipse.jdt.ui.editors.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 #10
Source File: CodeAssistAdvancedConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createKeysLink(Composite composite, int h_span) {
   Link link= new Link(composite, SWT.NONE | SWT.WRAP);
link.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_key_binding_hint);
link.addSelectionListener(new SelectionAdapter() {
	@Override
	public void widgetSelected(SelectionEvent e) {
		PreferencesUtil.createPreferenceDialogOn(getShell(), e.text, null, null);
	}
});

PixelConverter pixelConverter= new PixelConverter(composite);
int width= pixelConverter.convertWidthInCharsToPixels(40);

// limit the size of the Link as it would take all it can get
GridData gd= new GridData(GridData.FILL, GridData.FILL, false, false, h_span, 1);
gd.widthHint= width;
link.setLayoutData(gd);
  }
 
Example #11
Source File: DialogAbout.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a link.
 *
 * @param parent
 * @param text
 * @param tooltip
 * @param url
 */
private void createLink(Composite parent, String text, String tooltip, final String url){
    Link link = new Link(parent, SWT.NONE);
    link.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    link.setText(text);
    link.setToolTipText(tooltip);
    link.setBackground(parent.getBackground());
    link.addListener (SWT.Selection, new Listener () {
        public void handleEvent(Event event) {
            try {
                Program.launch(url);
            } catch (Exception e){
                /* Ignore*/
            }
        }
    });
}
 
Example #12
Source File: AbstractExampleTab.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void createLinks(Composite parent) {
	parent.setLayout(new GridLayout());

	String[] links = createLinks();

	if (links == null) {
		return;
	}

	for (String link2 : links) {
		Link link = new Link(parent, SWT.NONE);
		link.setText(link2);
		link.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				Program.launch(e.text);
			}
		});
	}
}
 
Example #13
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 #14
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 #15
Source File: PropertiesFileEditorPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 #16
Source File: FirefoxAttachTab.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
	super.createControl(parent);
	Control control = getControl();
	if (control instanceof Composite) {
		Composite composite = (Composite)control;
		Link label = new Link(composite, SWT.WRAP);
		label.setText(Messages.firefoxAttachNote);
		Layout layout = composite.getLayout();
		if (layout instanceof GridLayout) {
			GridLayout gridLayout = (GridLayout)layout;
			GridDataFactory.swtDefaults()
				.align(SWT.BEGINNING, SWT.TOP)
				.grab(true, false)
				.indent(0, 10)
				.span(gridLayout.numColumns, 1)
				.applyTo(label);
		}
	}
}
 
Example #17
Source File: GenerateConstructorUsingFieldsSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@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 #18
Source File: LinkComposite.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
public LinkComposite ( final Composite parent, final int style, final String format )
{
    super ( parent, style );

    final RowLayout layout = new RowLayout ();
    layout.wrap = false;
    layout.center = true;
    layout.spacing = 7;
    layout.pack = true;
    setLayout ( layout );

    this.textLabel = new Link ( this, SWT.NONE );
    this.textLabel.setText ( format );

    this.textLabel.addSelectionListener ( new SelectionAdapter () {

        @Override
        public void widgetSelected ( final SelectionEvent event )
        {
            logger.info ( "LinkComponent selected: {}", event.text ); //$NON-NLS-1$
            Program.launch ( event.text );
        }
    } );
}
 
Example #19
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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 #20
Source File: DebugPreferencePage.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	Composite container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(4, false));
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));

	gdbInput = new InputComponent(container, Messages.DebugPreferencePage_defaultGDB, e -> isPageValid());
	gdbInput.createComponent();
	gdbInput.createFileSelection();
	gdbInput.setValue(store.getString(CorrosionPreferenceInitializer.DEFAULT_GDB_PREFERENCE));

	Link gdbLink = new Link(container, SWT.NONE);
	gdbLink.setText(Messages.DebugPreferencePage_seeGDBPage);
	gdbLink.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
		IPreferencePageContainer prefContainer = getContainer();
		if (prefContainer instanceof IWorkbenchPreferenceContainer) {
			((IWorkbenchPreferenceContainer) prefContainer).openPage("org.eclipse.cdt.dsf.gdb.ui.preferences", //$NON-NLS-1$
					null);
		}
	}));
	gdbLink.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
	return parent;
}
 
Example #21
Source File: FlexDeployPreferencesDialog.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
  Composite area = (Composite) super.createDialogArea(parent);

  Composite container = new Composite(area, SWT.NONE);
  Link flexPricing = new Link(container, SWT.WRAP);
  flexPricing.setText(Messages.getString("deploy.preferences.dialog.flex.pricing")); //$NON-NLS-1$
  flexPricing.addSelectionListener(
      new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
  FontUtil.convertFontToItalic(flexPricing);

  GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
  Point margins = LayoutConstants.getMargins();
  GridLayoutFactory.fillDefaults()
      .extendedMargins(margins.x, margins.x, 0 /* no upper margin */, margins.y)
      .generateLayout(container);

  return area;
}
 
Example #22
Source File: DocumentWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createDocumentMimeTypeField(final Composite parent, final EMFDataBindingContext emfDataBindingContext) {
    mimeTypeComposition = new Composite(parent, SWT.NONE);
    mimeTypeComposition.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).create());
    mimeTypeComposition.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    final Label mimeTypeLabel = new Label(mimeTypeComposition, SWT.NONE);
    mimeTypeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create());
    mimeTypeLabel.setText(Messages.mimeType);

    documentMimeTypeViewer = createDocumentMIMETypeExpressionViewer(mimeTypeComposition);
    emfDataBindingContext.bindValue(
            ViewerProperties.singleSelection().observe(documentMimeTypeViewer),
            EMFObservables.observeValue(document,
                    ProcessPackage.Literals.DOCUMENT__MIME_TYPE));

    hideLink = new Link(mimeTypeComposition, SWT.NONE);
    hideLink.setText("<A>" + Messages.hideMimeType + "</A>");
    hideLink.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            updateMimeTypeStack(LINK);
        }
    });
}
 
Example #23
Source File: ProjectSelector.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
public ProjectSelector(Composite parent) {
  super(parent, SWT.NONE);
  GridLayoutFactory.fillDefaults().numColumns(2).spacing(0, 0).applyTo(this);

  Composite tableComposite = new Composite(this, SWT.NONE);
  TableColumnLayout tableColumnLayout = new TableColumnLayout();
  tableComposite.setLayout(tableColumnLayout);
  GridDataFactory.fillDefaults().grab(true, true).applyTo(tableComposite);
  viewer = new TableViewer(tableComposite, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
  createColumns(tableColumnLayout);
  viewer.getTable().setHeaderVisible(true);
  viewer.getTable().setLinesVisible(false);

  input = WritableList.withElementType(GcpProject.class);
  projectProperties = PojoProperties.values(new String[] {"name", "id"}); //$NON-NLS-1$ //$NON-NLS-2$
  ViewerSupport.bind(viewer, input, projectProperties);
  viewer.setComparator(new ViewerComparator());

  Composite linkComposite = new Composite(this, SWT.NONE);
  statusLink = new Link(linkComposite, SWT.WRAP);
  statusLink.addSelectionListener(
      new OpenUriSelectionListener(new ErrorDialogErrorHandler(getShell())));
  statusLink.setText("");
  GridDataFactory.fillDefaults().span(2, 1).applyTo(linkComposite);
  GridLayoutFactory.fillDefaults().generateLayout(linkComposite);
}
 
Example #24
Source File: AddGetterSetterAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.AddGetterSetterAction_template_link_description);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.GETTERCOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.AddGetterSetterAction_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 #25
Source File: AddDelegateMethodsAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createLinkControl(Composite composite) {
	Link link= new Link(composite, SWT.WRAP);
	link.setText(ActionMessages.AddDelegateMethodsAction_template_link_message);
	link.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			openCodeTempatePage(CodeTemplateContextType.OVERRIDECOMMENT_ID);
		}
	});
	link.setToolTipText(ActionMessages.AddDelegateMethodsAction_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 #26
Source File: PropertyAndPreferencePage.java    From typescript.java with MIT License 6 votes vote down vote up
final void doLinkActivated(Link link) {
	Map data = new HashMap();
	data.put(DATA_NO_LINK, Boolean.TRUE);

	if (isProjectPreferencePage()) {
		openWorkspacePreferences(data);
	} else {
		/*
		 * HashSet projectsWithSpecifics= new HashSet(); try {
		 * IJavaScriptProject[] projects=
		 * JavaScriptCore.create(ResourcesPlugin.getWorkspace().getRoot()).
		 * getJavaScriptProjects(); for (int i= 0; i < projects.length; i++)
		 * { IJavaScriptProject curr= projects[i]; if
		 * (hasProjectSpecificOptions(curr.getProject())) {
		 * projectsWithSpecifics.add(curr); } } } catch
		 * (JavaScriptModelException e) { // ignore } ProjectSelectionDialog
		 * dialog= new ProjectSelectionDialog(getShell(),
		 * projectsWithSpecifics); if (dialog.open() == Window.OK) {
		 * IJavaScriptProject res= (IJavaScriptProject)
		 * dialog.getFirstResult(); openProjectProperties(res.getProject(),
		 * data); }
		 */
	}
}
 
Example #27
Source File: WSO2UIToolkit.java    From developer-studio with Apache License 2.0 6 votes vote down vote up
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 #28
Source File: ComplianceConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void updateComplianceFollowsEE() {
	if (fProject != null) {
		String complianceFollowsEE= DISABLED;
		IExecutionEnvironment ee= getEE();
		String label;
		if (ee != null) {
			complianceFollowsEE= getComplianceFollowsEE(ee);
			label= Messages.format(PreferencesMessages.ComplianceConfigurationBlock_compliance_follows_EE_with_EE_label, ee.getId());
		} else {
			label= PreferencesMessages.ComplianceConfigurationBlock_compliance_follows_EE_label;
		}
		Link checkBoxLink= getCheckBoxLink(INTR_COMPLIANCE_FOLLOWS_EE);
		if (checkBoxLink != null) {
			checkBoxLink.setText(label);
		}
		setValue(INTR_COMPLIANCE_FOLLOWS_EE, complianceFollowsEE);
	}
}
 
Example #29
Source File: MainProjectWizardPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("synthetic-access")
public Control createControl(Composite composite) {
	this.group = new Group(composite, SWT.NONE);
	this.group.setFont(composite.getFont());
	this.group.setLayout(initGridLayout(new GridLayout(2, false), true));
	this.group.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_title);

	this.useEEJRE.doFillIntoGrid(this.group, 1);
	final Combo eeComboControl = this.eeCombo.getComboControl(this.group);
	eeComboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	this.useProjectJRE.doFillIntoGrid(this.group, 1);
	final Combo comboControl = this.jreCombo.getComboControl(this.group);
	comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	this.useDefaultJRE.doFillIntoGrid(this.group, 1);

	this.preferenceLink = new Link(this.group, SWT.NONE);
	this.preferenceLink.setFont(this.group.getFont());
	this.preferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_link_description);
	this.preferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
	this.preferenceLink.addSelectionListener(this);

	updateEnableState();
	return this.group;
}
 
Example #30
Source File: CodeAssistConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
		}
	});
}