当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceStore类代码示例

本文整理汇总了Java中org.eclipse.jface.preference.PreferenceStore的典型用法代码示例。如果您正苦于以下问题:Java PreferenceStore类的具体用法?Java PreferenceStore怎么用?Java PreferenceStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PreferenceStore类属于org.eclipse.jface.preference包,在下文中一共展示了PreferenceStore类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadPreferences

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
/**
 * Loads preferences from a properties file.
 * 
 * @throws IOException if there are problems loading the preferences file
 */
private void loadPreferences() throws IOException {
	// props = new Properties();
	String userFile = getPreferencesFilename();
	if (log.isDebugEnabled())
		log.debug("Loading from [" + userFile + "]");
	File prefsFile = new File(userFile);
	if (!prefsFile.exists()) {
		File prefsDir = new File(System.getProperty("user.home") + File.separator + PROPS_DIR);
		if (!prefsDir.exists()) {
			prefsDir.mkdir();
		}
	}

	prefStore = new PreferenceStore(getPreferencesFilename());
	JFacePreferences.setPreferenceStore(prefStore);
	new JpwPreferenceInitializer().initializeDefaultPreferences();

	if (prefsFile.exists()) {
		prefStore.load();
	}
	// TODO: Check what happens if no file exists?

	if (log.isDebugEnabled())
		log.debug("Loaded " + prefStore + " preference settings from file");
}
 
开发者ID:nresare,项目名称:javapasswordsafe,代码行数:31,代码来源:UserPreferences.java

示例2: getReconciler

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
/**
 * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getReconciler(org.eclipse.jface.text.source.ISourceViewer)
 */
@Override
public IReconciler getReconciler(ISourceViewer sourceViewer) {
    if (fPreferenceStore == null || !fPreferenceStore.getBoolean(SpellingService.PREFERENCE_SPELLING_ENABLED))
        return null;
    if (!TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.ECLIPSE_BUILDIN_SPELLCHECKER))
        return null;
    //Set TeXlipse spelling Engine as default
    PreferenceStore store = new PreferenceStore();
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENGINE, 
            "org.eclipse.texlipse.LaTeXSpellEngine");
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, 
    true);
    SpellingService spellingService = new SpellingService(store);
    if (spellingService.getActiveSpellingEngineDescriptor(store) == null)
        return null;
    IReconcilingStrategy strategy= new TeXSpellingReconcileStrategy(sourceViewer, spellingService);
    
    MonoReconciler reconciler= new MonoReconciler(strategy, true);
    reconciler.setDelay(500);
    reconciler.setProgressMonitor(new NullProgressMonitor());
    return reconciler;
}
 
开发者ID:eclipse,项目名称:texlipse,代码行数:26,代码来源:TexSourceViewerConfiguration.java

