本文整理汇总了Java中org.eclipse.jface.preference.PreferenceStore.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceStore.setValue方法的具体用法?Java PreferenceStore.setValue怎么用?Java PreferenceStore.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.preference.PreferenceStore
的用法示例。
在下文中一共展示了PreferenceStore.setValue方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
示例4: 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();
}
}
示例5: JavaPreview
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
public JavaPreview(Map<String, String> workingValues, Composite parent) {
JavaTextTools tools= JavaPlugin.getDefault().getJavaTextTools();
fPreviewDocument= new Document();
fWorkingValues= workingValues;
tools.setupJavaDocumentPartitioner( fPreviewDocument, IJavaPartitions.JAVA_PARTITIONING);
PreferenceStore prioritizedSettings= new PreferenceStore();
HashMap<String, String> complianceOptions= new HashMap<String, String>();
JavaModelUtil.setComplianceOptions(complianceOptions, JavaModelUtil.VERSION_LATEST);
for (Entry<String, String> complianceOption : complianceOptions.entrySet()) {
prioritizedSettings.setValue(complianceOption.getKey(), complianceOption.getValue());
}
IPreferenceStore[] chain= { prioritizedSettings, JavaPlugin.getDefault().getCombinedPreferenceStore() };
fPreferenceStore= new ChainedPreferenceStore(chain);
fSourceViewer= new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, fPreferenceStore);
fSourceViewer.setEditable(false);
Cursor arrowCursor= fSourceViewer.getTextWidget().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
fSourceViewer.getTextWidget().setCursor(arrowCursor);
// Don't set caret to 'null' as this causes https://bugs.eclipse.org/293263
// fSourceViewer.getTextWidget().setCaret(null);
fViewerConfiguration= new SimpleJavaSourceViewerConfiguration(tools.getColorManager(), fPreferenceStore, null, IJavaPartitions.JAVA_PARTITIONING, true);
fSourceViewer.configure(fViewerConfiguration);
fSourceViewer.getTextWidget().setFont(JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT));
fMarginPainter= new MarginPainter(fSourceViewer);
final RGB rgb= PreferenceConverter.getColor(fPreferenceStore, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
fMarginPainter.setMarginRulerColor(tools.getColorManager().getColor(rgb));
fSourceViewer.addPainter(fMarginPainter);
new JavaSourcePreviewerUpdater();
fSourceViewer.setDocument(fPreviewDocument);
}
示例6: setPingOptIn
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Saves the "ping opt in" value in the preference store.
*
* @param optIn The new user opt-in value.
*/
public void setPingOptIn(boolean optIn) {
PreferenceStore prefs = getPreferenceStore();
synchronized (DdmsPreferenceStore.class) {
prefs.setValue(PING_OPT_IN, optIn);
try {
prefs.save();
} catch (IOException e) {
/* ignore exceptions while saving preferences */
}
}
}
示例7: setPingTime
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Sets the ping time for the given app from the preference store.
* Callers should use {@link System#currentTimeMillis()} for time stamps.
*
* @param app The app name identifier.
* @param timeStamp The time stamp from the store.
* 0L is a special value that should not be used.
*/
public void setPingTime(String app, long timeStamp) {
PreferenceStore prefs = getPreferenceStore();
String timePref = PING_TIME + "." + app; //$NON-NLS-1$
synchronized (DdmsPreferenceStore.class) {
prefs.setValue(timePref, timeStamp);
try {
prefs.save();
} catch (IOException ioe) {
/* ignore exceptions while saving preferences */
}
}
}
示例8: setAdtUsed
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Sets whether the ADT startup wizard has been shown.
* ADT sets first to false once the welcome wizard has been shown once.
*
* @param used true if ADT has been used
*/
public void setAdtUsed(boolean used) {
PreferenceStore prefs = getPreferenceStore();
synchronized (DdmsPreferenceStore.class) {
prefs.setValue(ADT_USED, used);
try {
prefs.save();
} catch (IOException ioe) {
/* ignore exceptions while saving preferences */
}
}
}
示例9: setLastSdkPath
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Sets the last SDK OS path.
*
* @param osSdkPath The SDK OS Path. Can be null or empty.
*/
public void setLastSdkPath(String osSdkPath) {
PreferenceStore prefs = getPreferenceStore();
synchronized (DdmsPreferenceStore.class) {
prefs.setValue(LAST_SDK_PATH, osSdkPath);
try {
prefs.save();
} catch (IOException ioe) {
/* ignore exceptions while saving preferences */
}
}
}
示例10: setPreference
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
public static void setPreference(String name, Rectangle rect) {
PreferenceStore prefs = getPreferences();
prefs.setValue(name + "_x", rect.x);
prefs.setValue(name + "_y", rect.y);
prefs.setValue(name + "_width", rect.width);
prefs.setValue(name + "_height", rect.height);
save();
}
示例11: encodingControl
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Creates the encoding field editor.
*
* @param composite the parent composite
* @param string list with all controls
*/
private void encodingControl(Composite composite, String text) {
Label label = new Label(composite, SWT.NONE);
label.setText(text);
label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
fEncodingEditorParent = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginHeight = 0;
fEncodingEditorParent.setLayout(layout);
GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan = 3;
gd.horizontalIndent += SwtUtil.getIndent();
fEncodingEditorParent.setLayoutData(gd);
encEditor = new EncodingFieldEditor(SPELLING_USER_DICTIONARY_ENCODING, "", null, fEncodingEditorParent); //$NON-NLS-1$
PreferenceStore store = new PreferenceStore();
String defaultEncoding = ResourcesPlugin.getEncoding();
store.setDefault(SPELLING_USER_DICTIONARY_ENCODING, defaultEncoding);
String encoding = store.getString(SPELLING_USER_DICTIONARY_ENCODING);
if (encoding != null && encoding.length() > 0) store.setValue(SPELLING_USER_DICTIONARY_ENCODING, encoding);
encEditor.setPreferenceStore(store);
// Redirect status messages from the field editor to the status change listener
DialogPage fakePage = new DialogPage() {
public void createControl(Composite c) {}
@Override
public void setErrorMessage(String newMessage) {
StatusInfo status = new StatusInfo();
if (newMessage != null) status.setError(newMessage);
fEncodingFieldEditorStatus = status;
fContext.statusChanged(StatusUtil
.getMostSevere(new IStatus[] { fThresholdStatus, fFileStatus, fEncodingFieldEditorStatus }));
}
};
encEditor.setPage(fakePage);
encEditor.load();
if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0) {
encEditor.loadDefault();
}
}
示例12: createEncodingFieldEditor
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Creates the encoding field editor.
*
* @param composite the parent composite
* @param allControls list with all controls
* @since 3.3
*/
private void createEncodingFieldEditor(Composite composite, List<Control> allControls) {
Label filler= new Label(composite, SWT.NONE);
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 4;
filler.setLayoutData(gd);
Label label= new Label(composite, SWT.NONE);
label.setText(PreferencesMessages.SpellingPreferencePage_encoding_label);
label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
allControls.add(label);
fEncodingEditorParent= new Composite(composite, SWT.NONE);
GridLayout layout= new GridLayout(2, false);
layout.marginWidth= 0;
layout.marginHeight= 0;
fEncodingEditorParent.setLayout(layout);
gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 3;
fEncodingEditorParent.setLayoutData(gd);
fEncodingEditor= new EncodingFieldEditor(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), "", null, fEncodingEditorParent); //$NON-NLS-1$
PreferenceStore store= new PreferenceStore();
String defaultEncoding= ResourcesPlugin.getEncoding();
store.setDefault(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), defaultEncoding);
String encoding= getValue(PREF_SPELLING_USER_DICTIONARY_ENCODING);
if (encoding != null && encoding.length() > 0)
store.setValue(PREF_SPELLING_USER_DICTIONARY_ENCODING.getName(), encoding);
fEncodingEditor.setPreferenceStore(store);
// Redirect status messages from the field editor to the status change listener
DialogPage fakePage= new DialogPage() {
public void createControl(Composite c) {
}
@Override
public void setErrorMessage(String newMessage) {
StatusInfo status= new StatusInfo();
if (newMessage != null)
status.setError(newMessage);
fEncodingFieldEditorStatus= status;
fContext.statusChanged(StatusUtil.getMostSevere(new IStatus[] { fThresholdStatus, fFileStatus, fEncodingFieldEditorStatus }));
}
};
fEncodingEditor.setPage(fakePage);
fEncodingEditor.load();
if (encoding == null || encoding.equals(defaultEncoding) || encoding.length() == 0)
fEncodingEditor.loadDefault();
}
示例13: createConfiguration
import org.eclipse.jface.preference.PreferenceStore; //导入方法依赖的package包/类
/**
* Create a new configuration.
*
* @return a string that uniquely identifies the created configuration.
*/
public static String createConfiguration() {
int i;
String filename = "";
// Find the first "cfgXXX" available, 0 <= XXX <= 999.
// This implies a maximum of 1000 configuration files (HARDCODED)
for (i = 0; i <= 999; i++) {
filename =
Dazzl.DAZZL_PREFERENCE_STORE_PREFIX
+
String.format("%03d", i); //$NON-NLS-1$
if (preferenceStores.get(filename) == null) {
break; // stop as soon as we have found an available envXXX
}
}
if (i == 1000) {
// there are already 1000 configuration files
// it's hard to believe..
} else {
String fullfilename =
System.getProperty("user.home") //$NON-NLS-1$
+ File.separator
+ Dazzl.DAZZL_PREFERENCE_DIR
+ File.separator
+ filename;
File newConfiguration = new File(fullfilename);
try {
newConfiguration.createNewFile();
}
catch (IOException e) {
e.printStackTrace();
}
PreferenceStore store = new PreferenceStore(fullfilename);
if (instance.applicationUID == null || "".equals(instance.applicationUID)) {
instance.applicationUID = instance.createUID();
}
store.setValue(Dazzl.DAZZL_APPLICATION_UID, instance.applicationUID);
preferenceStores.put(filename, store);
}
return filename;
}