List of usage examples for org.eclipse.jface.resource JFaceResources DIALOG_FONT
String DIALOG_FONT
To view the source code for org.eclipse.jface.resource JFaceResources DIALOG_FONT.
Click Source Link
"org.eclipse.jface.dialogfont"
). From source file:org.rssowl.ui.internal.MiscPreferencePage.java
License:Open Source License
private void createBrowserOptions(Composite container) { Label label = new Label(container, SWT.NONE); label.setText("Browser"); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); /* Browser Group */ Composite browserGroup = new Composite(container, SWT.None); browserGroup.setLayout(LayoutUtils.createGridLayout(2, 10, 5)); browserGroup.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false)); //TODO Userstory 2: Radio button "Open in Internal Browser" has been removed /* Use internal Browser */ /*fUseInternalBrowser = new Button(browserGroup, SWT.RADIO); fUseInternalBrowser.setText("Use internal Browser"); fUseInternalBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1)); fUseInternalBrowser.addSelectionListener(new SelectionAdapter() { @Override//from w w w . j a va 2s. com public void widgetSelected(SelectionEvent e) { fLoadBrowserTabInBackground.setEnabled(fUseInternalBrowser.getSelection() && fUseMultipleTabsCheck.getSelection()); } });*/ /* Use default external Browser */ fUseDefaultExternalBrowser = new Button(browserGroup, SWT.RADIO); fUseDefaultExternalBrowser.setText("Use default external Browser"); fUseDefaultExternalBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1)); fUseDefaultExternalBrowser .setSelection(fGlobalScope.getBoolean(DefaultPreferences.USE_DEFAULT_EXTERNAL_BROWSER)); /* Use custom external Browser */ fUseCustomExternalBrowser = new Button(browserGroup, SWT.RADIO); fUseCustomExternalBrowser.setText("Use the following external Browser:"); fUseCustomExternalBrowser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, false, false, 2, 1)); fUseCustomExternalBrowser .setSelection(fGlobalScope.getBoolean(DefaultPreferences.USE_CUSTOM_EXTERNAL_BROWSER)); fUseCustomExternalBrowser.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { fCustomBrowserInput.setEnabled(fUseCustomExternalBrowser.getSelection()); fCustomBrowserSearchButton.setEnabled(fUseCustomExternalBrowser.getSelection()); } }); //TODO Userstory 2: Button has been removed //fUseInternalBrowser.setSelection(!fUseDefaultExternalBrowser.getSelection() && !fUseCustomExternalBrowser.getSelection()); fCustomBrowserInput = new Text(browserGroup, SWT.BORDER); fCustomBrowserInput.setEnabled(fUseCustomExternalBrowser.getSelection()); fCustomBrowserInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true)); String customBrowserValue = fGlobalScope.getString(DefaultPreferences.CUSTOM_BROWSER_PATH); if (customBrowserValue != null) fCustomBrowserInput.setText(customBrowserValue); fCustomBrowserSearchButton = new Button(browserGroup, SWT.PUSH); fCustomBrowserSearchButton.setText("Search..."); fCustomBrowserSearchButton.setEnabled(fUseCustomExternalBrowser.getSelection()); fCustomBrowserSearchButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); dialog.setFileName(fCustomBrowserInput.getText()); String path = dialog.open(); if (path != null) fCustomBrowserInput.setText(path); } }); }
From source file:org.springframework.ide.eclipse.beans.ui.navigator.BeansNavigatorLabelProvider.java
License:Open Source License
public Font getFont(Object element) { if (element instanceof ILazyInitializedModelElement && !((ILazyInitializedModelElement) element).isInitialized()) { return JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); }/* w ww. jav a 2 s. com*/ return null; }
From source file:org.springsource.ide.eclipse.commons.frameworks.ui.internal.wizard.GenericWizardCommandParametersPage.java
License:Open Source License
/** * // w w w. j ava 2 s . c om * @return optional font type to use (bold, italic, etc..) used for to * highlight required parameters. Return null to use the default * dialog font. */ protected Font getRequiredParameterFont() { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); }
From source file:org.springsource.ide.eclipse.commons.ui.HtmlTooltip.java
License:Open Source License
private Point computeSizeHint(Browser browser, String html) { TextLayout fTextLayout = new TextLayout(browser.getDisplay()); // Initialize fonts Font defaultFont = JFaceResources.getFont(JFaceResources.DIALOG_FONT); FontData fd = defaultFont.getFontData()[0]; // Try getting font from the HTML style tag String family = fd.getName(); int size = fd.getHeight(); int style = SWT.NONE; Matcher matcher = FONT_FAMILY_PATTERN.matcher(html); if (matcher.find()) { family = matcher.group(1);/*w ww . j av a 2s . c o m*/ } matcher = FONT_SIZE_PATTERN.matcher(html); if (matcher.find()) { try { size = Integer.valueOf(matcher.group(1)); } catch (NumberFormatException e) { // ignore } } matcher = FONT_STYLE_PATTERN.matcher(html); if (matcher.find()) { if ("italic".equalsIgnoreCase(matcher.group(1))) { style |= SWT.ITALIC; } } matcher = FONT_WEIGHT_PATTERN.matcher(html); if (matcher.find()) { if ("bold".equalsIgnoreCase(matcher.group(1))) { style |= SWT.BOLD; } } Font font = null; Font boldFont = null; try { font = new Font(defaultFont.getDevice(), new FontData(family, size, style)); fTextLayout.setFont(font); fTextLayout.setWidth(-1); boldFont = new Font(font.getDevice(), new FontData(family, size, style | SWT.BOLD)); TextStyle fBoldStyle = new TextStyle(boldFont, null, null); // Compute and set tab width fTextLayout.setText(" "); //$NON-NLS-1$ int tabWidth = fTextLayout.getBounds().width; fTextLayout.setTabs(new int[] { tabWidth }); fTextLayout.setText(""); //$NON-NLS-1$ Rectangle trim = /*browser.getParent().computeTrim(0, 0, 0, 0)*/new Rectangle(0, 0, 35, 20); int height = trim.height; //FIXME: The HTML2TextReader does not render <p> like a browser. // Instead of inserting an empty line, it just adds a single line break. // Furthermore, the indentation of <dl><dd> elements is too small (e.g with a long @see line) TextPresentation presentation = new TextPresentation(); String text; try (HTML2TextReader reader = new HTML2TextReader(new StringReader(html), presentation)) { text = reader.getString(); } catch (IOException e) { text = ""; //$NON-NLS-1$ } fTextLayout.setText(text); fTextLayout.setWidth(maxSizeConstraints == null || maxSizeConstraints.x < trim.width ? SWT.DEFAULT : maxSizeConstraints.x - trim.width); Iterator<StyleRange> iter = presentation.getAllStyleRangeIterator(); while (iter.hasNext()) { StyleRange sr = iter.next(); if (sr.fontStyle == SWT.BOLD) { fTextLayout.setStyle(fBoldStyle, sr.start, sr.start + sr.length - 1); } } Rectangle bounds = fTextLayout.getBounds(); // does not return minimum width, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=217446 int lineCount = fTextLayout.getLineCount(); int textWidth = 0; for (int i = 0; i < lineCount; i++) { Rectangle rect = fTextLayout.getLineBounds(i); int lineWidth = rect.x + rect.width; // if (i == 0) // lineWidth+= fInput.getLeadingImageWidth(); textWidth = Math.max(textWidth, lineWidth); } bounds.width = textWidth; fTextLayout.setText(""); //$NON-NLS-1$ int minWidth = bounds.width; height = height + bounds.height; // Add some air to accommodate for different browser renderings // minWidth+= 15; // height+= 20; // Apply max size constraints if (maxSizeConstraints != null) { if (maxSizeConstraints.x != SWT.DEFAULT) { minWidth = Math.min(maxSizeConstraints.x, minWidth + trim.width); } if (maxSizeConstraints.y != SWT.DEFAULT) { height = Math.min(maxSizeConstraints.y, height); } } // Ensure minimal size int width = Math.max(MIN_WIDTH, minWidth); height = Math.max(MIN_HEIGHT, height); fTextLayout.dispose(); font.dispose(); boldFont.dispose(); return new Point(width, height); } finally { if (font != null) { font.dispose(); } if (boldFont != null) { boldFont.dispose(); } } }
From source file:org.springsource.ide.eclipse.commons.ui.PreferencesCurator.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite contents = new Composite(parent, SWT.NONE); contents.setLayout(new GridLayout(1, true)); Label desc = new Label(contents, SWT.WRAP); desc.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); desc.setText("We have scoured the Eclipse preferences pages and determined a handful of preferences\n" + "that are not set in an optimal way. Do you trust us?"); Composite allComposite = new Composite(contents, SWT.BORDER); allComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); allComposite.setLayout(new GridLayout(1, false)); Label label = new Label(allComposite, SWT.NONE); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); label.setText("Set/Reset all curated preferences."); label.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); Button allSetButton = new Button(allComposite, SWT.PUSH); allSetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); allSetButton.setText("Set all preferences"); allSetButton.addSelectionListener(new SelectionAdapter() { @Override//from w w w. j a v a2s .c o m public void widgetSelected(SelectionEvent e) { new GlobalPreferenceEnhancer().enhanceAllPreferences(); } }); Button allUnsetButton = new Button(allComposite, SWT.PUSH); allUnsetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); allUnsetButton.setText("Reset all preferences"); allUnsetButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new GlobalPreferenceEnhancer().undoAll(); } }); Composite jdtComposite = new Composite(contents, SWT.BORDER); jdtComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); jdtComposite.setLayout(new GridLayout(1, false)); Label jdtLabel = new Label(jdtComposite, SWT.NONE); jdtLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); jdtLabel.setText("JDT preferences"); jdtLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); Label jdtLabelExplanation = new Label(jdtComposite, SWT.NONE); jdtLabelExplanation.setLayoutData(new GridData(SWT.BEGINNING, SWT.LEFT, false, false)); jdtLabelExplanation.setText("We set the following JDT preferences:\n" + "* Editor smart paste (true)\n" + "* Editor smart semicolon placement (true)\n" + "* Editor smart opening brace placement (true)\n" + "* Editor smart backspace (true)\n" + "* Editor smart tab (true)\n" + "* Escape text when pasting into a string literal (true)\n" + "* Auto activation delay (40 ms)\n"); // + "* Auto activation triggers for Java (._abcdefghijklmnopqrstuvwxyz)\n"); Button jdtSetButton = new Button(jdtComposite, SWT.PUSH); jdtSetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); jdtSetButton.setText("Set JDT preferences only"); jdtSetButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new GlobalPreferenceEnhancer().enhanceJDTPreferences(); } }); Button jdtUnsetButton = new Button(jdtComposite, SWT.PUSH); jdtUnsetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); jdtUnsetButton.setText("Reset JDT preferences only"); jdtUnsetButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new GlobalPreferenceEnhancer().undoJDTEnhance(); } }); PreferenceLinkArea jdtEditorArea = new PreferenceLinkArea(jdtComposite, SWT.WRAP, "org.eclipse.jdt.ui.preferences.SmartTypingPreferencePage", "Go to the <a>JDT smart typing preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null); GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false); jdtEditorArea.getControl().setLayoutData(data); PreferenceLinkArea jdtContentAssistArea = new PreferenceLinkArea(jdtComposite, SWT.WRAP, "org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage", "Go to the <a>JDT content assist preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null); data = new GridData(SWT.FILL, SWT.CENTER, false, false); jdtContentAssistArea.getControl().setLayoutData(data); Composite m2eComposite = new Composite(contents, SWT.BORDER); m2eComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); m2eComposite.setLayout(new GridLayout(1, false)); Label m2eLabel = new Label(m2eComposite, SWT.NONE); m2eLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); m2eLabel.setText("M2E preferences"); m2eLabel.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); Label m2eLabelExplanation = new Label(m2eComposite, SWT.NONE); m2eLabelExplanation.setLayoutData(new GridData(SWT.BEGINNING, SWT.LEFT, false, false)); m2eLabelExplanation.setText( "We set the following M2E preferences:\n" + "* Hide folders of physically nested projects (true)\n" + "* Download repository updates on startup (false)\n" + "* Open XML page in pom editor by default (true)"); Button m2eSetButton = new Button(m2eComposite, SWT.PUSH); m2eSetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); m2eSetButton.setText("Set M2E preferences only"); m2eSetButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new GlobalPreferenceEnhancer().enhanceM2EPreferences(); } }); Button m2eUnsetButton = new Button(m2eComposite, SWT.PUSH); m2eUnsetButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); m2eUnsetButton.setText("Reset M2E preferences only"); m2eUnsetButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { new GlobalPreferenceEnhancer().undoJDTEnhance(); } }); PreferenceLinkArea m2eArea = new PreferenceLinkArea(m2eComposite, SWT.WRAP, "org.eclipse.m2e.core.preferences.Maven2PreferencePage", "Go to the <a>M2E preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null); data = new GridData(SWT.FILL, SWT.CENTER, false, false); m2eArea.getControl().setLayoutData(data); PreferenceLinkArea m2eUIArea = new PreferenceLinkArea(m2eComposite, SWT.WRAP, "org.eclipse.m2e.core.ui.preferences.UserInterfacePreferencePage", "Go to the <a>M2E UI preferences page</a>", (IWorkbenchPreferenceContainer) getContainer(), null); data = new GridData(SWT.FILL, SWT.CENTER, false, false); m2eUIArea.getControl().setLayoutData(data); // disable m2e components if it is not installed if (Platform.getBundle("org.eclipse.m2e.core") == null) { m2eComposite.setEnabled(false); m2eLabel.setText(m2eLabel.getText() + " (not installed)"); m2eSetButton.setEnabled(false); m2eUnsetButton.setEnabled(false); m2eUIArea.getControl().setEnabled(false); m2eArea.getControl().setEnabled(false); } return contents; }
From source file:org.talend.core.runtime.projectsetting.AbstractProjectSettingPage.java
License:Open Source License
protected Composite createLabelComposite(Composite parent, String title) { Composite composite = new Composite(parent, SWT.NONE); GridLayout messageLayout = new GridLayout(); messageLayout.numColumns = 2;/*w w w.ja v a 2 s. c o m*/ messageLayout.marginWidth = 0; messageLayout.marginHeight = 0; composite.setLayout(messageLayout); composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL)); composite.setFont(parent.getFont()); final Label lbl = new Label(composite, SWT.BOLD); lbl.setText(title);//$NON-NLS-1$ lbl.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); lbl.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); return composite; }
From source file:org.talend.core.ui.advanced.composite.FilteredCheckboxTree.java
License:Open Source License
/** * Return a bold font if the given element matches the given pattern. Clients can opt to call this method from a * Viewer's label provider to get a bold font for which to highlight the given element in the tree. * /*from w ww . jav a 2 s . c o m*/ * @param element element for which a match should be determined * @param tree FilteredTree in which the element resides * @param filter PatternFilter which determines a match * * @return bold font */ public static Font getBoldFont(Object element, FilteredCheckboxTree tree, PatternFilter filter) { String filterText = tree.getFilterString(); if (filterText == null) { return null; } // Do nothing if it's empty string String initialText = tree.getInitialText(); if (!("".equals(filterText) || initialText.equals(filterText))) {//$NON-NLS-1$ boolean initial = initialText != null && initialText.equals(filterText); if (initial) { filter.setPattern(null); } else if (filterText != null) { filter.setPattern(filterText); } if (filter.isElementVisible(tree.getViewer(), element) && filter.isLeafMatch(tree.getViewer(), element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } } return null; }
From source file:org.xmind.ui.resources.FontUtils.java
License:Open Source License
private static boolean isDefaultKey(String key) { return JFaceResources.DEFAULT_FONT.equals(key) || JFaceResources.DIALOG_FONT.equals(key) || JFaceResources.HEADER_FONT.equals(key) || JFaceResources.TEXT_FONT.equals(key) || JFaceResources.BANNER_FONT.equals(key); }
From source file:org2.eclipse.php.internal.debug.ui.preferences.PHPDebugPreferencesAddon.java
License:Open Source License
private ExpandableComposite createStyleSection(Composite parent, String label, int nColumns) { ExpandableComposite excomposite = new ExpandableComposite(parent, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); excomposite.setText(label);/*from w w w .jav a 2 s.c o m*/ excomposite.setExpanded(false); excomposite.setFont(JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT)); excomposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, nColumns, 1)); excomposite.addExpansionListener(new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { PHPDebugPreferencesAddon.this.expandedStateChanged((ExpandableComposite) e.getSource()); } }); return excomposite; }
From source file:tern.eclipse.ide.ui.utils.HTMLTernPrinter.java
License:Open Source License
/** * Returns the Javadoc hover style sheet with the current Javadoc font from * the preferences./*from w w w . ja v a 2 s .c o m*/ * * @return the updated style sheet * @since 3.4 */ private static String getStyleSheet() { if (fgStyleSheet == null) { fgStyleSheet = loadStyleSheet("/TernHoverStyleSheet.css"); //$NON-NLS-1$ } String css = fgStyleSheet; if (css != null) { FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0]; css = HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }