本文整理汇总了Java中org.osgi.service.prefs.Preferences.get方法的典型用法代码示例。如果您正苦于以下问题:Java Preferences.get方法的具体用法?Java Preferences.get怎么用?Java Preferences.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.osgi.service.prefs.Preferences
的用法示例。
在下文中一共展示了Preferences.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreState
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public IStatus restoreState(final IProgressMonitor monitor) {
final IStatus superRestoreResult = super.restoreState(monitor);
if (superRestoreResult.isOK()) {
final Preferences node = getPreferences();
final String orderedFilters = node.get(ORDERED_FILTERS_KEY, EMPTY_STRING);
if (!Strings.isNullOrEmpty(orderedFilters)) {
orderedWorkingSetFilters.clear();
orderedWorkingSetFilters.addAll(Arrays.asList(orderedFilters.split(SEPARATOR)));
}
discardWorkingSetCaches();
return statusHelper.OK();
}
return superRestoreResult;
}
示例2: restoreState
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public IStatus restoreState(final IProgressMonitor monitor) {
final Preferences node = getPreferences();
// Restore ordered labels.
final String orderedLabels = node.get(ORDERED_IDS_KEY, EMPTY_STRING);
if (!Strings.isNullOrEmpty(orderedLabels)) {
orderedWorkingSetIds.clear();
orderedWorkingSetIds.addAll(Arrays.asList(orderedLabels.split(SEPARATOR)));
}
// Restore visible labels.
final String visibleLabels = node.get(VISIBLE_IDS_KEY, EMPTY_STRING);
if (!Strings.isNullOrEmpty(visibleLabels)) {
visibleWorkingSetIds.clear();
visibleWorkingSetIds.addAll(Arrays.asList(visibleLabels.split(SEPARATOR)));
}
discardWorkingSetCaches();
return statusHelper.OK();
}
示例3: restoreState
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private IStatus restoreState() {
final Preferences node = getPreferences();
// Top level element.
workingSetTopLevel.set(node.getBoolean(IS_WORKINGSET_TOP_LEVEL_KEY, false));
// Active working set manager.
final String value = node.get(ACTIVE_MANAGER_KEY, "");
WorkingSetManager workingSetManager = contributions.get().get(value);
if (workingSetManager == null) {
if (!contributions.get().isEmpty()) {
workingSetManager = contributions.get().values().iterator().next();
}
}
if (workingSetManager != null) {
setActiveManager(workingSetManager);
}
return Status.OK_STATUS;
}
示例4: loadPrefsFromNode
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
protected void loadPrefsFromNode(Preferences preferences) {
try {
String[] keys = preferences.keys();
if (keys.length <= 0) {
return;
}
List<KeyValue> preferenceList = preferenceEntries.get(preferences.absolutePath());
if (null == preferenceList) {
preferenceList = new ArrayList<>();
preferenceEntries.put(preferences.absolutePath(), preferenceList);
}
for (String key : keys) {
String value = preferences.get(key, "*default*");
KeyValue current = new KeyValue(preferences.absolutePath(), key, value);
preferenceList.add(current);
}
} catch (org.osgi.service.prefs.BackingStoreException e) {
PrefEditorPlugin.log(e);
}
}
示例5: loadDictionaries
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@PostConstruct
private void loadDictionaries() {
targetDictionaries = HashMultimap.create();
sourceDictionaries = HashMultimap.create();
Preferences preferences = InstanceScope.INSTANCE
.getNode(TermSuiteUI.PLUGIN_ID);
String dictionaryDirectory = preferences.get(TermSuiteUIPreferences.BILINGUAL_DICTIONARY_DIRECTORY, null);
dictionaries = dictionaryDirectory == null ?
Lists.newArrayList() :
findDictionaries(Paths.get(dictionaryDirectory));
for(EBilingualDictionary dico:dictionaries) {
sourceDictionaries.put(dico.getSourceLang(), dico);
targetDictionaries.put(dico.getTargetLang(), dico);
}
}
示例6: restoreList
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public List restoreList(final String key, final Class itemType) {
try {
if (!currentNode.nodeExists(key)) {
return null;
}
final List results = new ArrayList();
final Preferences listNode = currentNode.node(key);
final String[] keys = listNode.keys();
Arrays.sort(keys);
final ObjectSerializer serializer = getObjectSerializer(itemType);
for (int i = 0; i < keys.length; i++) {
final String currentKey = listNode.get(keys[i], null);
final Object object = serializer.fromString(currentKey);
if (object != null) {
results.add(object);
}
}
return results;
} catch (final BackingStoreException ex) {
return null;
}
}
示例7: start
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
String platformHomeStr = null;
if (platformHome == null) {
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
platformHomeStr = preferences.get("platform_home", null);
if (platformHomeStr == null) {
IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
IPath platformProjectPath = platformProject.getLocation();
if (platformProjectPath != null) {
platformHome = platformProjectPath.toFile();
platformHomeStr = platformHome.getAbsolutePath();
}
} else {
platformHome = new File(platformHomeStr);
}
}
}
示例8: getPlatformHome
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public File getPlatformHome() {
if (platformHome == null) {
//Get platform home from workspace preferences
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
String platformHomeStr = preferences.get("platform_home", null);
if (platformHomeStr == null) {
IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
IPath platformProjectPath = platformProject.getLocation();
if (platformProjectPath != null) {
setPlatformHome(platformProjectPath.toFile());
}
}
else {
setPlatformHome(new File(platformHomeStr));
}
}
return platformHome;
}
示例9: test
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public boolean test(Object arg0, String arg1, Object[] arg2, Object arg3) {
boolean enableOption = false;
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
String platformHomeStr = preferences.get("platform_home", null);
if (platformHomeStr == null) {
IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
IPath platformProjectPath = platformProject.getLocation();
if (platformProjectPath != null) {
enableOption = true;
}
}
else {
enableOption = true;
}
return enableOption;
}
示例10: getCurrentState
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public Map<String, String> getCurrentState() {
Map<String, String> map = new HashMap<String, String>(1);
boolean enableOption = false;
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
String platformHomeStr = preferences.get("platform_home", null);
if (platformHomeStr == null) {
IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
IPath platformProjectPath = platformProject.getLocation();
if (platformProjectPath != null) {
enableOption = true;
}
}
else {
enableOption = true;
}
if (enableOption) {
map.put(ID, ENABLED);
}
else {
map.put(ID, DISABLED);
}
return map;
}
示例11: start
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
String platformHomeStr = null;
if (platformHome == null) {
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
platformHomeStr = preferences.get("platform_home", null);
if (platformHomeStr == null) {
IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
IPath platformProjectPath = platformProject.getLocation();
if (platformProjectPath != null) {
platformHome = platformProjectPath.toFile();
}
}
else {
platformHome = new File(platformHomeStr);
}
}
disableProjectNatureSolutionLookup();
log("Disabled automatic project nature solution lookup");
}
示例12: start
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
String platformHomeStr = null;
if (platformHome == null) {
Preferences preferences = InstanceScope.INSTANCE.getNode("com.hybris.hyeclipse.preferences");
platformHomeStr = preferences.get("platform_home", null);
if (platformHomeStr == null) {
IProject platformProject = ResourcesPlugin.getWorkspace().getRoot().getProject("platform");
IPath platformProjectPath = platformProject.getLocation();
if (platformProjectPath != null) {
platformHome = platformProjectPath.toFile();
platformHomeStr = platformHome.getAbsolutePath();
}
}
else {
platformHome = new File(platformHomeStr);
}
}
}
示例13: loadPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
/**
* Load the parameters to run ModularityCheck.
*/
public void loadPreferences() {
@SuppressWarnings("deprecation")
Preferences preferences = new InstanceScope().getNode(PLUGIN_ID);
try {
repoType = preferences.getInt(REPO_TYPE, 0);
repoManager = preferences.getInt(REPO_MANAGER, 0);
repoUrl = preferences.get(REPO_URL, " ");
repoXml = preferences.get(REPO_XML, " ");
repoBegin = new SimpleDateFormat("yyyy-MM-dd").parse(preferences
.get(REPO_BEGIN, (new Date()).toString()));
repoEnd = new SimpleDateFormat("yyyy-MM-dd").parse(preferences.get(
REPO_END, (new Date()).toString()));
lastExec = preferences.get(LAST_EXEC_PARAMS, " ");
} catch (ParseException e) {
ConfigurationsDialog cd = new ConfigurationsDialog();
cd.showDialog(Display.getDefault().getActiveShell());
}
}
示例14: getFolderFromPreferences
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private static File getFolderFromPreferences() {
IPreferencesService service = Platform.getPreferencesService();
Preferences node = service.getRootNode().node(ConfigurationScope.SCOPE).node(CoreActivator.PLUGIN_ID);
if(node!=null) {
String folderPath = node.get(DesignerCoreConstants.CONFIG_FOLDER_PREFERENCE, null);
if(folderPath!=null) {
File file = new File(folderPath);
if(file!=null && file.isDirectory()) {
return file;
} else {
logger.warn("'{}' is no valid directory.", folderPath);
}
}
}
return null;
}
示例15: storeDefaults
import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
protected void storeDefaults()
{
// Don't store builtin themes default copy in prefs!
if (getThemeManager().isBuiltinTheme(getName()))
{
return;
}
// Only save to defaults if it has never been saved there. Basically take a snapshot of first version and
// use that as the "default"
IEclipsePreferences prefs = EclipseUtil.defaultScope().getNode(ThemePlugin.PLUGIN_ID);
if (prefs == null)
{
return; // TODO Log something?
}
Preferences preferences = prefs.node(ThemeManager.THEMES_NODE);
if (preferences == null)
{
return;
}
String value = preferences.get(getName(), null);
if (value == null)
{
save(EclipseUtil.defaultScope());
}
}