Java Code Examples for org.eclipse.jface.preference.PreferenceConverter#setDefault()

The following examples show how to use org.eclipse.jface.preference.PreferenceConverter#setDefault() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EditorConfigUIPreferenceInitializer.java    From editorconfig-eclipse with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the default value and fires a property change event if necessary.
 *
 * @param store
 *            the preference store
 * @param key
 *            the preference key
 * @param newValue
 *            the new value
 * @param fireEvent
 *            <code>false</code> if no event should be fired
 */
private static void setDefault(IPreferenceStore store, String key, RGB newValue, boolean fireEvent) {
	if (!fireEvent) {
		PreferenceConverter.setDefault(store, key, newValue);
		return;
	}

	RGB oldValue = null;
	if (store.isDefault(key)) {
		oldValue = PreferenceConverter.getDefaultColor(store, key);
	}
	PreferenceConverter.setDefault(store, key, newValue);

	if (oldValue != null && !oldValue.equals(newValue)) {
		store.firePropertyChangeEvent(key, oldValue, newValue);
	}
}
 
Example 2
Source File: JavaUIPreferenceInitializer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Sets the default value and fires a property
 * change event if necessary.
 *
 * @param store	the preference store
 * @param key the preference key
 * @param newValue the new value
 * @param fireEvent <code>false</code> if no event should be fired
 * @since 3.4
 */
private static void setDefault(IPreferenceStore store, String key, RGB newValue, boolean fireEvent) {
	if (!fireEvent) {
		PreferenceConverter.setDefault(store, key, newValue);
		return;
	}

	RGB oldValue= null;
	if (store.isDefault(key))
		oldValue= PreferenceConverter.getDefaultColor(store, key);

	PreferenceConverter.setDefault(store, key, newValue);

	if (oldValue != null && !oldValue.equals(newValue))
		store.firePropertyChangeEvent(key, oldValue, newValue);
}
 
Example 3
Source File: IndentGuidePreferencePage.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public static IPreferenceStore staticGetPreferenceStore() {
    if (preferenceStore == null) {
        preferenceStore = EditorCommonsPlugin.getDefault().getPreferenceStore();

        if (!preferenceStore.contains(PreferenceConstants.LINE_COLOR)) {
            // not initialized yet: init all defaults:
            PreferenceConverter.setDefault(preferenceStore, PreferenceConstants.LINE_COLOR, new RGB(128, 128, 128));
            preferenceStore.setDefault(PreferenceConstants.ENABLED, true);
            preferenceStore.setDefault(PreferenceConstants.LINE_ALPHA, 100);
            preferenceStore.setDefault(PreferenceConstants.LINE_STYLE, 1);
            preferenceStore.setDefault(PreferenceConstants.LINE_WIDTH, 1);
            preferenceStore.setDefault(PreferenceConstants.LINE_SHIFT, 3);
        }
    }
    return preferenceStore;
}
 
Example 4
Source File: PreferenceInitializer.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public void initializeDefaultPreferences() {
	IPreferenceStore store = SimulationActivator.getDefault()
			.getPreferenceStore();
	PreferenceConverter.setDefault(store,
			STATE_FOREGROUND_HIGHLIGHTING_COLOR,
			STATE_VG_COLOR.getRGB());

	PreferenceConverter.setDefault(store,
			STATE_BACKGROUND_HIGHLIGHTING_COLOR, STATE_BG_HL_COLOR.getRGB());

	PreferenceConverter.setDefault(store,
			VERTEX_FOREGROUND_TRANSIENT_COLOR, STATE_VG_COLOR.getRGB());

	PreferenceConverter.setDefault(store,
			VERTEX_BACKGROUND_TRANSIENT_COLOR, STATE_BG_HL_COLOR.getRGB());

	PreferenceConverter.setDefault(store, TRANSITION_HIGHLIGHTING_COLOR,
			STATE_VG_COLOR.getRGB());
}
 
Example 5
Source File: TSPreferenceInitializer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
	// 设置 colors 首选项页的初始值
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_FG_COLOR, new RGB(234, 234, 234));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_BG_COLOR, new RGB(223, 112, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.WRONG_TAG_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_FG_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_BG_COLOR, new RGB(244, 244, 159));

	PreferenceConverter.setDefault(store, IColorPreferenceConstant.PT_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.QT_COLOR, new RGB(255, 204, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.MT_COLOR, new RGB(171, 217, 198));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH101_COLOR, new RGB(255, 255, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH100_COLOR, new RGB(37, 168, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH90_COLOR, new RGB(79, 185, 214));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH80_COLOR, new RGB(114, 199, 222));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH70_COLOR, new RGB(155, 215, 231));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH0_COLOR, new RGB(198, 240, 251));

	PreferenceConverter.setDefault(store, IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, new RGB(170, 255, 85));

	// 设置 net.heartsome.cat.common.core 插件中的语言代码初始值
	IPreferenceStore corePreferenceStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, CoreActivator
			.getDefault().getBundle().getSymbolicName());
	corePreferenceStore.setDefault(IPreferenceConstants.LANGUAGECODE, LocaleService.getLanguageConfigAsString());

	// 设置选择路径对话框的初始值
	PlatformUI.getPreferenceStore()
			.setDefault(IPreferenceConstants.LAST_DIRECTORY, System.getProperty("user.home"));
	
	ColorConfigLoader.init();
}
 
Example 6
Source File: TSPreferenceInitializer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
	// 设置 colors 首选项页的初始值
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_FG_COLOR, new RGB(234, 234, 234));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_BG_COLOR, new RGB(223, 112, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.WRONG_TAG_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_FG_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_BG_COLOR, new RGB(244, 244, 159));

	PreferenceConverter.setDefault(store, IColorPreferenceConstant.PT_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.QT_COLOR, new RGB(255, 204, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.MT_COLOR, new RGB(171, 217, 198));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH101_COLOR, new RGB(255, 255, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH100_COLOR, new RGB(37, 168, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH90_COLOR, new RGB(79, 185, 214));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH80_COLOR, new RGB(114, 199, 222));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH70_COLOR, new RGB(155, 215, 231));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH0_COLOR, new RGB(198, 240, 251));

	PreferenceConverter.setDefault(store, IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, new RGB(170, 255, 85));

	// 设置 net.heartsome.cat.common.core 插件中的语言代码初始值
	IPreferenceStore corePreferenceStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, CoreActivator
			.getDefault().getBundle().getSymbolicName());
	corePreferenceStore.setDefault(IPreferenceConstants.LANGUAGECODE, LocaleService.getLanguageConfigAsString());

	// 设置选择路径对话框的初始值
	PlatformUI.getPreferenceStore()
			.setDefault(IPreferenceConstants.LAST_DIRECTORY, System.getProperty("user.home"));
	
	ColorConfigLoader.init();
}
 
Example 7
Source File: SemanticHighlightings.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Sets the default value and fires a property
 * change event if necessary.
 *
 * @param store	the preference store
 * @param key the preference key
 * @param newValue the new value
 * @since 3.3
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
	RGB oldValue= null;
	if (store.isDefault(key))
		oldValue= PreferenceConverter.getDefaultColor(store, key);

	PreferenceConverter.setDefault(store, key, newValue);

	if (oldValue != null && !oldValue.equals(newValue))
		store.firePropertyChangeEvent(key, oldValue, newValue);
}
 
