當前位置: 首頁>>代碼示例>>Java>>正文


Java PreferenceConverter.setDefault方法代碼示例

本文整理匯總了Java中org.eclipse.jface.preference.PreferenceConverter.setDefault方法的典型用法代碼示例。如果您正苦於以下問題:Java PreferenceConverter.setDefault方法的具體用法?Java PreferenceConverter.setDefault怎麽用?Java PreferenceConverter.setDefault使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.preference.PreferenceConverter的用法示例。


在下文中一共展示了PreferenceConverter.setDefault方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
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());
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:20,代碼來源:PreferenceInitializer.java

示例2: initializeDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public void initializeDefaultPreferences() {
  IPreferenceStore store = JuliaEditorPlugin.getDefault().getPreferenceStore();
  EditorsUI.useAnnotationsPreferencePage(store);
  EditorsUI.useQuickDiffPreferencePage(store);
  PreferenceConstants.initializeDefaultValues(store);
  PreferenceConverter.setDefault(store, JuliaColourConstants.COMMENT, COMMENT_COLOUR);
  PreferenceConverter.setDefault(store, JuliaColourConstants.KEYWORD, KEYWORD_COLOUR);
  PreferenceConverter.setDefault(store, JuliaColourConstants.STRING, STRING_COLOUR);

  store.setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_BOLD_SUFFIX, false);
  store
      .setDefault(JuliaColourConstants.COMMENT + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);

  store.setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_BOLD_SUFFIX, true);
  store
      .setDefault(JuliaColourConstants.KEYWORD + PreferenceConstants.EDITOR_ITALIC_SUFFIX, false);

  store.setDefault(PreferenceConstants.EDITOR_TAB_WIDTH, 4);
  store.setDefault(PreferenceConstants.EDITOR_SYNC_OUTLINE_ON_CURSOR_MOVE, true);

  store.setDefault(CodeFormatterConstants.FORMATTER_TAB_CHAR, CodeFormatterConstants.TAB);
  store.setDefault(CodeFormatterConstants.FORMATTER_TAB_SIZE, "4");
  store.setDefault(CodeFormatterConstants.FORMATTER_INDENTATION_SIZE, "4");
}
 
開發者ID:JuliaComputing,項目名稱:JuliaDT,代碼行數:25,代碼來源:JuliaEditorPreferencesInitializer.java

示例3: setupDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
private void setupDefaultPreferences() {
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.LOGCAT_VIEW_FONT_PREFKEY,
            DEFAULT_LOGCAT_FONTDATA);
    mPrefStore.setDefault(LogCatMessageList.MAX_MESSAGES_PREFKEY,
            LogCatMessageList.MAX_MESSAGES_DEFAULT);
    mPrefStore.setDefault(DISPLAY_FILTERS_COLUMN_PREFKEY, true);

    /* Default Colors for different log levels. */
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.VERBOSE_COLOR_PREFKEY,
            new RGB(0, 0, 0));
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.DEBUG_COLOR_PREFKEY,
            new RGB(0, 0, 127));
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.INFO_COLOR_PREFKEY,
            new RGB(0, 127, 0));
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.WARN_COLOR_PREFKEY,
            new RGB(255, 127, 0));
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.ERROR_COLOR_PREFKEY,
            new RGB(255, 0, 0));
    PreferenceConverter.setDefault(mPrefStore, LogCatPanel.ASSERT_COLOR_PREFKEY,
            new RGB(255, 0, 0));
}
 
開發者ID:utds3lab,項目名稱:SMVHunter,代碼行數:22,代碼來源:LogCatPanel.java

示例4: initializeDefaults

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
/**
 * Set default colors in given preference store.
 */
public static void initializeDefaults(IPreferenceStore aStore)
{
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DEFAULT, RGB_DEFAULT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_TAG, RGB_DIRECTIVE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_SCRIPT, RGB_SCRIPT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_COMMENT, RGB_COMMENT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DOC_COMMENT, RGB_DOC_COMMENT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DIRECTIVE, RGB_DIRECTIVE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_STRING, RGB_STRING);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_REFERENCE, RGB_REFERENCE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_STRING_REFERENCE, RGB_STRING_REFERENCE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_String, RGB_HTML_String);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_ENDTAG, RGB_HTML_ENDTAG);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_TAG, RGB_HTML_TAG);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_ATTRIBUTE, RGB_HTML_ATTRIBUTE);
}
 
