类org.eclipse.ui.themes.ITheme源码实例Demo

下面列出了怎么用org.eclipse.ui.themes.ITheme的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: spotbugs   文件: FindBugsConsole.java
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("SpotBugs",
                FindbugsPlugin.getDefault().getImageDescriptor(AbstractFindbugsView.PERSPECTIVE_IMG), true);
    }
    if (!exists) {
        manager.addConsoles(new IConsole[] { console });
    }
    ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
    theme.addPropertyChangeListener(console);
    console.setConsoleFont();
    manager.showConsoleView(console);
    return console;
}
 
源代码2 项目: APICloud-Studio   文件: ThemePreferencePage.java
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);
	}
}
 
源代码3 项目: APICloud-Studio   文件: ThemeUIComposite.java
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);
}
 
源代码4 项目: spotbugs   文件: FindBugsConsole.java
@Override
protected void dispose() {
    if (!disposed) {
        disposed = true;
        ITheme theme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
        theme.removePropertyChangeListener(this);
        super.dispose();
    }
}
 
源代码5 项目: spotbugs   文件: FindBugsConsole.java
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);
    }
}
 
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;			
}
 
源代码9 项目: APICloud-Studio   文件: SVNLightweightDecorator.java
/**
 * 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]);
			}
		}
	});
}
 
源代码10 项目: APICloud-Studio   文件: SVNLightweightDecorator.java
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));
	}
}
 
源代码11 项目: n4js   文件: EditorContentExtractor.java
private Font getTextFont() {
	final ITheme theme = getWorkbench().getThemeManager().getCurrentTheme();
	return theme.getFontRegistry().get(TEXT_FONT_ID);
}
 
 类所在包
 类方法
 同包方法