Example 8
Source File: LogViewerPlugin.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
private void loadDefaultPluginPreferences(IPreferenceStore store) {
	store.setDefault(ILogViewerConstants.PREF_BACKLOG,ILogViewerConstants.DEFAULT_BACKLOG);
	store.setDefault(ILogViewerConstants.PREF_BUFFER,ILogViewerConstants.DEFAULT_BUFFER_CAPACITY);
	store.setDefault(ILogViewerConstants.PREF_READWAIT,ILogViewerConstants.DEFAULT_READWAIT_SIZE);
	store.setDefault(ILogViewerConstants.PREF_ENCODING,System.getProperty("file.encoding"));
	store.setDefault(ILogViewerConstants.PREF_WORD_WRAP,ILogViewerConstants.DEAFULT_WORD_WRAP);
	store.setDefault(ILogViewerConstants.PREF_SHOW_WHEN_UPDATED,ILogViewerConstants.DEAFULT_SHOW_WHEN_UPDATED);
	store.setDefault(ILogViewerConstants.PREF_FILTER_EXTENSIONS,ILogViewerConstants.DEFAULT_FILTER_EXTENSIONS);
	store.setDefault(ILogViewerConstants.PREF_SHOW_TOP_OF_FILE,ILogViewerConstants.DEAFULT_SHOW_TOP_OF_FILE);		
	PreferenceConverter.setDefault(store,ILogViewerConstants.PREF_CURSORLINE_COLOR,new RGB(192,192,192));
	PreferenceConverter.setDefault(store,ILogViewerConstants.PREF_EDITOR_FONT_STYLE,JFaceResources.getDefaultFont().getFontData());
}
 
Example 9
Source File: PreferenceInitializer.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
public void initializeDefaultPreferences() {
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	
	PreferenceConverter.setDefault(store, PreferenceConstants.P_STRING_COLOR, ColorProvider.GREEN_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_COMMENT_COLOR, ColorProvider.GREY_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_INSTRUCT_COLOR, ColorProvider.DGREY_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_MODIF_COLOR, ColorProvider.PURPLE_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_TAG_COLOR, ColorProvider.PURPLE_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_KVAL_COLOR, ColorProvider.ORANGE_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_REF_COLOR, ColorProvider.RED_COLOR);
	PreferenceConverter.setDefault(store, PreferenceConstants.P_DEF_COLOR, ColorProvider.BLUE_COLOR);
	
}
 
Example 10
Source File: PreferenceInitializer.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 5 votes vote down vote up
public void initializeDefaultPreferences() {
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	
	Display display = Display.getCurrent();
	Color highColour = display.getSystemColor(SWT.COLOR_RED);
	Color mediumColour = display.getSystemColor(SWT.COLOR_DARK_MAGENTA);
	Color lowColour = display.getSystemColor(SWT.COLOR_DARK_YELLOW);
	
	PreferenceConverter.setDefault(store, PreferenceConstants.P_PRIORITY_HIGH_COLOR, highColour.getRGB());
	PreferenceConverter.setDefault(store, PreferenceConstants.P_PRIORITY_MEDIUM_COLOR, mediumColour.getRGB());
	PreferenceConverter.setDefault(store, PreferenceConstants.P_PRIORITY_LOW_COLOR, lowColour.getRGB());
}
 
Example 11
Source File: ColorManager.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initialize default colors and styles to preferences.
 * This should be called only from PreferenceInitializer.
 * @param preferences preferences
 */