示例3: createDialogElements

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
@Override
protected WipTabElements createDialogElements(Composite composite, final Runnable modifyListener,
    PreferenceStore store) {
  final TabElements basicElements =
      createBasicTabElements(composite, modifyListener, store, getParams());

  final BackendSelectorControl backendSelector =
      new BackendSelectorControl(composite, backendMap, modifyListener);
  backendSelector.getMainControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

  return new WipTabElements() {
    @Override public BackendSelectorControl getBackendSelector() {
      return backendSelector;
    }
    @Override
    public TabElements getBase() {
      return basicElements;
    }
  };
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:21,代码来源:WipRemoteTab.java

示例4: Main

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
/**
 * Main launcher
 */
private Main() {
    this.startedPlugins = new ArrayList<DazzlPlugin>();
    this.display = new Display();
    Display.setAppName("Dazzl"); //$NON-NLS-1$

    this.shell = new Shell(display);

    this.preferenceStores = new TreeMap<String, PreferenceStore>();
    this.preferenceDirectory = new File(
            System.getProperty("user.home") //$NON-NLS-1$
                    + File.separator
                    + Dazzl.DAZZL_PREFERENCE_DIR
    );

}
 
开发者ID:rhamnett,项目名称:dazzl,代码行数:19,代码来源:Main.java

示例5: generateNewPingId

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
/**
 * Generates a new random ping ID and saves it in the preference store.
 *
 * @return The new ping ID.
 */
public long generateNewPingId() {
    PreferenceStore prefs = getPreferenceStore();

    Random rnd = new Random();
    long id = rnd.nextLong();

    synchronized (DdmsPreferenceStore.class) {
        prefs.setValue(PING_ID, id);
        try {
            prefs.save();
        } catch (IOException e) {
            /* ignore exceptions while saving preferences */
        }
    }

    return id;
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:23,代码来源:DdmsPreferenceStore.java

示例6: createStyledTextForCodePresentation

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
/**
 * @return a styled text that can be used to show code with the colors based on the color cache received.
 */
public StyledText createStyledTextForCodePresentation(Composite parent) {
    styledText = new StyledText(parent, SWT.BORDER | SWT.READ_ONLY);
    this.backgroundColorCache = new ColorAndStyleCache(new PreferenceStore());
    this.colorCache = new ColorAndStyleCache(null);

    try {
        styledText.setFont(new Font(parent.getDisplay(), FontUtils.getFontData(IFontUsage.STYLED, true)));
    } catch (Throwable e) {
        //ignore
    }
    updateBackgroundColor();

    PydevPrefs.getChainedPrefStore().addPropertyChangeListener(this);

    return styledText;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:20,代码来源:StyledTextForShowingCodeFactory.java

示例7: testInterpreterManager

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
public void testInterpreterManager() throws Exception {
    Collection<String> pythonpath = new ArrayList<String>();
    pythonpath.add(TestDependent.PYTHON_LIB);
    pythonpath.add(TestDependent.PYTHON_SITE_PACKAGES);

    PreferenceStore prefs = new PreferenceStore();
    String interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON_EXE, pythonpath).toString();
    prefs.setValue(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);
    PythonInterpreterManager manager = new PythonInterpreterManager(prefs);
    checkSameInterpreterInfo(manager);

    manager.clearCaches();
    InterpreterInfo info = checkSameInterpreterInfo(manager);

    pythonpath = new ArrayList<String>();
    pythonpath.add(TestDependent.PYTHON_LIB);
    pythonpath.add(TestDependent.PYTHON_SITE_PACKAGES);
    pythonpath.add(additionalPythonpathEntry.toString());
    interpreterStr = new InterpreterInfo("2.6", TestDependent.PYTHON_EXE, pythonpath).toString();
    prefs.setValue(IInterpreterManager.PYTHON_INTERPRETER_PATH, interpreterStr);

    info = checkSameInterpreterInfo(manager);
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:24,代码来源:InterpreterManagerTest.java

示例8: createCodeScanner

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
private PyCodeScanner createCodeScanner() {
    PreferenceStore store = new PreferenceStore();
    store.putValue(PydevEditorPrefs.KEYWORD_COLOR, StringConverter.asString(new RGB(1, 0, 0)));
    store.putValue(PydevEditorPrefs.SELF_COLOR, StringConverter.asString(new RGB(2, 0, 0)));
    store.putValue(PydevEditorPrefs.CODE_COLOR, StringConverter.asString(new RGB(3, 0, 0)));
    store.putValue(PydevEditorPrefs.DECORATOR_COLOR, StringConverter.asString(new RGB(4, 0, 0)));
    store.putValue(PydevEditorPrefs.NUMBER_COLOR, StringConverter.asString(new RGB(5, 0, 0)));
    store.putValue(PydevEditorPrefs.FUNC_NAME_COLOR, StringConverter.asString(new RGB(6, 0, 0)));
    store.putValue(PydevEditorPrefs.CLASS_NAME_COLOR, StringConverter.asString(new RGB(7, 0, 0)));
    store.putValue(PydevEditorPrefs.OPERATORS_COLOR, StringConverter.asString(new RGB(8, 0, 0)));
    store.putValue(PydevEditorPrefs.PARENS_COLOR, StringConverter.asString(new RGB(9, 0, 0)));

    this.colorCache = new ColorAndStyleCache(store);
    PyCodeScanner scanner = new PyCodeScanner(colorCache);
    return scanner;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:17,代码来源:PyCodeScannerTest.java

示例9: PyParser

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
/**
 * Should only be called for testing. Does not register as a thread.
 */
public PyParser(IGrammarVersionProvider grammarVersionProvider) {
    super(PyParserManager.getPyParserManager(new PreferenceStore()));
    if (grammarVersionProvider == null) {
        grammarVersionProvider = new IGrammarVersionProvider() {
            @Override
            public int getGrammarVersion() {
                return IPythonNature.LATEST_GRAMMAR_VERSION;
            }

            @Override
            public AdditionalGrammarVersionsToCheck getAdditionalGrammarVersions()
                    throws MisconfigurationException {
                return null;
            }
        };
    }
    this.grammarVersionProvider = grammarVersionProvider;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:22,代码来源:PyParser.java

示例10: testIntegration

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
public void testIntegration() throws Exception {
    PreferenceStore preferences = new PreferenceStore();
    PyParserManager pyParserManager = PyParserManager.getPyParserManager(preferences);

    Document doc = new Document();
    PyEditStub pyEdit = new PyEditStub(doc, new PydevFileEditorInputStub());
    pyParserManager.attachParserTo(pyEdit);
    checkParserChanged(pyEdit, 1);

    doc.replace(0, 0, "\r\ntest");
    checkParserChanged(pyEdit, 2);

    pyParserManager.attachParserTo(pyEdit);
    checkParserChanged(pyEdit, 3);

    doc.replace(0, 0, "\r\ntest"); //after this change, only 1 reparse should be asked, as the editor and doc is the same
    checkParserChanged(pyEdit, 4);

    pyParserManager.notifyEditorDisposed(pyEdit);
    doc.replace(0, 0, "\r\ntest"); //after this change, only 1 reparse should be asked, as the editor and doc is the same
    waitABit();
    assertEquals(4, pyEdit.parserChanged);

    assertEquals(0, pyParserManager.getParsers().size());
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:26,代码来源:PyParserEditorIntegrationTest.java

示例11: setUp

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
@Before
public void setUp() {
  evaluationService = mock( IEvaluationService.class );
  workbench = mock( IWorkbench.class );
  when( workbench.getService( IEvaluationService.class ) ).thenReturn( evaluationService );
  preferences = new WorkspaceScopePreferences( new PreferenceStore() );
  action = new CloseJUnitStatusAction( workbench, preferences );
}
 
开发者ID:rherrmann,项目名称:eclipse-extras,代码行数:9,代码来源:CloseJUnitStatusActionTest.java

示例12: createPreferences

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
private static PreferenceStore createPreferences(final Properties properties) throws IOException {
	final PreferenceStore preferences = new PreferenceStore();
	ByteArrayOutputStream output = new ByteArrayOutputStream();
	properties.store(output, null);
	ByteArrayInputStream input = new ByteArrayInputStream(output.toByteArray());
	preferences.load(input);
	return preferences;
}
 
开发者ID:diffplug,项目名称:spotless,代码行数:9,代码来源:GrEclipseFormatterStepImpl.java

示例13: load

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
private void load () {
	subComp = new Composite(parent, SWT.NULL);
	GridData gridData = new GridData();
	gridData.horizontalSpan = colspan;
	subComp.setLayoutData(gridData);
	String s = UIUtil.getResourceLabel(labelRef);
	if (null == s) s = labelRef;
	this.editor = new BooleanFieldEditor(name, s, subComp);
	if (null != defaultValue) {
		PreferenceStore ps = new PreferenceStore();
		ps.setValue(name, defaultValue.booleanValue());
		editor.setPreferenceStore(ps);
		editor.load();
	}
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:16,代码来源:BooleanEditor.java

示例14: createElements

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
@Override
protected ELEMENTS createElements(Composite parent, Runnable modifyListener) {
  Composite composite = createDefaultComposite(parent);
  setControl(composite);

  PreferenceStore store = new PreferenceStore();

  composite.setFont(parent.getFont());

  return createDialogElements(composite, modifyListener, store);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:12,代码来源:ChromiumRemoteTab.java

示例15: createPreferenceStore

import org.eclipse.jface.preference.PreferenceStore; //导入依赖的package包/类
protected PreferenceStore createPreferenceStore() {
	final String fileName = preferencesCallback.getFileName();
	final PreferenceStore store = new ConfigurationStore(fileName);

	// Set default values...
	for (final IPreference preference : preferences) {
		if (preference.getDefaultValue() != null) {
			store.setDefault(preference.getName(), preference.getDefaultValue());
		}
	}

	return store;
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:14,代码来源:Preferences.java


注:本文中的org.eclipse.jface.preference.PreferenceStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。