Java Code Examples for org.eclipse.ui.forms.widgets.FormText#setImage()
The following examples show how to use
org.eclipse.ui.forms.widgets.FormText#setImage() .
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: HintTextGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Create a label with a hyperlink and a picture. * * @param parent the parent widget of the label * @param text the text of the label * @param action the action to be executed if the hyperlink is activated */ private void createLabel(Composite parent, String text, final BuildpathModifierAction action) { FormText formText= createFormText(parent, text); Image image= fImageMap.get(action.getId()); if (image == null) { image= action.getImageDescriptor().createImage(); fImageMap.put(action.getId(), image); } formText.setImage("defaultImage", image); //$NON-NLS-1$ formText.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { action.run(); } }); }
Example 2
Source File: EssentialsPage.java From thym with Eclipse Public License 1.0 | 6 votes |
private void createPluginsSection(Composite parent) { Section sctnPlugins = createSection(parent, "Plug-ins"); sctnPlugins.setLayout(FormUtils.createClearTableWrapLayout(false, 1)); TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); sctnPlugins.setLayoutData(data); FormText text = formToolkit.createFormText(sctnPlugins, true); ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/cordovaplug_wiz.png"); text.setImage("plugin", idesc.createImage()); text.setText(PLUGINS_SECTION_CONTENT, true, false); sctnPlugins.setClient(text); text.addHyperlinkListener(this); }
Example 3
Source File: EssentialsPage.java From thym with Eclipse Public License 1.0 | 5 votes |
private void createExportSection(Composite parent) { Section sctnExport = createSection(parent, "Export"); sctnExport.setLayout(FormUtils.createClearTableWrapLayout(false, 1)); TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); sctnExport.setLayoutData(data); FormText text = formToolkit.createFormText(sctnExport, true); ImageDescriptor idesc = HybridUI.getImageDescriptor(HybridUI.PLUGIN_ID, "/icons/etool16/export_wiz.png"); text.setImage("export", idesc.createImage()); text.setText(EXPORT_SECTION_CONTENT, true, false); sctnExport.setClient(text); text.addHyperlinkListener(this); }
Example 4
Source File: NewProjectWizardTemplateSelectionPage.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void createControl(Composite parent) { Composite main = new Composite(parent, SWT.NONE); main.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); main.setLayout(new GridLayout(1, false)); Label availableTemplatesLabel = new Label(main, SWT.NONE); availableTemplatesLabel.setText(Messages.NewProjectWizardTemplateSelectionPage_available_templates); availableTemplatesLabel.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, false)); SashForm sash = new SashForm(main, SWT.HORIZONTAL); GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); data.widthHint = 400; sash.setLayoutData(data); TableViewer templateTable = new TableViewer(sash, SWT.BORDER); templateTable.setContentProvider(new ArrayContentProvider()); templateTable.setLabelProvider(labelProvider); AbstractProjectTemplate[] templates = loadTemplatesFromExtensionPoint(); templateTable.setInput(templates); FormText text = new FormText(sash, SWT.BORDER); text.setText("", false, false); //$NON-NLS-1$ text.setBackground(templateTable.getTable().getBackground()); // register images for (AbstractProjectTemplate template : templates) { for (Pair<String, Image> image : template.getImages()) { text.setImage(image.getKey(), image.getValue()); } } templateTable.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection structuredSelection = (IStructuredSelection) selection; Object element = structuredSelection.getFirstElement(); if (element instanceof AbstractProjectTemplate) { selectedTemplate = (AbstractProjectTemplate) element; setPageComplete(true); String content = "<form>" + selectedTemplate.getDescription() + "</form>"; //$NON-NLS-1$ //$NON-NLS-2$ try { text.setText(content, true, true); } catch (Exception e) { text.setText(e.getMessage(), false, false); } } else { selectedTemplate = null; text.setText("", false, false); //$NON-NLS-1$ setPageComplete(false); } } else { selectedTemplate = null; text.setText("", false, false); //$NON-NLS-1$ setPageComplete(false); } } }); templateTable.setSelection(new StructuredSelection(templateTable.getElementAt(0))); setControl(main); }