public static void initializeDefaults(IPreferenceStore preferences) {
    PreferenceConverter.setDefault(preferences, DEFAULT, DEFAULT_DEFAULT_COLOR);

    PreferenceConverter.setDefault(preferences, STRING, DEFAULT_STRING_COLOR);
    PreferenceConverter.setDefault(preferences, COMMAND, DEFAULT_COMMAND_COLOR);
    PreferenceConverter.setDefault(preferences, CURLY_BRACKETS, DEFAULT_CURLY_BRACKETS_COLOR);
    PreferenceConverter.setDefault(preferences, SQUARE_BRACKETS, DEFAULT_SQUARE_BRACKETS_COLOR);
    PreferenceConverter.setDefault(preferences, EQUATION, DEFAULT_EQUATION_COLOR);
    PreferenceConverter.setDefault(preferences, COMMENT, DEFAULT_COMMENT_COLOR);
    PreferenceConverter.setDefault(preferences, VERBATIM, DEFAULT_VERBATIM_COLOR);

    //PreferenceConverter.setDefault(preferences, TEX_WHITE, DEFAULT_TEX_WHITE_COLOR);
    PreferenceConverter.setDefault(preferences, TEX_NUMBER, DEFAULT_TEX_NUMBER_COLOR);

    PreferenceConverter.setDefault(preferences, TEX_SPECIAL, DEFAULT_TEX_SPECIAL_COLOR);

    preferences.setDefault(DEFAULT_STYLE, DEFAULT_DEFAULT_STYLE);

    preferences.setDefault(STRING_STYLE, DEFAULT_STRING_STYLE);
    preferences.setDefault(COMMAND_STYLE, DEFAULT_COMMAND_STYLE);
    preferences.setDefault(CURLY_BRACKETS_STYLE, DEFAULT_CURLY_BRACKETS_STYLE);
    preferences.setDefault(SQUARE_BRACKETS_STYLE, DEFAULT_SQUARE_BRACKETS_STYLE);
    preferences.setDefault(EQUATION_STYLE, DEFAULT_EQUATION_STYLE);
    preferences.setDefault(COMMENT_STYLE, DEFAULT_COMMENT_STYLE);
    preferences.setDefault(VERBATIM_STYLE, DEFAULT_VERBATIM_STYLE);

    //PreferenceConverter.setDefault(preferences, TEX_WHITE, DEFAULT_TEX_WHITE_COLOR);
    preferences.setDefault(TEX_NUMBER_STYLE, DEFAULT_TEX_NUMBER_STYLE);

    preferences.setDefault(TEX_SPECIAL_STYLE, DEFAULT_TEX_SPECIAL_STYLE);
}
 
Example 12
Source File: BibColorProvider.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Initialize default colors to preferences.
 * This should be called only from PreferenceInitializer.
 * @param preferences preferences
 */
public static void initializeDefaults(IPreferenceStore preferences) {
    PreferenceConverter.setDefault(preferences, SINGLE_LINE_COMMENT, SINGLE_LINE_COMMENT_DEFAULT_COLOR);
    PreferenceConverter.setDefault(preferences, KEYWORD, KEYWORD_DEFAULT_COLOR);
    PreferenceConverter.setDefault(preferences, TYPE, TYPE_DEFAULT_COLOR);
    PreferenceConverter.setDefault(preferences, STRING, STRING_DEFAULT_COLOR);
    PreferenceConverter.setDefault(preferences, DEFAULT, DEFAULT_DEFAULT_COLOR);
}
 
Example 13
Source File: PreferenceInitializer.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
	super.initializeDefaultPreferences();
	// Line colors
	Color lineColor = DiagramColorConstants.darkGray;
	PreferenceConverter.setDefault(getPreferenceStore(), IPreferenceConstants.PREF_LINE_COLOR, lineColor.getRGB());

	getPreferenceStore().setDefault(IPreferenceConstants.PREF_LINE_STYLE, Routing.RECTILINEAR);

	// rulers and grid defaults
	getPreferenceStore().setDefault(IPreferenceConstants.PREF_SNAP_TO_GEOMETRY, true);

	// set default font
	FontData defaultFont = new FontData("Verdana", 9, SWT.NONE);
	PreferenceConverter.setDefault(getPreferenceStore(), IPreferenceConstants.PREF_DEFAULT_FONT, defaultFont);

	// set preferences for tool palette.
	DefaultPaletteViewerPreferences prefs = new DefaultPaletteViewerPreferences();
	prefs.setLayoutSetting(DefaultPaletteViewerPreferences.LAYOUT_LIST);
	prefs.setCurrentUseLargeIcons(true);

	// State line and background color
	PreferenceConverter.setDefault(getPreferenceStore(), StatechartPreferenceConstants.PREF_STATE_BACKGROUND,
			StatechartColorConstants.STATE_BG_COLOR.getRGB());
	PreferenceConverter.setDefault(getPreferenceStore(), StatechartPreferenceConstants.PREF_STATE_LINE,
			StatechartColorConstants.STATE_LINE_COLOR.getRGB());

	// Region fill color
	PreferenceConverter.setDefault(getPreferenceStore(), StatechartPreferenceConstants.PREF_REGION_BACKGROUND,
			StatechartColorConstants.REGION_BG_COLOR.getRGB());
	PreferenceConverter.setDefault(getPreferenceStore(), StatechartPreferenceConstants.PREF_REGION_LINE,
			StatechartColorConstants.REGION_LINE_COLOR.getRGB());

	// Transition Priority Labels
	getPreferenceStore().setDefault(StatechartPreferenceConstants.PREF_PRIORITY_LABELS, true);
	// Live validation
	getPreferenceStore().setDefault(StatechartPreferenceConstants.PREF_LIVE_VALIDATION, true);
	// Syntax coloring
	getPreferenceStore().setDefault(StatechartPreferenceConstants.PREF_SYNTAX_COLORING, true);
	//Font scaling
	getPreferenceStore().setDefault(StatechartPreferenceConstants.PREF_FONT_SCALING, false);

}
 