開發者ID:ninneko,項目名稱:velocity-edit,代碼行數:20,代碼來源:VelocityColorProvider.java

示例5: initDefaults

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
/**
 * 
 */
public static void initDefaults(IPreferenceStore aStore)
{
    PreferenceConverter.setDefault(aStore, AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND, Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
    aStore.setDefault(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, true);
    PreferenceConverter.setDefault(aStore, AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
    aStore.setDefault(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, true);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DEFAULT, RGB_DEFAULT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_TAG, RGB_DIRECTIVE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_SCRIPT, RGB_SCRIPT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_COMMENT, RGB_COMMENT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DOC_COMMENT, RGB_DOC_COMMENT);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_DIRECTIVE, RGB_DIRECTIVE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_STRING, RGB_STRING);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_REFERENCE, RGB_REFERENCE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_STRING_REFERENCE, RGB_STRING_REFERENCE);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_String, RGB_HTML_String);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_ENDTAG, RGB_HTML_ENDTAG);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_TAG, RGB_HTML_TAG);
    PreferenceConverter.setDefault(aStore, IPreferencesConstants.COLOR_RGB_HTML_ATTRIBUTE, RGB_HTML_ATTRIBUTE);
}
 
開發者ID:ninneko,項目名稱:velocity-edit,代碼行數:24,代碼來源:EditorPreferencePage.java

示例6: initializeDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
@Override
public void initializeDefaultPreferences() {
	IPreferenceStore store = BfActivator.getDefault().getPreferenceStore();
	store.setDefault(TEMPLATE_KEY, "");
	
	IPreferenceStore editorStore = EditorsUI.getPreferenceStore();
	editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS, true);
	editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_CARET, false);
	editorStore.setDefault(EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_SHOW_ENCLOSING, false);
	PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_MATCHING_BRACKETS_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY));
	
	PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_KEY_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_MAGENTA));
	PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_OTHER_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GRAY));
	PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_COMMENT_CHAR_COLOR, getSystemColorRGB(SWT.COLOR_DARK_GREEN));
	PreferenceConverter.setDefault(editorStore, EditorConstants.PREF_EDITOR_TEMPLATE_PARAMS_COLOR, getSystemColorRGB(SWT.COLOR_BLUE));
	
	editorStore.setDefault(EditorConstants.PREF_EDITOR_CLOSE_BRACKET, true);
}
 
開發者ID:RichardBirenheide,項目名稱:brainfuck,代碼行數:19,代碼來源:BfPreferenceInitializer.java

