List of usage examples for org.eclipse.jface.resource JFaceResources getFontRegistry
public static FontRegistry getFontRegistry()
From source file:org.bbaw.pdr.ae.view.control.customSWTWidges.AspectPresentationTooltip.java
License:Open Source License
@Override protected final Composite createToolTipContentArea(final Event event, final Composite parent) { Composite comp = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(1, false); gl.marginBottom = 0;// w ww .ja va 2 s . co m gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; gl.verticalSpacing = 1; comp.setLayout(gl); Composite topArea = new Composite(comp, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.widthHint = 200; topArea.setLayoutData(data); topArea.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 2; gl.marginTop = 2; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 5; gl.marginRight = 2; topArea.setLayout(gl); Label l = new Label(topArea, SWT.NONE); l.setText(_aspect.getDisplayNameWithID()); l.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); l.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); l.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); l.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite iconComp = new Composite(topArea, SWT.NONE); iconComp.setLayoutData(new GridData()); iconComp.setLayout(new GridLayout(2, false)); iconComp.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; iconComp.setLayout(gl); Label helpIcon = new Label(iconComp, SWT.NONE); helpIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); helpIcon.setImage(_imageReg.get(IconsInternal.CANCEL)); helpIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { hide(); // MarkupTooltip.this.dispose(); openHelp(); } }); Label closeIcon = new Label(iconComp, SWT.NONE); closeIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); closeIcon.setImage(JFaceResources.getImage(HEADER_CLOSE_ICON)); closeIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { _parentShell.setFocus(); hide(); // MarkupTooltip.this.dispose(); } }); createContentArea(comp).setLayoutData(new GridData(GridData.FILL_BOTH)); return comp; }
From source file:org.bbaw.pdr.ae.view.control.customSWTWidges.MarkupTooltip.java
License:Open Source License
@Override protected final Composite createToolTipContentArea(final Event event, final Composite parent) { Composite comp = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(1, false); gl.marginBottom = 0;//w ww . java 2 s. c o m gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; gl.verticalSpacing = 1; comp.setLayout(gl); Composite topArea = new Composite(comp, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.widthHint = 200; topArea.setLayoutData(data); topArea.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 2; gl.marginTop = 2; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 5; gl.marginRight = 2; topArea.setLayout(gl); Label l = new Label(topArea, SWT.NONE); l.setText(_headerText); l.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); l.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); l.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); l.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite iconComp = new Composite(topArea, SWT.NONE); iconComp.setLayoutData(new GridData()); iconComp.setLayout(new GridLayout(2, false)); iconComp.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; iconComp.setLayout(gl); Label helpIcon = new Label(iconComp, SWT.NONE); helpIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); helpIcon.setImage(_imageReg.get(IconsInternal.MARKUP)); helpIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { hide(); // MarkupTooltip.this.dispose(); openHelp(); } }); Label closeIcon = new Label(iconComp, SWT.NONE); closeIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); closeIcon.setImage(JFaceResources.getImage(HEADER_CLOSE_ICON)); closeIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { _parentShell.setFocus(); hide(); // MarkupTooltip.this.dispose(); } }); createContentArea(comp).setLayoutData(new GridData(GridData.FILL_BOTH)); return comp; }
From source file:org.bbaw.pdr.ae.view.control.customSWTWidges.ReferenceEditorAddFieldToolTip.java
License:Open Source License
@Override protected final Composite createToolTipContentArea(final Event event, final Composite parent) { _mainComp = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(1, false); gl.marginBottom = 0;// w w w .j a v a 2 s . co m gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; gl.verticalSpacing = 1; _mainComp.setLayout(gl); Composite topArea = new Composite(_mainComp, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.widthHint = 370; topArea.setLayoutData(data); topArea.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 2; gl.marginTop = 2; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 5; gl.marginRight = 2; topArea.setLayout(gl); Label l = new Label(topArea, SWT.NONE); l.setText(_headerText); l.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); l.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); l.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); l.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite iconComp = new Composite(topArea, SWT.NONE); iconComp.setLayoutData(new GridData()); iconComp.setLayout(new GridLayout(2, false)); iconComp.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; iconComp.setLayout(gl); Label helpIcon = new Label(iconComp, SWT.NONE); helpIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); helpIcon.setImage(_imageReg.get(IconsInternal.CANCEL)); helpIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { hide(); // openHelp(); } }); Label closeIcon = new Label(iconComp, SWT.NONE); closeIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); closeIcon.setImage(JFaceResources.getImage(HEADER_CLOSE_ICON)); closeIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { _parentShell.setFocus(); hide(); } }); createContentArea().setLayoutData(new GridData(GridData.FILL_BOTH)); return _mainComp; }
From source file:org.bbaw.pdr.ae.view.control.customSWTWidges.RevisionHistoryToolTip.java
License:Open Source License
@Override protected final Composite createToolTipContentArea(final Event event, final Composite parent) { Composite comp = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(1, false); gl.marginBottom = 0;//ww w . j a va 2 s . c o m gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; gl.verticalSpacing = 1; comp.setLayout(gl); Composite topArea = new Composite(comp, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.widthHint = 200; topArea.setLayoutData(data); topArea.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 2; gl.marginTop = 2; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 5; gl.marginRight = 2; topArea.setLayout(gl); Label l = new Label(topArea, SWT.NONE); l.setText(_headerText); l.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); l.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); l.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); l.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite iconComp = new Composite(topArea, SWT.NONE); iconComp.setLayoutData(new GridData()); iconComp.setLayout(new GridLayout(2, false)); iconComp.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; iconComp.setLayout(gl); Label helpIcon = new Label(iconComp, SWT.NONE); helpIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); helpIcon.setImage(_imageReg.get(IconsInternal.USER)); helpIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { hide(); } }); Label closeIcon = new Label(iconComp, SWT.NONE); closeIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); closeIcon.setImage(JFaceResources.getImage(HEADER_CLOSE_ICON)); closeIcon.addMouseListener(new MouseAdapter() { @Override public void mouseDown(final MouseEvent e) { _parentShell.setFocus(); hide(); } }); createContentArea(comp).setLayoutData(new GridData(GridData.FILL_BOTH)); return comp; }
From source file:org.bbaw.pdr.ae.view.control.customSWTWidges.TimeSliderToolTip.java
License:Open Source License
@Override protected final Composite createToolTipContentArea(final Event event, final Composite parent) { Composite comp = new Composite(parent, SWT.NONE); GridLayout gl = new GridLayout(1, false); gl.marginBottom = 0;/* w ww . j a v a2s.c o m*/ gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; gl.verticalSpacing = 1; comp.setLayout(gl); Composite topArea = new Composite(comp, SWT.NONE); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.widthHint = 400; topArea.setLayoutData(data); topArea.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(3, false); gl.marginBottom = 2; gl.marginTop = 2; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 5; gl.marginRight = 2; topArea.setLayout(gl); Label l = new Label(topArea, SWT.NONE); l.setText(_headerText + ":"); l.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); l.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); l.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); l.setLayoutData(new GridData(GridData.FILL_BOTH)); _year = new Label(topArea, SWT.NONE); int i = _time + THOUSAND; _year.setText("" + i); _year.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); _year.setFont(JFaceResources.getFontRegistry().get(HEADER_FONT)); _year.setForeground(JFaceResources.getColorRegistry().get(HEADER_FG_COLOR)); _year.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite iconComp = new Composite(topArea, SWT.NONE); iconComp.setLayoutData(new GridData()); iconComp.setLayout(new GridLayout(2, false)); iconComp.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); gl = new GridLayout(2, false); gl.marginBottom = 0; gl.marginTop = 0; gl.marginHeight = 0; gl.marginWidth = 0; gl.marginLeft = 0; gl.marginRight = 0; iconComp.setLayout(gl); Label closeIcon = new Label(iconComp, SWT.NONE); closeIcon.setImage(_imageReg.get(IconsInternal.TIME)); closeIcon.setBackground(JFaceResources.getColorRegistry().get(HEADER_BG_COLOR)); _timeScale = new Scale(comp, SWT.HORIZONTAL); _timeScale.setMinimum(0); _timeScale.setMaximum(1100); _timeScale.setIncrement(1); _timeScale.setPageIncrement(10); _timeScale.setSelection(_time); _timeScale.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); _timeScale.setLayoutData(new GridData()); ((GridData) _timeScale.getLayoutData()).horizontalAlignment = SWT.FILL; ((GridData) _timeScale.getLayoutData()).verticalAlignment = SWT.FILL; ((GridData) _timeScale.getLayoutData()).grabExcessHorizontalSpace = true; _timeScale.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { _yearSpinner.setSelection(_timeScale.getSelection() + THOUSAND); int i = _timeScale.getSelection() + THOUSAND; _year.setText("" + i); _yearSpinner.notifyListeners(SWT.Selection, new Event()); } }); // XXX RAP auskommentiert // _timeScale.addMouseWheelListener(new MouseWheelListener() // { // // @Override // public void mouseScrolled(final MouseEvent e) // { // Scale src = (Scale) e.getSource(); // src.setSelection(src.getSelection() - e.count); // _yearSpinner.setSelection(_timeScale.getSelection() + 1000); // int i = _timeScale.getSelection() + 1000; // _year.setText("" + i); // // _yearSpinner.notifyListeners(SWT.Selection, new Event()); // // } // }); createContentArea(comp).setLayoutData(new GridData(GridData.FILL_BOTH)); _timeScale.setFocus(); return comp; }
From source file:org.bonitasoft.studio.common.jface.BonitaStudioFontRegistry.java
License:Open Source License
/** * @param fontID/*from w ww . j a va 2s . co m*/ * @param style * @param size * @return * the font with style and size + cache it into font registry * */ private static Font getFont(String fontID, int size, int style) { if (fontRegistry == null) { fontRegistry = JFaceResources.getFontRegistry(); } if (fontRegistry.hasValueFor(fontID)) { return fontRegistry.get(fontID); } else { FontData fd = new FontData(fontID, size, style); fontRegistry.put(fontID, new FontData[] { fd }); return fontRegistry.get(fontID); } }
From source file:org.cfeclipse.cfml.editors.decoration.DecorationSupport.java
License:Open Source License
/** * Uninstalls this support from the preference store it has previously been * installed on. If there is no such preference store, this call is without * effect./* w w w . j av a2 s. com*/ */ public void uninstall() { if (fPreferenceStore != null) { fPreferenceStore.removePropertyChangeListener(fPropertyChangeListener); fPropertyChangeListener = null; fPreferenceStore = null; } if (fFontPropertyChangeListener != null) { JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); fFontPropertyChangeListener = null; } }
From source file:org.cfeclipse.cfml.editors.decoration.DecorationSupport.java
License:Open Source License
/** * Shows the margin./*from w ww . j a va 2 s . co m*/ */ private void showMargin() { if (fMarginPainter == null) { if (fSourceViewer instanceof ITextViewerExtension2) { fMarginPainter = new MarginPainter(fSourceViewer); fMarginPainter.setMarginRulerColor(getColor(fMarginPainterColorKey)); if (fPreferenceStore != null) { fMarginPainter.setMarginRulerColumn(fPreferenceStore.getInt(fMarginPainterColumnKey)); fMarginPainter.setMarginRulerColor(getColor(fMarginPainterColorKey)); } ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer; extension.addPainter(fMarginPainter); fFontPropertyChangeListener = new FontPropertyChangeListener(); JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); } } }
From source file:org.cfeclipse.cfml.editors.decoration.DecorationSupport.java
License:Open Source License
/** * Hides the margin.//from ww w . java 2 s.c om */ private void hideMargin() { if (fMarginPainter != null && fFontPropertyChangeListener != null) { if (fSourceViewer instanceof ITextViewerExtension2) { JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); fFontPropertyChangeListener = null; ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer; extension.removePainter(fMarginPainter); fMarginPainter.deactivate(true); fMarginPainter.dispose(); fMarginPainter = null; } } }
From source file:org.cfeclipse.cfml.preferences.CFPreviewerUpdater.java
License:Open Source License
/** * Creates a source preview updater for the given viewer, configuration and preference store. * * @param viewer the viewer/* w w w .j a v a 2 s.c o m*/ * @param configuration the configuration * @param preferenceStore the preference store */ public CFPreviewerUpdater(final SourceViewer viewer, final CFConfiguration configuration, final IPreferenceStore preferenceStore) { initializeViewerColors(viewer, preferenceStore); final IPropertyChangeListener fontChangeListener = new IPropertyChangeListener() { /* * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(JFaceResources.TEXT_FONT)) { Font font = JFaceResources.getFont(JFaceResources.TEXT_FONT); viewer.getTextWidget().setFont(font); } } }; final IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() { /* * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND.equals(property) || AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT .equals(property)) { initializeViewerColors(viewer, preferenceStore); } /* if (configuration.affectsTextPresentation(event)) { configuration.adaptToPreferenceChange(event); viewer.invalidateTextPresentation(); } */ if (FormattingPreferences.affectsFormatting(event)) { format(viewer, preferenceStore); } } /** * @param viewer * @param preferenceStore */ private void format(final SourceViewer sourceViewer, final IPreferenceStore store) { String contents = loadPreviewContentFromFile("FormatPreviewCode.txt"); FormattingPreferences prefs = new FormattingPreferences(); prefs.setPreferenceStore(store); CFMLFormattingStrategy formatter = new CFMLFormattingStrategy(); contents = formatter.format(contents, prefs, "", false); viewer.getDocument().set(contents); } }; viewer.getTextWidget().addDisposeListener(new DisposeListener() { /* * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent) */ public void widgetDisposed(DisposeEvent e) { preferenceStore.removePropertyChangeListener(propertyChangeListener); JFaceResources.getFontRegistry().removeListener(fontChangeListener); } }); JFaceResources.getFontRegistry().addListener(fontChangeListener); preferenceStore.addPropertyChangeListener(propertyChangeListener); }