Example 14
Source File: JsonPreferenceInitializer.java    From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 4 votes vote down vote up
protected void setColorPreferences(IPreferenceStore store) {
	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_DEFAULT, new RGB(0, 0, 0));
	store.setDefault(PreferenceConstants.BOLD_DEFAULT, false);
	store.setDefault(PreferenceConstants.ITALIC_DEFAULT, false);
	store.setDefault(PreferenceConstants.UNDERLINE_DEFAULT, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_COMMENT, new RGB(57, 127, 98));
	store.setDefault(PreferenceConstants.BOLD_COMMENT, false);
	store.setDefault(PreferenceConstants.ITALIC_COMMENT, false);
	store.setDefault(PreferenceConstants.UNDERLINE_COMMENT, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_KEY, new RGB(130, 0, 82));
	store.setDefault(PreferenceConstants.BOLD_KEY, true);
	store.setDefault(PreferenceConstants.ITALIC_KEY, false);
	store.setDefault(PreferenceConstants.UNDERLINE_KEY, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_DOCUMENT, new RGB(0, 0, 0));
	store.setDefault(PreferenceConstants.BOLD_DOCUMENT, false);
	store.setDefault(PreferenceConstants.ITALIC_DOCUMENT, false);
	store.setDefault(PreferenceConstants.UNDERLINE_DOCUMENT, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_SCALAR, new RGB(0, 0, 0));
	store.setDefault(PreferenceConstants.BOLD_SCALAR, false);
	store.setDefault(PreferenceConstants.ITALIC_SCALAR, false);
	store.setDefault(PreferenceConstants.UNDERLINE_SCALAR, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_ANCHOR, new RGB(175, 0, 255));
	store.setDefault(PreferenceConstants.BOLD_ANCHOR, false);
	store.setDefault(PreferenceConstants.ITALIC_ANCHOR, false);
	store.setDefault(PreferenceConstants.UNDERLINE_ANCHOR, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_ALIAS, new RGB(175, 0, 255));
	store.setDefault(PreferenceConstants.BOLD_ALIAS, false);
	store.setDefault(PreferenceConstants.ITALIC_ALIAS, false);
	store.setDefault(PreferenceConstants.UNDERLINE_ALIAS, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_TAG_PROPERTY, new RGB(175, 0, 255));
	store.setDefault(PreferenceConstants.BOLD_TAG_PROPERTY, false);
	store.setDefault(PreferenceConstants.ITALIC_TAG_PROPERTY, false);
	store.setDefault(PreferenceConstants.UNDERLINE_TAG_PROPERTY, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_INDICATOR_CHARACTER, new RGB(0, 0, 0));
	store.setDefault(PreferenceConstants.BOLD_INDICATOR_CHARACTER, false);
	store.setDefault(PreferenceConstants.ITALIC_INDICATOR_CHARACTER, false);
	store.setDefault(PreferenceConstants.UNDERLINE_INDICATOR_CHARACTER, false);

	PreferenceConverter.setDefault(store, PreferenceConstants.COLOR_CONSTANT, new RGB(45, 32, 244));
	store.setDefault(PreferenceConstants.BOLD_CONSTANT, true);
	store.setDefault(PreferenceConstants.ITALIC_CONSTANT, false);
	store.setDefault(PreferenceConstants.UNDERLINE_CONSTANT, false);
}
 
