protected void internalDispose() { fText= null; fBrowser= null; if (fFontListener != null) { JFaceResources.getFontRegistry().removeListener(fFontListener); fFontListener= null; } }
public FontShop(Display display) { assert (display != null); assert (instance == null); instance = this; this.display = display; system = display.getSystemFont().getFontData()[0]; text = JFaceResources.getDefaultFont().getFontData()[0]; banner = JFaceResources.getBannerFont().getFontData()[0]; header = JFaceResources.getHeaderFont().getFontData()[0]; dialog = JFaceResources.getDialogFont().getFontData()[0]; }
/** * @param display the display the color is from * @return the default color to use for displaying errors. * @see ColorRegistry#get(String) * @see JFacePreferences#ERROR_COLOR */ public static Color getErrorText(Display display) { return JFaceResources.getColorRegistry().get( JFacePreferences.ERROR_COLOR); }
@Override public void propertyChange(PropertyChangeEvent event) { for (Iterator<Label> iterator = fBannerLabels.iterator(); iterator.hasNext();) { Label label = iterator.next(); label.setFont(JFaceResources.getBannerFont()); } for (Iterator<Label> iterator = fHeaderLabels.iterator(); iterator.hasNext();) { Label label = iterator.next(); label.setFont(JFaceResources.getHeaderFont()); } fComposite.layout(true); fComposite.redraw(); }
/** * Returns a height hint for a button control. * @deprecated * @see IDialogConstants#BUTTON_HEIGHT */ @Deprecated public static int getButtonHeigthHint(Button button) { if (button.getFont().equals(JFaceResources.getDefaultFont())) button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); return converter.convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT); }
/** * Returns a width hint for the given button. * * @param button the button * @return the width hint for the button */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
/** * Returns the default text font. * * @return the default text font */ private Font getDefaultFont() { return JFaceResources.getFont(JFaceResources.TEXT_FONT); }
/** * Creates an empty image registry. * * @param display this <code>Display</code> must not be * <code>null</code> and must not be disposed in order * to use this registry */ public ImageRegistry(Display display) { this(JFaceResources.getResources(display)); }
public SimpleRuleStyleGenerator () { this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.colorBgDisconnected = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.disconnected.bg", this.resourceManager, COLOR_DISCONNECTED_BG ); //$NON-NLS-1$ this.colorBgError = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.error.bg", this.resourceManager, COLOR_ERROR_BG ); //$NON-NLS-1$ this.colorBgAlarm = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.alarm.bg", this.resourceManager, COLOR_ALARM_BG ); //$NON-NLS-1$ this.colorBgWarning = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.warning.bg", this.resourceManager, COLOR_WARNING_BG ); //$NON-NLS-1$ this.colorBgManual = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.manual.bg", this.resourceManager, COLOR_MANUAL_BG ); //$NON-NLS-1$ this.colorBgBlock = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.block.bg", this.resourceManager, COLOR_BLOCK_BG ); //$NON-NLS-1$ this.colorFgBlock = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.block.fg", this.resourceManager, COLOR_BLOCK_FG ); //$NON-NLS-1$ JFaceResources.getColorRegistry ().addListener ( this.listener ); }
private void createLabel(Composite parent, String text) { Label result = new Label(parent, SWT.NONE); result.setText(text); result.setFont(JFaceResources.getBannerFont()); result.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false)); }
/** */ protected Image getInfoImage() { return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); }
@Override public void getName(AccessibleEvent e) { e.result = JFaceResources.getString("ColorSelector.Name"); //$NON-NLS-1$ } });
@Override public FontData getFont(Object element) { if (isDefault()) { FontData[] fontData = JFaceResources.getDefaultFont().getFontData(); if (fontData != null && fontData.length > 0) { FontData data = fontData[0]; data.setStyle(SWT.BOLD); return data; } } return null; }
/** * Returns a width hint for a button control. */ public static int getButtonWidthHint(Button button) { if (button.getFont().equals(JFaceResources.getDefaultFont())) button.setFont(JFaceResources.getDialogFont()); PixelConverter converter = new PixelConverter(button); int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
/** * Returns a width hint for the given button. * * @param button the button * @return the width hint for the button */ public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); }
@Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(PreferenceConstants.EDITOR_TEXT_FONT)) { Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); viewer.getTextWidget().setFont(font); } } };
private synchronized ResourceManager getResourceManager() { if (fResourceManager == null) { fResourceManager = new LocalResourceManager(JFaceResources.getResources()); } return fResourceManager; }
public SimpleRuleStyleGenerator () { this.resourceManager = new LocalResourceManager ( JFaceResources.getResources () ); this.colorBgDisconnected = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.disconnected.bg", this.resourceManager, COLOR_DISCONNECTED_BG ); //$NON-NLS-1$ this.colorBgError = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.error.bg", this.resourceManager, COLOR_ERROR_BG ); //$NON-NLS-1$ this.colorBgAlarm = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.alarm.bg", this.resourceManager, COLOR_ALARM_BG ); //$NON-NLS-1$ this.colorBgWarning = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.warning.bg", this.resourceManager, COLOR_WARNING_BG ); //$NON-NLS-1$ this.colorBgManual = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.manual.bg", this.resourceManager, COLOR_MANUAL_BG ); //$NON-NLS-1$ this.colorBgBlock = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.block.bg", this.resourceManager, COLOR_BLOCK_BG ); //$NON-NLS-1$ this.colorFgBlock = new ColorUpdater ( "org.eclipse.scada.core.ui.styles.alarming.block.fg", this.resourceManager, COLOR_BLOCK_FG ); //$NON-NLS-1$ JFaceResources.getColorRegistry ().addListener ( this.listener ); }
@Override public void propertyChange(PropertyChangeEvent event) { for (Iterator<Label> iterator = fBannerLabels.iterator(); iterator.hasNext();) { Label label = iterator.next(); label.setFont(JFaceResources.getBannerFont()); } for (Iterator<Label> iterator = fHeaderLabels.iterator(); iterator.hasNext();) { Label label = iterator.next(); label.setFont(JFaceResources.getHeaderFont()); } fComposite.layout(true); fComposite.redraw(); }
private Label createHeadingLabel(Composite parent, String text) { Label label = new Label(parent, SWT.NONE); if (text != null) label.setText(text); label.setBackground(fBackgroundColor); label.setForeground(fForegroundColor); label.setFont(JFaceResources.getBannerFont()); fBannerLabels.add(label); return label; }