本文整理汇总了Java中org.osgi.service.prefs.Preferences.putBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.putBoolean方法的具体用法?Java Preferences.putBoolean怎么用?Java Preferences.putBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgi.service.prefs.Preferences
的用法示例。
在下文中一共展示了Preferences.putBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveState
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private IStatus saveState() {
final Preferences node = getPreferences();
// Top level element.
node.putBoolean(IS_WORKINGSET_TOP_LEVEL_KEY, workingSetTopLevel.get());
// Active working set manager.
final WorkingSetManager activeManager = getActiveManager();
final String activeId = activeManager == null ? null : activeManager.getId();
node.put(ACTIVE_MANAGER_KEY, Strings.nullToEmpty(activeId));
try {
node.flush();
return OK_STATUS;
} catch (final BackingStoreException e) {
final String message = "Unexpected error when trying to persist working set broker state.";
LOGGER.error(message, e);
return statusHelper.createError(message, e);
}
}
示例2: performSpecificOk
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
protected boolean performSpecificOk(Preferences prefs) throws CoreException {
prefs.remove(preferenceKey(MinifyBuilder.YUI_PRESERVE_SEMICOLONS));
prefs.remove(preferenceKey(MinifyBuilder.YUI_DISABLE_OPTIMIZATIONS));
prefs.remove(preferenceKey(MinifyBuilder.GCC_OPTIMIZATION));
if (selection().getText().equals(OPTIONS[1][1])) {
prefs.putBoolean(preferenceKey(MinifyBuilder.YUI_PRESERVE_SEMICOLONS),
preserveSemicolons.getSelection());
prefs.putBoolean(preferenceKey(MinifyBuilder.YUI_DISABLE_OPTIMIZATIONS),
disableOptimizations.getSelection());
} else if (selection().getText().equals(OPTIONS[1][2])) {
for (int i = 0; i < optimizations[0].length; i++) {
if (gccOptimization.getText().equals(optimizations[1][i])) {
prefs.put(preferenceKey(MinifyBuilder.GCC_OPTIMIZATION), optimizations[0][i]);
break;
}
}
}
return true;
}
示例3: performOk
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public boolean performOk() {
Preferences preferences = ConfigurationScope.INSTANCE.getNode("org.mdpm.lng.plan.preferences");
preferences.putBoolean("sunday", sunday.getSelection());
preferences.putBoolean("monday", monday.getSelection());
preferences.putBoolean("tuesday", tuesday.getSelection());
preferences.putBoolean("wednesday", wednesday.getSelection());
preferences.putBoolean("thursday", thursday.getSelection());
preferences.putBoolean("friday", friday.getSelection());
preferences.putBoolean("saturday", saturday.getSelection());
String tmp="";
if(dates.getItemCount()>0){
for (int k=0; k<dates.getItemCount();k++){
tmp = tmp+dates.getItem(k)+",";
}
}
preferences.put("dates",tmp);
//preferences.put
try {
preferences.flush();
} catch (BackingStoreException e) {
e.printStackTrace();
}
return super.performOk();
}
示例4: migratePreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public static void migratePreferences() {
Preferences pref = new ProfileScope(getDefaultAgentLocation(), IProfileRegistry.SELF).getNode(P2_Activator.PLUGIN_ID);
try {
if (pref.keys().length == 0) {
// migrate preferences from instance scope to profile scope
Preferences oldPref = new InstanceScope().getNode(P2_Activator.PLUGIN_ID);
// don't migrate everything. Some of the preferences moved to
// another bundle.
pref.put(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, oldPref.get(PreferenceConstants.PREF_OPEN_WIZARD_ON_ERROR_PLAN, MessageDialogWithToggle.PROMPT));
pref.putBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, oldPref.getBoolean(PreferenceConstants.PREF_SHOW_LATEST_VERSION, true));
pref.flush();
}
} catch (BackingStoreException e) {
StatusManager.getManager().handle(new Status(IStatus.ERROR, P2_Activator.PLUGIN_ID, 0, ProvSDKMessages.PreferenceInitializer_Error, e), StatusManager.LOG);
}
}
示例5: setExpertModeEnabled
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
/**
* Set the expert view enabled state for the given project and tries to save
* the settings.
*
* @param projectName
* The name of the project
* @param enabled
* <code>true</code> for enabled, otherwise <code>false</code>
* @return <code>true</code> on success, otherwise <code>false</code>
*/
public static boolean setExpertModeEnabled(String projectName, boolean enabled) {
Preferences prefs = getProjectPreferences(projectName);
boolean oldValue = isExpertViewEnabled(projectName);
prefs.putBoolean(KEY_EXPERT_VIEW_ENABLED, enabled);
// force save
try {
prefs.flush();
return true;
} catch (BackingStoreException e) {
LOGGER.error("Saving expert mode enabled state failed.", e);
// restore old value
prefs.putBoolean(KEY_EXPERT_VIEW_ENABLED, oldValue);
DialogUtils.openWarning("Could not change the expert mode due to an error!");
return false;
}
}
示例6: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences() {
Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE);
for (int i = 0; i < AnalysisPreferences.completeSeverityMap.length; i++) {
Object[] s = AnalysisPreferences.completeSeverityMap[i];
node.putInt((String) s[1], (Integer) s[2]);
}
node.put(NAMES_TO_IGNORE_UNUSED_VARIABLE, DEFAULT_NAMES_TO_IGNORE_UNUSED_VARIABLE);
node.put(NAMES_TO_IGNORE_UNUSED_IMPORT, DEFAULT_NAMES_TO_IGNORE_UNUSED_IMPORT);
node.put(NAMES_TO_CONSIDER_GLOBALS, DEFAULT_NAMES_TO_CONSIDER_GLOBALS);
node.putBoolean(DO_CODE_ANALYSIS, DEFAULT_DO_CODE_ANALYSIS);
node.putBoolean(DO_AUTO_IMPORT, DEFAULT_DO_AUT_IMPORT);
node.putBoolean(DO_AUTO_IMPORT_ON_ORGANIZE_IMPORTS, DEFAULT_DO_AUTO_IMPORT_ON_ORGANIZE_IMPORTS);
node.putBoolean(DO_IGNORE_IMPORTS_STARTING_WITH_UNDER, DEFAULT_DO_IGNORE_FIELDS_WITH_UNDER);
//pep8 related.
node.putBoolean(AnalysisPreferencesPage.USE_PEP8_CONSOLE, AnalysisPreferencesPage.DEFAULT_USE_PEP8_CONSOLE);
node.putBoolean(AnalysisPreferencesPage.PEP8_USE_SYSTEM, AnalysisPreferencesPage.DEFAULT_PEP8_USE_SYSTEM);
}
示例7: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences() {
Preferences node = DefaultScope.INSTANCE.getNode(PydevPlugin.DEFAULT_PYDEV_SCOPE);
node.put(PyLintPrefPage.PYLINT_FILE_LOCATION, "");
node.putBoolean(PyLintPrefPage.USE_PYLINT, PyLintPrefPage.DEFAULT_USE_PYLINT);
node.putInt(PyLintPrefPage.SEVERITY_ERRORS, PyLintPrefPage.DEFAULT_SEVERITY_ERRORS);
node.putInt(PyLintPrefPage.SEVERITY_WARNINGS, PyLintPrefPage.DEFAULT_SEVERITY_WARNINGS);
node.putInt(PyLintPrefPage.SEVERITY_FATAL, PyLintPrefPage.DEFAULT_SEVERITY_FATAL);
node.putInt(PyLintPrefPage.SEVERITY_CODING_STANDARD, PyLintPrefPage.DEFAULT_SEVERITY_CODING_STANDARD);
node.putInt(PyLintPrefPage.SEVERITY_REFACTOR, PyLintPrefPage.DEFAULT_SEVERITY_REFACTOR);
node.putBoolean(PyLintPrefPage.USE_CONSOLE, PyLintPrefPage.DEFAULT_USE_CONSOLE);
node.put(PyLintPrefPage.PYLINT_ARGS, PyLintPrefPage.DEFAULT_PYLINT_ARGS);
}
示例8: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences(){
Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID); //$NON-NLS-1$
// default values
node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, true);
node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true);
node.putBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true);
node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false);
node.putInt(PreferenceConstants.RESTART_POLICY,
Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
node.putInt(PreferenceConstants.UPDATE_WIZARD_STYLE, Policy.UPDATE_STYLE_MULTIPLE_IUS);
node.putBoolean(PreferenceConstants.FILTER_ON_ENV, true);
node.putInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT, SWT.DEFAULT);
node.putInt(PreferenceConstants.UPDATE_DETAILS_WIDTH, SWT.DEFAULT);
}
示例9: persistSelections
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private void persistSelections() {
// persist checkbox selections for next time
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
preferences.putBoolean(FIX_CLASS_PATH_ISSUES_PREFERENCE, fixClasspathIssuesButton.getSelection());
preferences.putBoolean(REMOVE_HYBRIS_BUILDER_PREFERENCE, removeHybrisItemsXmlGeneratorButton.getSelection());
preferences.putBoolean(REMOVE_EXISTING_PROJECTS_PREFERENCE, removeExistingProjects.getSelection());
preferences.putBoolean(CREATE_WORKING_SETS_PREFERENCE, createWorkingSetsButton.getSelection());
preferences.putBoolean(USE_MULTI_THREAD_PREFERENCE, useMultiThreadButton.getSelection());
preferences.putBoolean(SKIP_JAR_SCANNING_PREFERENCE, skipJarScanningButton.getSelection());
try {
preferences.flush();
} catch (BackingStoreException e) {
throw new IllegalStateException("Could not save preferences", e);
}
}
示例10: persistSelections
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private void persistSelections() {
// persist checkbox selections for next time
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
preferences.putBoolean(ImportPlatformPage.FIX_CLASS_PATH_ISSUES_PREFERENCE, fixClasspathIssuesButton.getSelection());
preferences.putBoolean(ImportPlatformPage.REMOVE_HYBRIS_BUILDER_PREFERENCE, removeHybrisItemsXmlGeneratorButton.getSelection());
preferences.putBoolean(ImportPlatformPage.CREATE_WORKING_SETS_PREFERENCE, createWorkingSetsButton.getSelection());
preferences.putBoolean(ImportPlatformPage.USE_MULTI_THREAD_PREFERENCE, useMultiThreadButton.getSelection());
preferences.putBoolean(ImportPlatformPage.SKIP_JAR_SCANNING_PREFERENCE, skipJarScanningButton.getSelection());
try {
preferences.flush();
} catch (BackingStoreException e) {
throw new IllegalStateException("Could not save preferences", e);
}
}
示例11: persist
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private void persist(DockerConnectionElement connElem) {
Preferences preferences = InstanceScope.INSTANCE
.getNode(Activator.PLUGIN_ID);
if(connElem != null){
String name = connElem.getName();
String authPath = connElem.getAuthPath();
String host = connElem.getHost();
boolean isUseDefault = connElem.isUseDefault();
boolean isUseUnixSocket = connElem.isUseUnixSocket();
boolean isUseHTTPS = connElem.isUseHTTPS();
boolean isEnableAuth = connElem.isEnableAuth();
String socketPath = connElem.getSocketPath();
Preferences sub1 = preferences.node(name);
sub1.put("name", name);
sub1.putBoolean("isUseDefault", isUseDefault);
sub1.putBoolean("isUseUnixSocket", isUseUnixSocket);
sub1.put("socketPath", socketPath);
sub1.putBoolean("isUseHTTPS", isUseHTTPS);
sub1.put("host", host);
sub1.putBoolean("isEnableAuth", isEnableAuth);
sub1.put("authPath", authPath);
}
try {
// forces the application to save the preferences
preferences.flush();
} catch (BackingStoreException e2) {
e2.printStackTrace();
}
}
示例12: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public void initializeDefaultPreferences() {
Preferences node = DefaultScope.INSTANCE.getNode(Activator.PLUGIN_ID);
// default values
node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, false);
node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true);
node.putBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true);
node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false);
node.putInt(PreferenceConstants.RESTART_POLICY, Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
node.putInt(PreferenceConstants.UPDATE_WIZARD_STYLE, Policy.UPDATE_STYLE_MULTIPLE_IUS);
node.putBoolean(PreferenceConstants.FILTER_ON_ENV, false);
node.putInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT, SWT.DEFAULT);
node.putInt(PreferenceConstants.UPDATE_DETAILS_WIDTH, SWT.DEFAULT);
}
示例13: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public void initializeDefaultPreferences() {
Preferences node = new DefaultScope().getNode(Activator.PLUGIN_ID); //$NON-NLS-1$
// default values
node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, false);
node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true);
node.putBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true);
node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false);
node.putInt(PreferenceConstants.RESTART_POLICY, Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
node.putInt(PreferenceConstants.UPDATE_WIZARD_STYLE, Policy.UPDATE_STYLE_MULTIPLE_IUS);
node.putBoolean(PreferenceConstants.FILTER_ON_ENV, false);
node.putInt(PreferenceConstants.UPDATE_DETAILS_HEIGHT, SWT.DEFAULT);
node.putInt(PreferenceConstants.UPDATE_DETAILS_WIDTH, SWT.DEFAULT);
}
示例14: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public void initializeDefaultPreferences() {
Preferences node = new DefaultScope().getNode(Activator.PLUGIN_ID); //$NON-NLS-1$
// default values
node.putBoolean(PreferenceConstants.REPOSITORIES_VISIBLE, false);
node.putBoolean(PreferenceConstants.SHOW_LATEST_VERSION_ONLY, true);
node.putBoolean(PreferenceConstants.AVAILABLE_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.INSTALLED_SHOW_ALL_BUNDLES, false);
node.putBoolean(PreferenceConstants.AVAILABLE_GROUP_BY_CATEGORY, true);
node.putBoolean(PreferenceConstants.SHOW_DRILLDOWN_REQUIREMENTS, false);
node.putInt(PreferenceConstants.RESTART_POLICY, Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
}
示例15: initializeDefaultPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences() {
Preferences node = DefaultScope.INSTANCE.getNode(DEFAULT_SCOPE);
node.putBoolean(JyScriptingPreferencesPage.SHOW_SCRIPTING_OUTPUT,
JyScriptingPreferencesPage.DEFAULT_SHOW_SCRIPTING_OUTPUT);
node.putBoolean(JyScriptingPreferencesPage.LOG_SCRIPTING_ERRORS,
JyScriptingPreferencesPage.DEFAULT_LOG_SCRIPTING_ERRORS);
}