Example 15
Source File: TexlipsePreferenceInitializer.java    From texlipse with Eclipse Public License 1.0 4 votes vote down vote up
/**
     * Initialize all preferences to some default values.
     */
    public void initializeDefaultPreferences() {
        IPreferenceStore pref = TexlipsePlugin.getDefault().getPreferenceStore();
        
        pref.setDefault(TexlipseProperties.BIB_DIR, "");
        pref.setDefault(TexlipseProperties.OUTPUT_FORMAT, TexlipseProperties.OUTPUT_FORMAT_PDF);
        pref.setDefault(TexlipseProperties.BUILDER_NUMBER, 2);
        pref.setDefault(TexlipseProperties.BUILDER_CONSOLE_OUTPUT, true);
        pref.setDefault(TexlipseProperties.BUILDER_PARSE_AUX_FILES, true);
        pref.setDefault(TexlipseProperties.BUILD_BEFORE_VIEW, false);
        pref.setDefault(TexlipseProperties.FILE_LOCATION_PORT, FileLocationClient.DEFAULT_PORTNUMBER);
        
        initializePaths(pref);
        
        ColorManager.initializeDefaults(pref);
        
        BibColorProvider.initializeDefaults(pref);
        
        ViewerAttributeRegistry.initializeDefaults(pref);
        
        SpellChecker.initializeDefaults(pref);
        
        pref.setDefault(TexlipseProperties.BUILD_ENV_SETTINGS, "");
        pref.setDefault(TexlipseProperties.VIEWER_ENV_SETTINGS, "");
        pref.setDefault(TexlipseProperties.TEMP_FILE_EXTS, ".aux,.log,.toc,.ind,.ilg,.bbl,.blg,.lot,.lof,.snm,.nav,.out,.vrb,.run.xml,.bcf");
        pref.setDefault(TexlipseProperties.DERIVED_FILES, ".synctex.gz,.synctex,.pdfsync");
        
        pref.setDefault(TexlipseProperties.BIB_COMPLETION, true);
        pref.setDefault(TexlipseProperties.BIB_COMPLETION_DELAY, 500);
        pref.setDefault(TexlipseProperties.TEX_COMPLETION, true);
        pref.setDefault(TexlipseProperties.TEX_COMPLETION_DELAY, 500);
        pref.setDefault(TexlipseProperties.AUTO_PARSING, true);
        pref.setDefault(TexlipseProperties.AUTO_PARSING_DELAY, 2000);
        pref.setDefault(TexlipseProperties.SECTION_CHECK, true);
        
        pref.setDefault(TexlipseProperties.BIB_CODE_FOLDING, true);
        pref.setDefault(TexlipseProperties.BIB_FOLD_INITIAL, false);
        pref.setDefault(TexlipseProperties.BIB_STRING, false);
        
        pref.setDefault(TexlipseProperties.CODE_FOLDING, true);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_PREAMBLE, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_PART, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_CHAPTER, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_SECTION, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_SUBSECTION, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_SUBSUBSECTION, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_PARAGRAPH, false);
        pref.setDefault(TexlipseProperties.CODE_FOLDING_ENVS, "");
        
        pref.setDefault(TexlipseProperties.MATCHING_BRACKETS, true);
        PreferenceConverter.setDefault(pref, TexlipseProperties.MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192));
        
        pref.setDefault(TexlipseProperties.INDENTATION, true);
        pref.setDefault(TexlipseProperties.INDENTATION_LEVEL, 2);
        pref.setDefault(TexlipseProperties.INDENTATION_TABS, false);
        pref.setDefault(TexlipseProperties.INDENTATION_ENVS, "list,enumerate,itemize");
        pref.setDefault(TexlipseProperties.WORDWRAP_LENGTH, 80);
        pref.setDefault(TexlipseProperties.WORDWRAP_TYPE, TexlipseProperties.WORDWRAP_TYPE_HARD);
        pref.setDefault(TexlipseProperties.WORDWRAP_DEFAULT, true);
        pref.setDefault(TexlipseProperties.TEX_ITEM_COMPLETION, true);
        
        pref.setDefault(TexlipseProperties.SMART_BACKSPACE, true);
        pref.setDefault(TexlipseProperties.SMART_PARENS, true);
        pref.setDefault(TexlipseProperties.SMART_QUOTES, true);
        pref.setDefault(TexlipseProperties.SMART_LDOTS, true);