示例7: getDefaults

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public static void getDefaults(IPreferenceStore store) {
	store.setDefault(P_PAGE_DESIGN_BORDER_STYLE, DEFAULT_BORDERSTYLE);
	store.setDefault(P_ELEMENT_DESIGN_BORDER_COLOR, DEFAULT_ELEMENT_DESIGN_BORDER_COLOR);
	store.setDefault(P_ELEMENT_DESIGN_BORDER_STYLE, "rectangle"); //$NON-NLS-1$
	store.setDefault(P_PAGE_DEFAULT_UNITS, "px"); //$NON-NLS-1$
	store.setDefault(P_CONTAINER_MARGIN_COLOR, DEFAULT_MARGINCOLOR);
	store.setDefault(P_PAGE_MARGIN_COLOR, DEFAULT_MARGINCOLOR);
	store.setDefault(P_SHOW_REPORT_BAND_NAMES, true);
	store.setDefault(P_PAGE_BACKGROUND, DEFAULT_PAGE_BACKGROUND);
	store.setDefault(BEHAVIOR_ON_FIELD_DROP, DEFAULT_BEHAVIOR);
	store.setDefault(P_USE_FIELD_DESCRIPTION, false);
	PreferenceConverter.setDefault(store, P_INTERNAL_EDITORS_FONT, FontUtils.getTextEditorFontData());
	store.setDefault(P_SAVE_ON_PREVIEW, false);
	store.setDefault(P_CENTER_SELECTION, true);
	store.setDefault(P_RESIZE_CONTAINER, true);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:17,代碼來源:DesignerPreferencePage.java

示例8: initializeDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
@Override
public void initializeDefaultPreferences() {
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
       PreferenceConverter.setDefault(store, GradleEditorConstants.KEY_COLOR_COMMENT, GradleEditorConstants.DEFAULT_COLOR_COMMENT);
       PreferenceConverter.setDefault(store, GradleEditorConstants.KEY_COLOR_DOC, GradleEditorConstants.DEFAULT_COLOR_DOC);
       PreferenceConverter.setDefault(store, GradleEditorConstants.KEY_COLOR_KEYWORD, GradleEditorConstants.DEFAULT_COLOR_KEYWORD);
       PreferenceConverter.setDefault(store, GradleEditorConstants.KEY_COLOR_STRING, GradleEditorConstants.DEFAULT_COLOR_STRING);
       PreferenceConverter.setDefault(store, GradleEditorConstants.KEY_COLOR_NUMBER, GradleEditorConstants.DEFAULT_COLOR_NUMBER);
       PreferenceConverter.setDefault(store, GradleEditorConstants.KEY_COLOR_NORMAL, GradleEditorConstants.DEFAULT_COLOR_NORMAL);
       store.setDefault(GradleEditorConstants.KEY_BOLD_KEYWORD, true);	}
 
開發者ID:Nodeclipse,項目名稱:GradleEditor,代碼行數:11,代碼來源:GradleEditorPreferenceInitializer.java

示例9: initializeDefaults

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:13,代碼來源:BibColorProvider.java

示例10: initializeDefaults

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
/**
 * 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);
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:37,代碼來源:ColorManager.java

示例11: initializeDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
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());
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:13,代碼來源:PreferenceInitializer.java

示例12: initializeDefaultPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
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);
	
}
 
開發者ID:SAP,項目名稱:hybris-commerce-eclipse-plugin,代碼行數:14,代碼來源:PreferenceInitializer.java

示例13: loadDefaultPluginPreferences

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
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());
}
 
開發者ID:anb0s,項目名稱:LogViewer,代碼行數:13,代碼來源:LogViewerPlugin.java

示例14: setDefaultColor

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public void setDefaultColor(PreferenceIdentifiable identifiable, RGB color) {
	PreferenceConverter.setDefault(getPreferenceStore(), identifiable.getId(), color);
}
 
開發者ID:de-jcup,項目名稱:eclipse-batch-editor,代碼行數:4,代碼來源:BatchEditorPreferences.java

示例15: populateTextStyle

import org.eclipse.jface.preference.PreferenceConverter; //導入方法依賴的package包/類
public void populateTextStyle(String id, TextStyle style, TextStyle defaults) {
	// prepare
	String colorKey = PREFERENCE_TAG + PreferenceStoreAccessor.getTokenColorPreferenceKey(id);
	String backgroundKey = PREFERENCE_TAG + getTokenBackgroundColorPreferenceKey(id);
	String fontKey = PREFERENCE_TAG + getTokenFontPreferenceKey(id);
	String styleKey = PREFERENCE_TAG + getTokenStylePreferenceKey(id);

	// DefaultDefault
	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();

	// set defaults
	IPreferenceStore preferenceStore = getPreferenceStore();
	if (defaults.getColor() != null)
		PreferenceConverter.setDefault(preferenceStore, colorKey, defaults.getColor());
	else {
		PreferenceConverter.setDefault(preferenceStore, colorKey, fontColorDefaultDefault);
	}
	if (defaults.getBackgroundColor() != null)
		PreferenceConverter.setDefault(preferenceStore, backgroundKey, defaults.getBackgroundColor());
	else {
		PreferenceConverter.setDefault(preferenceStore, backgroundKey, backgrounColorDefaultDefault);
	}
	if (defaults.getFontData() != null)
		PreferenceConverter.setDefault(preferenceStore, fontKey, defaults.getFontData());
	else {
		PreferenceConverter.setDefault(preferenceStore, fontKey, fontDataDefaultDefault);
	}
	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));
}
 
開發者ID:cplutte,項目名稱:bts,代碼行數:51,代碼來源:PreferenceStoreAccessor.java


注:本文中的org.eclipse.jface.preference.PreferenceConverter.setDefault方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。