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.jboss.tools.common.el.ui.internal.info.ELInfoHover.java
License:Open Source License
/** * Returns the style information for displaying HTML content. * * @return the CSS styles//from ww w . java 2 s . c o m */ private static String getCSSStyles() { if (fCSSStyles == null) { Bundle bundle = Platform.getBundle(ElUiPlugin.PLUGIN_ID); URL url = bundle.getEntry("/resources/css/ELInfoHoverStyleSheet.css"); //$NON-NLS-1$ if (url != null) { BufferedReader reader = null; try { url = FileLocator.toFileURL(url); reader = new BufferedReader(new InputStreamReader(url.openStream())); StringBuilder buffer = new StringBuilder(200); String line = reader.readLine(); while (line != null) { buffer.append(line); buffer.append('\n'); line = reader.readLine(); } fCSSStyles = buffer.toString(); } catch (IOException ex) { ElUiPlugin.getDefault().logError(ex); } finally { try { if (reader != null) reader.close(); } catch (IOException e) { } } } } String css = fCSSStyles; if (css != null) { FontData fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT)[0]; css = HTMLPrinter.convertTopLevelFont(css, fontData); } return css; }
From source file:org.kalypso.afgui.internal.ui.CaseTreeContentAdapter.java
License:Open Source License
public CaseTreeContentAdapter() { m_caseImage = AbstractUIPlugin.imageDescriptorFromPlugin(KalypsoAFGUIFrameworkPlugin.PLUGIN_ID, "icons/scenario.png"); //$NON-NLS-1$ final FontData[] fontData = JFaceResources.getFontRegistry().getFontData(JFaceResources.DIALOG_FONT); final String dialogFontName = fontData[0].getName(); final int dialogFontHeight = fontData[0].getHeight(); m_activeFont = new FontData(dialogFontName, dialogFontHeight, SWT.BOLD); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.content.ConnectionContentControl.java
License:Open Source License
public void refresh(final ElementSelector elementToSelect) { updateStatusBar(STATUS_UPDATE);//from ww w. j a v a 2 s .c om // TODO: it would also be nice to directly update any changed elements // Hm, maybe we should directly always work on the current state? applySelection(elementToSelect); m_refreshJob.cancel(); final Font italicFont = JFaceResources.getFontRegistry().getItalic(JFaceResources.DIALOG_FONT); m_waterViewer.getControl().setFont(italicFont); // m_refreshJob.setElementToSelect( elementToSelect ); m_refreshJob.schedule(500); }
From source file:org.kalypso.model.wspm.pdb.ui.internal.content.ConnectionContentControl.java
License:Open Source License
protected void handleRefreshDone(final IStatus status) { final ConnectionInput input = m_refreshJob.getInput(); final ElementSelector selector = m_refreshJob.getElementToSelect(); final TreeViewer viewer = m_waterViewer; final Runnable operation = new Runnable() { @Override//from w ww. ja v a 2 s . c o m public void run() { setInput(input); final Font normalFont = JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT); viewer.getControl().setFont(normalFont); applySelection(selector); if (status.isOK()) refreshStatusBar(); else updateStatusBar(status); } }; ViewerUtilities.execute(m_waterViewer, operation, true); }
From source file:org.kalypso.ogc.gml.map.themes.KalypsoTextTheme.java
License:Open Source License
/** * This function creates an SWT image.//from w ww.j a v a2 s .c o m * * @return The SWT image. */ protected org.eclipse.swt.graphics.Image createSwtImage() { /* Is a text available? */ if (m_text == null || m_text.length() == 0) return null; /* Get the font. */ final Font smallFont = JFaceResources.getFont(JFaceResources.DIALOG_FONT); final Font bigFont = FontUtilities.changeHeightAndStyle(smallFont.getDevice(), smallFont, m_fontSize, SWT.BOLD); /* Create a helper image. */ final org.eclipse.swt.graphics.Image helperImage = new org.eclipse.swt.graphics.Image(bigFont.getDevice(), 100, 100); final GC helperGC = new GC(helperImage); helperGC.setFont(bigFont); /* Get the text extent. */ final Point textExtent = helperGC.textExtent(m_text); final int width = textExtent.x; final int height = textExtent.y; /* Dispose the helper image. */ helperImage.dispose(); helperGC.dispose(); /* Create the palette. */ final Color white = bigFont.getDevice().getSystemColor(SWT.COLOR_WHITE); final Color black = bigFont.getDevice().getSystemColor(SWT.COLOR_BLACK); PaletteData palette = new PaletteData(new RGB[] { m_background, black.getRGB() }); if (m_transparency) palette = new PaletteData(new RGB[] { white.getRGB(), black.getRGB() }); /* Create a new image data. */ final ImageData newImageData = new ImageData(width, height, 2, palette); if (m_transparency) newImageData.transparentPixel = 0; /* Create a new image. */ final org.eclipse.swt.graphics.Image newImage = new org.eclipse.swt.graphics.Image(bigFont.getDevice(), newImageData); final GC newGC = new GC(newImage); newGC.setFont(bigFont); /* Draw the text. */ final Color backgroundColor = new Color(newGC.getDevice(), m_background); if (!m_transparency) newGC.setBackground(backgroundColor); newGC.setForeground(black); newGC.drawText(m_text, 0, 0); /* Dispose the new image. */ newGC.dispose(); backgroundColor.dispose(); return newImage; }
From source file:org.kalypso.ogc.gml.outline.nodes.KalypsoThemeNode.java
License:Open Source License
@Override public Font getFont(final Object element) { final IKalypsoTheme theme = getElement(); final FontRegistry fontRegistry = JFaceResources.getFontRegistry(); if (!theme.isLoaded()) return fontRegistry.getItalic(JFaceResources.DIALOG_FONT); // falls aktiviert final IMapModell mapModell = theme.getMapModell(); if (mapModell != null && mapModell.getActiveTheme() == theme) return fontRegistry.getBold(JFaceResources.DIALOG_FONT); return fontRegistry.get(JFaceResources.DIALOG_FONT); }
From source file:org.kalypso.ogc.gml.outline.nodes.NodeLegendBuilder.java
License:Open Source License
/** * Creates a legend image for the given node.<br/> * The caller is responsible to dispose the returned image. *//*from w w w . j a v a 2s .co m*/ public Image createLegend(final IThemeNode[] nodes, final Device device, final IProgressMonitor monitor) { /* All elements in this theme. */ final LegendElement[] elements = collectElements(nodes); if (elements.length == 0) return null; /* Monitor. */ final SubMonitor progress = SubMonitor.convert(monitor, Messages.getString("org.kalypso.ogc.gml.map.utilities.MapUtilities.0"), elements.length); //$NON-NLS-1$ GC gc = null; Font font = null; Color bgColor = null; Transform shift = null; Image image = null; try { font = new Font(device, JFaceResources.DIALOG_FONT, m_fontSize, SWT.NORMAL); /* Compute the size for the image. */ final Point computeSize = computeSize(elements, font); /* Create the image. */ // HM: quite complicated to create a transparent image; any other ideas? final ImageData id = new ImageData(computeSize.x, computeSize.y, 32, new PaletteData(0xFF, 0xFF00, 0xFF0000)); id.transparentPixel = 0xfffffe; image = new Image(device, id); /* Need a graphical context. */ gc = new GC(image); /* Set the background color. */ bgColor = new Color(device, m_background); gc.setBackground(bgColor); gc.fillRectangle(image.getBounds()); /* Set the font. */ gc.setFont(font); /* Change the color. */ gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_BLACK)); shift = new Transform(device); shift.translate(m_insets.left, m_insets.top); gc.setTransform(shift); for (final LegendElement legendElement : elements) { /* Monitor. */ progress.subTask(Messages.getString("org.kalypso.ogc.gml.map.utilities.MapUtilities.2", //$NON-NLS-1$ legendElement.getText())); final Point size = legendElement.getSize(font); legendElement.paintLegend(gc); shift.translate(0, size.y + LegendElement.GAP); gc.setTransform(shift); // FIXME: resources not disposed on exception! ProgressUtilities.worked(progress, 1); } return image; } catch (final Throwable e) { if (image != null) image.dispose(); throw e; } finally { for (final LegendElement legendElement : elements) legendElement.dispose(); if (bgColor != null) bgColor.dispose(); if (shift != null) shift.dispose(); if (gc != null) gc.dispose(); if (font != null) font.dispose(); } }
From source file:org.l2x6.eircc.ui.editor.AbstractIrcEditor.java
License:Open Source License
/** * Initializes the given viewer's font.//from ww w .jav a 2 s . c o m * * @param viewer * the viewer * @since 2.0 */ private void initializeViewerFont(ISourceViewer viewer) { boolean isSharedFont = true; Font font = null; String symbolicFontName = JFaceResources.DIALOG_FONT; if (symbolicFontName != null) font = JFaceResources.getFont(symbolicFontName); if (font == null) font = JFaceResources.getDialogFont(); if (!font.equals(logViewer.getTextWidget().getFont())) { setFont(viewer, font); disposeFont(); if (!isSharedFont) fFont = font; } else if (!isSharedFont) { font.dispose(); } }
From source file:org.locationtech.udig.style.sld.editor.internal.EditorBoldLabelProvider.java
License:Open Source License
public Font getFont(Object element) { String filterText = comboTree.getFilterControlText(); // Do nothing if it's empty string if (!(filterText.equals("") || filterText.equals(comboTree.getInitialText()))) {//$NON-NLS-1$ boolean initial = comboTree.getInitialText() != null && filterText.equals(comboTree.getInitialText()); if (initial) { filterForBoldElements.setPattern(null); } else {//from ww w . j a v a2 s . co m filterForBoldElements.setPattern(filterText); } ITreeContentProvider contentProvider = (ITreeContentProvider) comboTree.getViewer() .getContentProvider(); Object parent = contentProvider.getParent(element); if (filterForBoldElements.select(comboTree.getViewer(), parent, element)) { return JFaceResources.getFontRegistry().getBold(JFaceResources.DIALOG_FONT); } } return null; }
From source file:org.mailster.gui.prefs.ConfigurationDialog.java
License:Open Source License
/** * Creates the wizard's title area.// ww w . ja va 2s. c o m * * @param parent the SWT parent for the title area composite * @return the created title area composite */ protected Composite createTitleArea(Composite parent) { /* * Create the title area which will contai a title, message, and image. */ int margins = 2; Composite titleArea = new Composite(parent, SWT.NONE); FormLayout layout = new FormLayout(); layout.marginHeight = 5; layout.marginWidth = margins; titleArea.setLayout(layout); GridData layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.verticalAlignment = SWT.TOP; titleArea.setLayoutData(layoutData); /* Message label */ this.messageArea = new DialogMessageArea(); this.messageArea.createContents(titleArea); titleArea.addControlListener(new ControlAdapter() { /** * @see org.eclipse.swt.events.ControlAdapter#controlResized(org.eclipse.swt.events.ControlEvent) */ public void controlResized(ControlEvent e) { updateMessage(); } }); final IPropertyChangeListener fontListener = new IPropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (JFaceResources.BANNER_FONT.equals(event.getProperty())) updateMessage(); if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) { updateMessage(); Font dialogFont = JFaceResources.getDialogFont(); updateTreeFont(dialogFont); Control[] children = ((Composite) buttonBar).getChildren(); for (int i = 0; i < children.length; i++) children[i].setFont(dialogFont); } } }; titleArea.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { JFaceResources.getFontRegistry().removeListener(fontListener); } }); JFaceResources.getFontRegistry().addListener(fontListener); this.messageArea.setTitleLayoutData(this.createMessageAreaData()); this.messageArea.setMessageLayoutData(this.createMessageAreaData()); return (titleArea); }