//      B----------------------------------- mmaus
        //pref.setDefault(TexlipseProperties.SMART_KEY_SETTINGS, "ll=list,en=enumerate,iz=itemize");
        pref.setDefault(TexlipseProperties.STYLE_COMPLETION_SETTINGS, "bold=\\textbf{,italic=\\textit{,roman=\\textrm{,sans serif=\\textsf{,small caps=\\textsc{,slanted=\\textsl{,teletype=\\texttt{,emphasize=\\emph{");
//      E----------------------------------- mmaus
        pref.setDefault(TexlipseProperties.TEX_EDITOR_ANNOTATATIONS, true);
        
        pref.setDefault(TexlipseProperties.OUTLINE_PREAMBLE, true);
        pref.setDefault(TexlipseProperties.OUTLINE_PART, true);
        pref.setDefault(TexlipseProperties.OUTLINE_CHAPTER, true);
        pref.setDefault(TexlipseProperties.OUTLINE_SECTION, true);
        pref.setDefault(TexlipseProperties.OUTLINE_SUBSECTION, true);
        pref.setDefault(TexlipseProperties.OUTLINE_SUBSUBSECTION, true);
        pref.setDefault(TexlipseProperties.OUTLINE_PARAGRAPH, true);
        pref.setDefault(TexlipseProperties.OUTLINE_ENVS, "list,enumerate,itemize,figure,table,tabular");
        
        pref.setDefault(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER, true);
        pref.setDefault(TexlipseProperties.SPELLCHECKER_IGNORE_COMMENTS, true);
        pref.setDefault(TexlipseProperties.SPELLCHECKER_IGNORE_MATH, false);
        pref.setDefault(TexlipseProperties.SPELLCHECKER_IGNORE_MIXED_CASE, true);
        
        pref.setDefault(TexlipseProperties.BUILDER_FORCE_RETURN_FOCUS, true);
    }
 
