本文整理汇总了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");
}
示例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;
}
示例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;
}
};
}
示例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
);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
示例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 );
}
示例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;
}
示例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();
}
}
示例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);
}
示例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;
}