public static PluginDependenciesConsole showConsole() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); boolean exists = false; if (console != null) { IConsole[] existing = manager.getConsoles(); for (int i = 0; i < existing.length; i++) { if (console == existing[i]) { exists = true; } } } else { console = new PluginDependenciesConsole("Plug-in Dependencies", null, true); } if (!exists) { manager.addConsoles(new IConsole[] { console }); } ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.addPropertyChangeListener(console); console.setConsoleFont(); manager.showConsoleView(console); return console; }
protected void performDefaults() { super.performDefaults(); IPreferenceStore store = getPreferenceStore(); ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); PreferenceInitializer.performDefaults(store, currentTheme); useFastTabSwitch.setSelection(store .getDefaultBoolean(ThemeConstants.USE_FAST_TAB_SWITCH)); closeTabOnMiddleClick.setSelection(store .getDefaultBoolean(ThemeConstants.CLOSE_TAB_ON_MIDDLE_CLICK)); minimizeToCoolbar.setSelection(store .getDefaultBoolean(ThemeConstants.ENABLE_NEW_MIN_MAX)); copyFullTabTitle.setSelection(store .getDefaultBoolean(ThemeConstants.COPY_FULL_TAB_TITLE)); alwaysSortEditorTabs.setSelection(store .getDefaultBoolean(ThemeConstants.ALWAYS_SORT_EDITOR_TABS)); alwaysSortViewTabs.setSelection(store .getDefaultBoolean(ThemeConstants.ALWAYS_SORT_VIEW_TABS)); escClosesDetachedViews.setSelection(store .getDefaultBoolean(ThemeConstants.ESC_CLOSES_DETACHED_VIEWS)); setValuesFromTheme(currentTheme); lastUsedTheme = currentTheme; }
private void setValuesFromTheme(ITheme theme) { tabWidthText.setText("" + theme.getInt(ThemeConstants.MAX_TAB_WIDTH)); moveTabAmount.setText("" + theme.getInt(ThemeConstants.MOVE_TAB_AMOUNT)); borderSize.setText("" + theme.getInt(ThemeConstants.BORDER_SIZE)); tabPaddingX.setText("" + theme.getInt(ThemeConstants.TAB_PADDING_X)); tabPaddingY.setText("" + theme.getInt(ThemeConstants.TAB_PADDING_Y)); if(UIUtils.isGtk) { gtkToolbarFix.setText("" + theme.getInt(ThemeConstants.GTK_TOOLBAR_FIX)); } useMaxTabWidth.setSelection(theme.getBoolean(ThemeConstants.USE_MAX_TAB_WIDTH)); showFileExt.setSelection(theme.getBoolean(ThemeConstants.SHOW_FILE_EXTENSIONS)); cropInTheMiddle.setSelection(theme.getBoolean(ThemeConstants.CROP_IN_THE_MIDDLE)); showViewIcon.setSelection(theme.getBoolean(ThemeConstants.SHOW_VIEW_ICON)); hideViewTitle.setSelection(theme.getBoolean(ThemeConstants.HIDE_VIEW_TITLE)); showEditorIcon.setSelection(theme.getBoolean(ThemeConstants.SHOW_EDITOR_ICON)); }
private void setFont(String fontId, FontData[] data) { String fdString = PreferenceConverter.getStoredRepresentation(data); // Only set new values if they're different from existing! Font existing = JFaceResources.getFont(fontId); String existingString = ""; //$NON-NLS-1$ if (!existing.isDisposed()) { existingString = PreferenceConverter.getStoredRepresentation(existing.getFontData()); } if (!existingString.equals(fdString)) { // put in registry... JFaceResources.getFontRegistry().put(fontId, data); // Save to prefs... ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); String key = ThemeElementHelper.createPreferenceKey(currentTheme, fontId); IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); store.setValue(key, fdString); } }
private void setFont(String fontId, FontData[] data) { String fdString = PreferenceConverter.getStoredRepresentation(data); Font existing = JFaceResources.getFont(fontId); String existingString = ""; if (!(existing.isDisposed())) { existingString = PreferenceConverter .getStoredRepresentation(existing.getFontData()); } if (existingString.equals(fdString)) { return; } JFaceResources.getFontRegistry().put(fontId, data); ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); String key = ThemeElementHelper.createPreferenceKey(currentTheme,fontId); IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore(); store.setValue(key, fdString); }
public static FindBugsConsole showConsole() { IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager(); boolean exists = false; if (console != null) { IConsole[] existing = manager.getConsoles(); for (int i = 0; i < existing.length; i++) { if (console == existing[i]) { exists = true; } } } else { console = new FindBugsConsole("FindBugs", null, true); } if (!exists) { manager.addConsoles(new IConsole[] { console }); } ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.addPropertyChangeListener(console); console.setConsoleFont(); manager.showConsoleView(console); return console; }
public Color getBackground(Object element) { ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); if (((PreviewFile)element).ignored) { return current.getColorRegistry().get(SVNDecoratorConfiguration.IGNORED_BACKGROUND_COLOR); } else if (((PreviewFile)element).dirty) { return current.getColorRegistry().get(SVNDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR); } return null; }
public Color getForeground(Object element) { ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); if (((PreviewFile)element).ignored) { return current.getColorRegistry().get(SVNDecoratorConfiguration.IGNORED_FOREGROUND_COLOR); } else if (((PreviewFile)element).dirty) { return current.getColorRegistry().get(SVNDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR); } return null; }
public Font getFont(Object element) { ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); if (((PreviewFile)element).ignored) { return current.getFontRegistry().get(SVNDecoratorConfiguration.IGNORED_FONT); } else if (((PreviewFile)element).dirty) { return current.getFontRegistry().get(SVNDecoratorConfiguration.OUTGOING_CHANGE_FONT); } return null; }
/** * This method will ensure that the fonts and colors used by the decorator * are cached in the registries. This avoids having to syncExec when * decorating since we ensure that the fonts and colors are pre-created. * * @param fonts fonts ids to cache * @param colors color ids to cache */ private void ensureFontAndColorsCreated(final String[] fonts, final String[] colors) { SVNUIPlugin.getStandardDisplay().syncExec(new Runnable() { public void run() { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); for (int i = 0; i < colors.length; i++) { theme.getColorRegistry().get(colors[i]); } for (int i = 0; i < fonts.length; i++) { theme.getFontRegistry().get(fonts[i]); } } }); }
private void computeColorsAndFonts(boolean isIgnored, boolean isDirty, IDecoration decoration) { if (!SVNUIPlugin.getPlugin().getPreferenceStore().getBoolean(ISVNUIConstants.PREF_USE_FONT_DECORATORS)) return; ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); if(isIgnored) { decoration.setBackgroundColor(current.getColorRegistry().get(SVNDecoratorConfiguration.IGNORED_BACKGROUND_COLOR)); decoration.setForegroundColor(current.getColorRegistry().get(SVNDecoratorConfiguration.IGNORED_FOREGROUND_COLOR)); decoration.setFont(current.getFontRegistry().get(SVNDecoratorConfiguration.IGNORED_FONT)); } else if(isDirty) { decoration.setBackgroundColor(current.getColorRegistry().get(SVNDecoratorConfiguration.OUTGOING_CHANGE_BACKGROUND_COLOR)); decoration.setForegroundColor(current.getColorRegistry().get(SVNDecoratorConfiguration.OUTGOING_CHANGE_FOREGROUND_COLOR)); decoration.setFont(current.getFontRegistry().get(SVNDecoratorConfiguration.OUTGOING_CHANGE_FONT)); } }
/** * @param currentTheme */ public ThemeWrapper(ITheme currentTheme) { super(currentTheme, new CascadingColorRegistry(currentTheme.getColorRegistry()), new CascadingFontRegistry(currentTheme.getFontRegistry())); intMap = new HashMap(); booleanMap = new HashMap(); }
/** * The default value is the value from current theme, * if no custom changes are stored in the preferences * @param key * @return if the value is set in preferences, then this value, * otherwise the value from preferences of current presentation theme */ private int getMergedIntPreference(String key, ITheme currentTheme){ boolean hasPrefs = getPreferenceStore().contains(key); int value = 0; if(hasPrefs){ value = getPreferenceStore().getInt(key); } else { value = currentTheme.getInt(key); } return value; }
/** * The default value is the value from current theme, * if no custom changes are stored in the preferences * @param key * @return if the value is set in preferences, then this value, * otherwise the value from preferences of current presentation theme */ private boolean getMergedBooleanPreference(String key, ITheme currentTheme){ boolean hasPrefs = getPreferenceStore().contains(key); boolean value = false; if(hasPrefs){ value = getPreferenceStore().getBoolean(key); } else { value = currentTheme.getBoolean(key); } return value; }
public void setVisible(boolean visible) { super.setVisible(visible); if(!visible){ return; } ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); if(lastUsedTheme != currentTheme){ setValuesFromTheme(currentTheme); lastUsedTheme = currentTheme; } }
/** * Set a control's font to one of Eclipse's built in fonts. * @param control The control to set the font of. * @param pref The preference that stores the font. */ public static void fontPreference( Control control, ExternalPreference pref ) { if( pref.getSource() != Source.FONT_REGISTRY ) { ZDebug.dumpStackTrace( "Tried to set font using preference of: ", pref ); return; } ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); control.setFont( theme.getFontRegistry().get( pref.getKey() ) ); new FontListener( control, pref, theme.getFontRegistry() ); }
private void setFocusColors() { final ITheme theme = getTheme(); final ColorRegistry colorRegistry = theme.getColorRegistry(); final Color textColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR); if (textColor != null) { tabFolder.setSelectionForeground(textColor); } final Color startBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START); final Color endBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END); if (startBgColor != null && endBgColor != null) { final int percent = theme.getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT); final boolean vertical = theme.getBoolean(IWorkbenchThemeConstants.ACTIVE_TAB_VERTICAL); tabFolder.setSelectionBackground(new Color[] {startBgColor, endBgColor}, new int[] {percent}, vertical); } }
private void setNoFocusColors() { final ITheme theme = getTheme(); final ColorRegistry colorRegistry = theme.getColorRegistry(); final Color textColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_TEXT_COLOR); if (textColor != null) { tabFolder.setSelectionForeground(textColor); } final Color startBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_BG_START); final Color endBgColor = colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_BG_END); if (startBgColor != null && endBgColor != null) { final int percent = theme.getInt(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_PERCENT); final boolean vertical = theme.getBoolean(IWorkbenchThemeConstants.ACTIVE_NOFOCUS_TAB_VERTICAL); tabFolder.setSelectionBackground(new Color[] {startBgColor, endBgColor}, new int[] {percent}, vertical); } }
@Override protected void dispose() { if (!disposed) { state = null; disposed = true; ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.removePropertyChangeListener(this); super.dispose(); } }
private void setConsoleFont() { if (Display.getCurrent() == null) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { setConsoleFont(); } }); } else { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); Font font = theme.getFontRegistry().get(CONSOLE_FONT); console.setFont(font); } }
protected void setAppearance() { ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); if (!text.isDisposed()) { text.setFont(currentTheme.getFontRegistry().get(FONT_PREF_ID)); text.setBackground(currentTheme.getColorRegistry().get(BACKGROUND_PREF_ID)); text.setForeground(currentTheme.getColorRegistry().get(TEXTCOLOR_PREF_ID)); } }
@Override protected void dispose() { if (!disposed) { disposed = true; ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); theme.removePropertyChangeListener(this); super.dispose(); } }
private void setConsoleFont() { if (Display.getCurrent() == null) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { setConsoleFont(); } }); } else { ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); Font font = theme.getFontRegistry().get(CONSOLE_FONT); console.setFont(font); } }
public Color getForeground(Object element) { if (element instanceof AbstractHistoryCategory){ ITheme current = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); return current.getColorRegistry().get("org.eclipse.team.cvs.ui.fontsandcolors.cvshistorypagecategories"); //$NON-NLS-1$ } if (isDeletedEdition(element)) { return Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); } return null; }
private Font getTextFont() { final ITheme theme = getWorkbench().getThemeManager().getCurrentTheme(); return theme.getFontRegistry().get(TEXT_FONT_ID); }
public static void performDefaults(IPreferenceStore store, ITheme theme){ /* * remove custom values from store - the defaults should be * taken next time from the theme */ store.setToDefault(ThemeConstants.MAX_TAB_WIDTH); store.setToDefault(ThemeConstants.MOVE_TAB_AMOUNT); store.setToDefault(ThemeConstants.BORDER_SIZE); store.setToDefault(ThemeConstants.USE_MAX_TAB_WIDTH); store.setToDefault(ThemeConstants.SHOW_FILE_EXTENSIONS); store.setToDefault(ThemeConstants.CROP_IN_THE_MIDDLE); store.setToDefault(ThemeConstants.SHOW_VIEW_ICON); store.setToDefault(ThemeConstants.SHOW_EDITOR_ICON); store.setToDefault(ThemeConstants.TAB_PADDING_X); store.setToDefault(ThemeConstants.TAB_PADDING_Y); store.setToDefault(ThemeConstants.EDITOR_TAB_POSITION); store.setToDefault(ThemeConstants.VIEW_TAB_POSITION); store.setToDefault(ThemeConstants.CLOSE_TAB_ON_MIDDLE_CLICK); store.setToDefault(ThemeConstants.USE_FAST_TAB_SWITCH); store.setToDefault(ThemeConstants.COPY_FULL_TAB_TITLE); store.setToDefault(ThemeConstants.EDITOR_LIST_PINNED); store.setToDefault(ThemeConstants.STORE_PART_LIST_LOCATION); store.setToDefault(ThemeConstants.ASK_BEFORE_CLOSE); store.setToDefault(ThemeConstants.CLOSE_EDITORS); store.setToDefault(ThemeConstants.OVERRIDE_EXISTING_SESSION); store.setToDefault(ThemeConstants.ENABLE_NEW_MIN_MAX); store.setToDefault(ThemeConstants.ALWAYS_SORT_EDITOR_TABS); store.setToDefault(ThemeConstants.ALWAYS_SORT_VIEW_TABS); store.setToDefault(ThemeConstants.ESC_CLOSES_DETACHED_VIEWS); store.setToDefault(ThemeConstants.GTK_TOOLBAR_FIX); store.setToDefault(ThemeConstants.HIDE_VIEW_TITLE); /* * workbench prefs used here */ if(theme instanceof ThemeWrapper){ IPreferenceStore wStore = PlatformUI.getPreferenceStore(); setInt(wStore, (ThemeWrapper)theme, ThemeConstants.VIEW_TAB_POSITION); setInt(wStore, (ThemeWrapper)theme, ThemeConstants.EDITOR_TAB_POSITION); setBoolean(wStore, (ThemeWrapper)theme, ThemeConstants.EDITOR_TAB_AREA_VISIBLE); } }
private ITheme getTheme() { return PlatformUI.getWorkbench().getThemeManager().getCurrentTheme(); }