Example 16
Source File: PreferenceStoreAccessor.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void populateTextStyle(String id, TextStyle style, TextStyle defaults) {
	IPreferenceStore editorsStore = EditorsUI.getPreferenceStore();
	RGB fontColorDefaultDefault = editorsStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT) 
			? getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB()
			: PreferenceConverter.getColor(editorsStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);
	RGB backgrounColorDefaultDefault = editorsStore.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT) 
			? getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB() 
			: PreferenceConverter.getColor(editorsStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);
	FontData[] fontDataDefaultDefault = JFaceResources.getTextFont().getFontData();

	IPreferenceStore preferenceStore = getPreferenceStore();
	String cssID = CSS_PREFIX + id;
	IPreferenceStore cssPrefStore = getPluginCssPreferenceStore();
	
	String colorKey = PREFERENCE_TAG + getTokenColorPreferenceKey(id);
	String cssFontColor = cssPrefStore.getString(getTokenColorPreferenceKey(cssID));
	if(!Strings.isEmpty(cssFontColor)) {
		preferenceStore.setDefault(colorKey, cssFontColor);
	} else if (defaults.getColor() != null) {
		PreferenceConverter.setDefault(preferenceStore, colorKey, defaults.getColor());
	} else {
		PreferenceConverter.setDefault(preferenceStore, colorKey, fontColorDefaultDefault);
	}
	
	String backgroundKey = PREFERENCE_TAG + getTokenBackgroundColorPreferenceKey(id);
	String cssBgColor = cssPrefStore.getString(getTokenBackgroundColorPreferenceKey(cssID));
	if(!Strings.isEmpty(cssBgColor)) {
		preferenceStore.setDefault(backgroundKey, cssBgColor);
	} else if (defaults.getBackgroundColor() != null) {
		PreferenceConverter.setDefault(preferenceStore, backgroundKey, defaults.getBackgroundColor());
	} else {
		PreferenceConverter.setDefault(preferenceStore, backgroundKey, backgrounColorDefaultDefault);
	}
	
	String fontKey = PREFERENCE_TAG + getTokenFontPreferenceKey(id);
	String cssFont = cssPrefStore.getString(getTokenFontPreferenceKey(cssID));
	if(!Strings.isEmpty(cssFont)) {
		preferenceStore.setDefault(fontKey, cssFont);
	} else if (defaults.getFontData() != null)
		PreferenceConverter.setDefault(preferenceStore, fontKey, defaults.getFontData());
	else {
		PreferenceConverter.setDefault(preferenceStore, fontKey, fontDataDefaultDefault);
	}
	
	String styleKey = PREFERENCE_TAG + getTokenStylePreferenceKey(id);
	int cssStyle = cssPrefStore.getInt(getTokenStylePreferenceKey(cssID));
	if(cssStyle != 0) {
		preferenceStore.setDefault(styleKey, cssStyle);
	} else {
		preferenceStore.setDefault(styleKey, defaults.getStyle());
	}
	
	// populate
	RGB color = PreferenceConverter.getColor(preferenceStore, colorKey);
	if (!color.equals(fontColorDefaultDefault))
		style.setColor(color);
	RGB background = PreferenceConverter.getColor(preferenceStore, backgroundKey);
	if (!background.equals(backgrounColorDefaultDefault))
		style.setBackgroundColor(background);
	FontData[] fontDataArray = PreferenceConverter.getFontDataArray(preferenceStore, fontKey);
	if (!Arrays.equals(fontDataArray, fontDataDefaultDefault)) {
		style.setFontData(fontDataArray);
	}
	style.setStyle(preferenceStore.getInt(styleKey));
}
 
Example 17
Source File: PreferenceConstants.java    From typescript.java with MIT License 3 votes vote down vote up
/**
 * Sets the default value and fires a property change event if necessary.
 * 
 * @param store
 *            the preference store
 * @param key
 *            the preference key
 * @param newValue
 *            the new value
 * 
 */
private static void setDefaultAndFireEvent(IPreferenceStore store, String key, RGB newValue) {
	RGB oldValue = null;
	if (store.isDefault(key))
		oldValue = PreferenceConverter.getDefaultColor(store, key);

	PreferenceConverter.setDefault(store, key, newValue);

	if (oldValue != null && !oldValue.equals(newValue))
		store.firePropertyChangeEvent(key, oldValue, newValue);
}
 
Example 18
Source File: PreferenceConstants.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * This stores the given RGB value without firing
 * a property changed event.
 *
 * @param store the preference store
 * @param key the key
 * @param rgb the RGB value
 * @since 3.4
 */
private static void setRGBValue(IPreferenceStore store, String key, RGB rgb) {
	PreferenceConverter.setDefault(store, key, rgb);
	String value= store.getString(key);
	store.putValue(key, value);
}