List of usage examples for org.eclipse.jface.resource FontDescriptor setStyle
public final FontDescriptor setStyle(int style)
From source file:com.eclipsesource.tabris.demos.entrypoints.ButtonControlsDemo.java
License:Open Source License
public void createQuestion(Composite parent) { labelQuestion = new Label(parent, SWT.WRAP | SWT.CENTER); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(labelQuestion); FontDescriptor labelFontDescriptor = FontDescriptor.createFrom(labelQuestion.getFont()); FontDescriptor bigFontDescriptor = labelFontDescriptor.setStyle(SWT.BOLD).increaseHeight(7); labelQuestion.setFont(bigFontDescriptor.createFont(parent.getDisplay())); labelQuestion.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_BLACK)); }
From source file:com.eclipsesource.tabris.demos.entrypoints.ClientDeviceDemo.java
License:Open Source License
private void makeBold(Label resultLabel) { FontDescriptor fontDescriptor = FontDescriptor.createFrom(resultLabel.getFont()); Font font = fontDescriptor.setStyle(SWT.BOLD).createFont(resultLabel.getDisplay()); resultLabel.setFont(font);/*from w w w . j a va2 s .c o m*/ }
From source file:com.google.devtools.depan.remap_doc.eclipse.ui.editors.MigrationTaskView.java
License:Apache License
/** * Construct the GUI under the given parent. * * @param parent the parent Composite.//from w ww. jav a 2s . c o m * @return the top level widget. */ private Composite setupComposite(Composite parent) { // widgets Composite topLevel = new Composite(parent, SWT.NONE); Label labelId = new Label(topLevel, SWT.NONE); id = new Label(topLevel, SWT.NONE); Label labelName = new Label(topLevel, SWT.NONE); name = new Label(topLevel, SWT.NONE); Label labelDescription = new Label(topLevel, SWT.NONE); description = new Label(topLevel, SWT.NONE); Label labelQuarter = new Label(topLevel, SWT.NONE); quarter = new Label(topLevel, SWT.NONE); Label labelUpdatedBy = new Label(topLevel, SWT.NONE); updatedBy = new Label(topLevel, SWT.NONE); // content labelId.setText("ID"); labelName.setText("Name"); labelDescription.setText("Description"); labelQuarter.setText("Quarter"); labelUpdatedBy.setText("Updated by"); // layout GridLayout layout = new GridLayout(2, false); layout.horizontalSpacing = 22; layout.verticalSpacing = 9; topLevel.setLayout(layout); id.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); name.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); description.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); quarter.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); updatedBy.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); Font font = name.getFont(); FontDescriptor bold = FontDescriptor.createFrom(font); bold = bold.setStyle(SWT.BOLD); FontDescriptor big = bold.setHeight(18); Font boldFont = bold.createFont(font.getDevice()); name.setFont(big.createFont(font.getDevice())); id.setFont(boldFont); description.setFont(boldFont); quarter.setFont(boldFont); updatedBy.setFont(boldFont); return topLevel; }
From source file:org.eclipse.e4.tools.preference.spy.parts.PreferenceSpyPart.java
License:Open Source License
private FontDescriptor getBoldFontDescriptor() { Font origFont = filteredTree.getViewer().getControl().getFont(); FontDescriptor fontDescriptor = FontDescriptor.createFrom(origFont); return fontDescriptor.setStyle(SWT.BOLD); }
From source file:org.eclipse.etrice.core.ui.labeling.RoomLabelProvider.java
License:Open Source License
private Styler getKeywordStyler() { if (keywordStyler == null) { FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT); FontDescriptor boldFont = font.setStyle(SWT.BOLD); keywordStyler = stylerFactory.createStyler(boldFont, KEYWORD_COLOR, null); }/*w ww . j av a2 s . c o m*/ return keywordStyler; }
From source file:org.eclipse.etrice.core.ui.labeling.RoomLabelProvider.java
License:Open Source License
private Styler getTypeStyler() { if (typeStyler == null) { FontDescriptor font = JFaceResources.getFontDescriptor(JFaceResources.TEXT_FONT); FontDescriptor italicFont = font.setStyle(SWT.ITALIC); typeStyler = stylerFactory.createStyler(italicFont, null, null); }/* w ww . j av a 2s . c om*/ return typeStyler; }
From source file:org.eclipse.mat.ui.internal.views.NavigatorViewPage.java
License:Open Source License
private void initializeFont() { Font defaultFont = JFaceResources.getDefaultFont(); FontDescriptor fontDescriptor = FontDescriptor.createFrom(defaultFont); fontDescriptor = fontDescriptor.setStyle(SWT.ITALIC); this.font = fontDescriptor.createFont(treeViewer.getTree().getDisplay()); Color foreground = treeViewer.getTree().getForeground(); Color background = treeViewer.getTree().getBackground(); RGB grey = ColorUtil.blend(foreground.getRGB(), background.getRGB()); this.greyColor = new Color(treeViewer.getTree().getDisplay(), grey); }
From source file:org.eclipse.mat.ui.snapshot.views.inspector.FieldsLabelProvider.java
License:Open Source License
public FieldsLabelProvider(InspectorView inspectorView, Font defaultFont) { this.inspectorView = inspectorView; FontDescriptor fontDescriptor = FontDescriptor.createFrom(defaultFont); this.italicFont = fontDescriptor.setStyle(SWT.ITALIC).createFont(Display.getDefault()); this.boldFont = fontDescriptor.setStyle(SWT.BOLD).createFont(Display.getDefault()); }
From source file:org.eclipse.mat.ui.snapshot.views.inspector.InspectorView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { SashForm form = new SashForm(parent, SWT.VERTICAL); GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(1, 1).applyTo(form); top = new Composite(form, SWT.TOP); GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(1, 1).applyTo(top); IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); mgr.add(createSyncAction());// w w w .j a v a 2 s . c o m FontDescriptor fontDescriptor = FontDescriptor.createFrom(JFaceResources.getDefaultFont()); fontDescriptor = fontDescriptor.setStyle(SWT.BOLD); this.font = fontDescriptor.createFont(top.getDisplay()); createTopTable(top); createTabFolder(top); createVisualViewer(form); form.setWeights(new int[] { 95, 5 }); // add page listener getSite().getPage().addPartListener(this); hookContextMenu(); showBootstrapPart(); }
From source file:org.jboss.tools.project.examples.preferences.OfflineSupportPreferencePage.java
License:Open Source License
@SuppressWarnings("nls") private void createGoOfflineGroup(Composite composite) { Group goOfflineGroup = new Group(composite, SWT.NONE); GridLayout layout2 = new GridLayout(2, false); goOfflineGroup.setLayout(layout2);/*from www .j av a 2s . c o m*/ GridData gd2 = new GridData(SWT.FILL, SWT.FILL, true, true); goOfflineGroup.setLayoutData(gd2); goOfflineGroup.setText("Prepare offline data"); //$NON-NLS-1$ Label description = new Label(goOfflineGroup, SWT.WRAP); GridDataFactory.fillDefaults().span(2, 1).applyTo(description); description.setText( "The following command generates an offline cache usable by the project examples.\n Pre-requisites :\n"); Label mvnReq = new Label(goOfflineGroup, SWT.WRAP); GridDataFactory.fillDefaults().span(2, 1).applyTo(mvnReq); mvnReq.setText(" - The version of Maven on your path must be the same as the one embedded in Eclipse"); Link groovylink = new Link(goOfflineGroup, SWT.WRAP); GridDataFactory.fillDefaults().span(2, 1).applyTo(groovylink); groovylink.setText(" - <a>Groovy 2.4.x</a> must be set in your path"); groovylink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openUrl("http://groovy-lang.org/install.html"); } }); Link reposlink = new Link(goOfflineGroup, SWT.WRAP); GridDataFactory.fillDefaults().span(2, 1).applyTo(reposlink); reposlink.setText( " - the JBoss Public and Red Hat Maven repositories must be <a>configured in your settings.xml</a>"); //$NON-NLS-1$ reposlink.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { openUrl("http://community.jboss.org/wiki/SettingUpTheJBossEnterpriseRepositories"); } }); final StyledText text = new StyledText(goOfflineGroup, SWT.WRAP | SWT.V_SCROLL); GridDataFactory.fillDefaults().grab(true, false).hint(90, 250).applyTo(text); text.setEditable(false); Collection<String> descriptors = getDescriptors(ProjectExampleUtil.getPluginSites()); Collection<String> categories = getAsStringCollection(ProjectExampleUtil.getCategoryURIs()); StringBuilder command = new StringBuilder("groovy -Dgrape.config=\"") //$NON-NLS-1$ .append(OfflineUtil.getGrapeConfigXml().getAbsolutePath()).append("\" \"") .append(OfflineUtil.getGoOfflineScript().getAbsolutePath()).append("\" ") //$NON-NLS-1$ .append(StringUtils.join(categories, " ")) //$NON-NLS-1$ .append(" ") //$NON-NLS-1$ .append(StringUtils.join(descriptors, " "))//$NON-NLS-1$ .append(" -u \"") .append(PropertiesHelper.getPropertiesProvider().getValue("quickstarts.search.query")).append("\"") .append(" -q -e"); //$NON-NLS-1$ text.setText(command.toString()); final Clipboard cb = new Clipboard(Display.getCurrent()); Button copy = new Button(goOfflineGroup, SWT.PUSH); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.TOP).applyTo(copy); copy.setImage(ProjectExamplesActivator.getDefault().getImage("icons/copy-to-clipboard.gif")); copy.setToolTipText("Copy to clipboard"); //$NON-NLS-1$ copy.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { String textData = text.getText(); TextTransfer textTransfer = TextTransfer.getInstance(); cb.setContents(new Object[] { textData }, new Transfer[] { textTransfer }); } }); Label explanation = new Label(goOfflineGroup, SWT.WRAP); GridDataFactory.fillDefaults().span(2, 1).applyTo(explanation); explanation.setText("The script will create an offline/ directory under the current directory.\n" + "It will attempt to download and build all project examples, populating a clean local maven repository.\n\n"); Label instructions = new Label(goOfflineGroup, SWT.WRAP); FontDescriptor descriptor = FontDescriptor.createFrom(instructions.getFont()); descriptor = descriptor.setStyle(SWT.BOLD); instructions.setFont(descriptor.createFont(instructions.getDisplay())); GridDataFactory.fillDefaults().span(2, 1).applyTo(instructions); instructions.setText( "- Make sure you copy the contents of offline/.jbosstools/cache to the final offline directory\n" + "- Copy the contents offline/.m2/repository to your local maven repository location."); }