List of usage examples for org.eclipse.jface.resource JFaceResources getHeaderFont
public static Font getHeaderFont()
From source file:org.eclipse.birt.report.designer.ui.editors.ReportDocumentEditor.java
License:Open Source License
private Label createTitleLabel(Composite parent, String text) { Label label = new Label(parent, SWT.NONE); if (text != null) label.setText(text);// w ww.jav a2 s. c o m label.setBackground(fBackgroundColor); label.setForeground(fForegroundColor); label.setFont(JFaceResources.getHeaderFont()); return label; }
From source file:org.eclipse.datatools.sqltools.schemaobjecteditor.ui.pages.intropage.IntroductionSection.java
License:Open Source License
public void createSectionContent(Composite parent) { // Set layout and layout data for section getSection().setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB)); getSection().setLayout(new TableWrapLayout()); parent.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB)); TableWrapLayout layout = new TableWrapLayout(); layout.numColumns = 2;/* w w w .j a v a 2s . com*/ layout.makeColumnsEqualWidth = false; layout.horizontalSpacing = 20; layout.verticalSpacing = 20; parent.setLayout(layout); IConfigurationElement element = getExtension(); if (element != null) { _helpContextId = element.getAttribute(IntroConstants.EXTENSION_POINT_INTRO_PAGE_HELPID); _pageName = element.getAttribute(IntroConstants.EXTENSION_POINT_INTRO_PAGE_NAME); IConfigurationElement[] introElements = element .getChildren(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT); for (int i = 0; i < introElements.length; i++) { String icon = introElements[i].getAttribute(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_ICON); String id = introElements[i].getAttribute(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_ID); String heading = introElements[i] .getAttribute(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_HEADING); String text = introElements[i].getAttribute(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_TEXT); String hyperlink = introElements[i] .getAttribute(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_HYPERLINK); String hyperlinkaction = introElements[i] .getAttribute(IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_HYPERLINK_ACTION); IIntroHyperAction hyperAction = null; String pluginNS = introElements[i].getDeclaringExtension().getNamespaceIdentifier(); Bundle bundle = Platform.getBundle(pluginNS); Image image = readImage(bundle, icon); if (id != null) { PredefinedIntroSection defSec = (PredefinedIntroSection) PredefinedIntroSection.SECTIONS .get(id); if (defSec != null) { if (image == null && icon == null) { image = defSec.getIcon().createImage(); } if (heading == null) { heading = defSec.getHeading(); } if (text == null) { text = defSec.getText(); } if (hyperlink == null) { hyperlink = defSec.getHyperlink(); } if (hyperlinkaction == null) { hyperAction = defSec.getHyperlinkAction(); } } } if (image != null) { ImageContainer ic = new ImageContainer(parent); ic.setImage(image); TableWrapData td = new TableWrapData(); td.rowspan = 2; ic.setLayoutData(td); _images.add(image); } else { // occupy the position Composite comp = new Composite(parent, SWT.NONE); TableWrapData td = new TableWrapData(); td.rowspan = 2; comp.setLayoutData(td); } // if heading is specified, we won't display the hyperlink if (heading != null && heading.trim().length() != 0) { Label head = _toolkit.createLabel(parent, heading); head.setFont(JFaceResources.getHeaderFont()); } else if (hyperlink != null && hyperlink.trim().length() != 0) { Hyperlink hl = _toolkit.createHyperlink(parent, hyperlink, SWT.NONE); if (hyperAction == null && hyperlinkaction != null) { try { hyperAction = (IIntroHyperAction) introElements[i].createExecutableExtension( IntroConstants.EXTENSION_POINT_INTRO_ELEMENT_HYPERLINK_ACTION); } catch (Exception e) { _log.error("IntroductionSection_create_intro_action", e); } } if (hyperAction != null) { hyperAction.setPage(_page); } final IIntroHyperAction hAction = hyperAction; hl.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { if (hAction != null) { hAction.run(); } } }); } else { // occupy the position _toolkit.createLabel(parent, ""); } FormText txt = _toolkit.createFormText(parent, false); txt.setText(text == null ? "" : text, false, false); } } }
From source file:org.eclipse.emf.editor.EEditor.java
License:Open Source License
/** * Model is already created by superclass. Provides a container for EMF's TreeViewer (currentViewer) * /*from ww w .jav a2 s. co m*/ * @see org.eclipse.ui.part.MultiPageEditorPart#createPageContainer(org.eclipse.swt.widgets.Composite) */ @Override protected Composite createPageContainer(Composite parent) { parent.setLayout(new FillLayout()); FormToolkit toolkit = new FormToolkit(parent.getDisplay()); ScrolledForm form = new ScrolledForm(parent) { @Override public void reflow(boolean flushCache) { // super.reflow(flushCache); } }; form.setExpandHorizontal(true); form.setExpandVertical(true); form.setBackground(toolkit.getColors().getBackground()); form.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); form.setFont(JFaceResources.getHeaderFont()); toolkit.adapt(parent); managedForm = new ManagedForm(toolkit, form); managedForm.getForm().setText("Generic Editor - " + getFile().getName()); managedForm.getToolkit().decorateFormHeading(managedForm.getForm().getForm()); managedForm.getForm().getForm().setToolBarVerticalAlignment(SWT.TOP); managedForm.getForm().getForm().addMessageHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent event) { try { Object eventData = event.getHref(); if (eventData instanceof IMessage[]) { final IMessage[] messages = (IMessage[]) eventData; getSite().getShell().getDisplay().syncExec(new Runnable() { public void run() { Control c = null; for (IMessage message : messages) { if (message.getData() instanceof Collection<?>) { List<?> data = (List<?>) message.getData(); Object object = data.get(0); if (object != null) { getViewer().setSelection(new StructuredSelection(object), true); } if (data.size() > 1) { EStructuralFeature f = (EStructuralFeature) data.get(1); if (f != null) { c = mdBlock.findControl(ESTRUCTURALFEATURE_KEY, f); } } } break; } if (c != null && !c.isDisposed()) { c.forceFocus(); } } }); } } catch (Exception e) { e.printStackTrace(); } } }); mdBlock = new EEMasterDetailsBlock(new EEDetailsPageProvider(this)) { @Override protected void createMoreToolBarActions(IToolBarManager toolBarManager) { Action action = new Action("Check") { @Override public void run() { checkModel(); } }; action.setImageDescriptor(EEPlugin.getDefault().getImageDescriptor("icons/complete_task.gif")); toolBarManager.add(action); } }; mdBlock.createContent(managedForm); final Composite c = (Composite) mdBlock.getMasterSectionPart().getSection().getClient(); // this.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection && !event.getSelection().isEmpty()) managedForm.fireSelectionChanged(mdBlock.getMasterSectionPart(), event.getSelection()); } }); return c; }
From source file:org.eclipse.emf.emfstore.client.ui.views.emfstorebrowser.dialogs.admin.OrgUnitManagementGUI.java
License:Open Source License
private PropertiesForm createPropertiesForm(SashForm sash, AdminBroker adminBroker) { FormToolkit toolkit = new FormToolkit(sash.getDisplay()); PropertiesForm frm = new PropertiesForm(sash, SWT.NONE, adminBroker, this); frm.setText("Properties"); frm.setFont(JFaceResources.getHeaderFont()); toolkit.decorateFormHeading(frm);/*from w w w .j ava 2 s.co m*/ return frm; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.dialogs.admin.OrgUnitManagementGUI.java
License:Open Source License
private PropertiesForm createPropertiesForm(SashForm sash, AdminBroker adminBroker) { final FormToolkit toolkit = new FormToolkit(sash.getDisplay()); final PropertiesForm frm = new PropertiesForm(sash, SWT.NONE, adminBroker, this); frm.setText(Messages.OrgUnitManagementGUI_Properties); frm.setFont(JFaceResources.getHeaderFont()); toolkit.decorateFormHeading(frm);/*from w w w . j a va 2 s.c o m*/ return frm; }
From source file:org.eclipse.emf.emfstore.internal.client.ui.views.emfstorebrowser.dialogs.admin.OrgUnitManagementGUI.java
License:Open Source License
private PropertiesForm createPropertiesForm(SashForm sash, AdminBroker adminBroker) { final FormToolkit toolkit = new FormToolkit(sash.getDisplay()); final PropertiesForm frm = new PropertiesForm(sash, SWT.NONE, adminBroker, this); frm.setText("Properties"); frm.setFont(JFaceResources.getHeaderFont()); toolkit.decorateFormHeading(frm);//from ww w. jav a2 s .c o m return frm; }
From source file:org.eclipse.gmf.examples.taipan.gmf.editor.edit.parts.AquatoryEditPart.java
License:Open Source License
protected Label createRoseLetter(String letter) { Label label = new Label(letter); label.setFont(JFaceResources.getHeaderFont()); return label; }
From source file:org.eclipse.jst.jsf.common.ui.internal.guiutils.IntroductionSection.java
License:Open Source License
/** * add the extension elements to the page * //from w w w . j a va 2s. co m * @param parent * @param toolkit_ * @param element */ private void processItems(Composite parent, FormToolkit toolkit_, IConfigurationElement element) { String hyperlink = element.getAttribute("hyperlink"); //$NON-NLS-1$ String iconPath = element.getAttribute("icon"); //$NON-NLS-1$ String text = element.getAttribute("text"); //$NON-NLS-1$ String heading = element.getAttribute("heading"); //$NON-NLS-1$ String action = element.getAttribute("hyperlinkaction"); //$NON-NLS-1$ //String actionparameters = element.getAttribute("actionparameters"); //$NON-NLS-1$ if (iconPath != null && iconPath.length() > 0) { // add an icon to the page String iconName; if (iconPath.indexOf(IPath.SEPARATOR) != -1) { iconName = new Path(iconPath).lastSegment(); } else { iconName = iconPath; } ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin( element.getDeclaringExtension().getContributor().getName(), iconPath); if (imageDescriptor != null) { ImageRegistry imageRegistry = JSFUICommonPlugin.getDefault().getImageRegistry(); Image image = imageRegistry.get(iconName); if (image == null) { image = imageDescriptor.createImage(); if (image != null) { imageRegistry.put(iconName, image); } else { image = ImageDescriptor.getMissingImageDescriptor().createImage(); } } if (image != null) { ImageContainer img = new ImageContainer(parent); img.setImage(image); TableWrapData td = new TableWrapData(); td.rowspan = 2; img.setLayoutData(td); } else { JSFUICommonPlugin.getLogger(this.getClass()) .error(new Throwable("Image not created for " + element)); //$NON-NLS-1$ } } else { JSFUICommonPlugin.getLogger(this.getClass()) .error(new Throwable("Image Descriptor not found for " + element)); //$NON-NLS-1$ } } if (heading != null && heading.length() > 0) { // add a header Label lbl = toolkit_.createLabel(parent, heading); lbl.setFont(JFaceResources.getHeaderFont()); } if (hyperlink != null && hyperlink.length() > 0) { Hyperlink hypr = toolkit_.createHyperlink(parent, hyperlink, SWT.NONE); if (action != null && action.length() > 0) { try { final IAction thisAction = (IAction) element.createExecutableExtension("hyperlinkaction"); //$NON-NLS-1$ hypr.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { thisAction.run(); } }); } catch (Exception ee) { // log.IntroductionSection.action.error=Failed to launch the // link {0}. _log.error("log.IntroductionSection.action.error", //$NON-NLS-1$ hyperlink, ee); JSFUICommonPlugin.getAlerts().detailError(hyperlink, "log.IntroductionSection.action.error", //$NON-NLS-1$ hyperlink, ee); } } } if (text != null && text.length() > 0) { FormText form = toolkit_.createFormText(parent, false); form.setText(text, false, false); } }
From source file:org.eclipse.recommenders.internal.apidocs.rcp.ApidocsView.java
License:Open Source License
private void addCurrentSelectionHeader() { final IJavaElement element = activeSelection.getElement(); final String text; switch (element.getElementType()) { case IJavaElement.PACKAGE_FRAGMENT_ROOT: case IJavaElement.PACKAGE_FRAGMENT: text = element.getElementName(); break;/* w ww. j a v a 2s .c o m*/ case IJavaElement.LOCAL_VARIABLE: text = JavaElementLabels.getElementLabel(element, JavaElementLabels.F_PRE_TYPE_SIGNATURE | JavaElementLabels.F_POST_QUALIFIED); break; default: text = JavaElementLabels.getElementLabel(element, LABEL_FLAGS); break; } Composite header = new Composite(content, SWT.NONE); ApidocsViewUtils.setInfoBackgroundColor(header); header.setLayout(new GridLayout(2, false)); Label img = new Label(header, SWT.NONE); img.setImage(labelProvider.getImage(element)); setInfoForegroundColor(img); setInfoBackgroundColor(img); Label name = createLabel(header, text, true); name.setFont(JFaceResources.getHeaderFont()); }
From source file:org.eclipse.sapphire.ui.swt.gef.SapphireDiagramEditor.java
License:Open Source License
/** * Takes advantage of the gradients and other capabilities to decorate the * form heading using colors computed based on the current skin and * operating system.//from ww w . j ava 2 s . co m * * @since 3.3 */ private void decorateHeading() { Color top = this.formColors.getColor(IFormColors.H_GRADIENT_END); Color bot = this.formColors.getColor(IFormColors.H_GRADIENT_START); this.header.setTextBackground(new Color[] { top, bot }, new int[] { 100 }, true); this.header.putColor(IFormColors.H_BOTTOM_KEYLINE1, this.formColors.getColor(IFormColors.H_BOTTOM_KEYLINE1)); this.header.putColor(IFormColors.H_BOTTOM_KEYLINE2, this.formColors.getColor(IFormColors.H_BOTTOM_KEYLINE2)); this.header.putColor(IFormColors.H_HOVER_LIGHT, this.formColors.getColor(IFormColors.H_HOVER_LIGHT)); this.header.putColor(IFormColors.H_HOVER_FULL, this.formColors.getColor(IFormColors.H_HOVER_FULL)); this.header.putColor(IFormColors.TB_TOGGLE, this.formColors.getColor(IFormColors.TB_TOGGLE)); this.header.putColor(IFormColors.TB_TOGGLE_HOVER, this.formColors.getColor(IFormColors.TB_TOGGLE_HOVER)); this.header.setSeparatorVisible(true); this.header.setFont(JFaceResources.getHeaderFont()); this.header.setForeground(this.formColors.getColor(IFormColors.TITLE)); }