本文整理汇总了Java中org.eclipse.core.runtime.preferences.IEclipsePreferences.keys方法的典型用法代码示例。如果您正苦于以下问题:Java IEclipsePreferences.keys方法的具体用法?Java IEclipsePreferences.keys怎么用?Java IEclipsePreferences.keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.preferences.IEclipsePreferences
的用法示例。
在下文中一共展示了IEclipsePreferences.keys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfigEclipse
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private Map<ConfigTypes, String> getConfigEclipse(IEclipsePreferences pref ) {
Map<ConfigTypes, String> ret = new HashMap<ConfigTypes, String>();
for (ConfigTypes k:ConfigTypes.values()){
if (defaults.containsKey(k))
ret.put(k,defaults.get(k));
else
ret.put(k,"");
}
try {
for (String configKey : pref.keys()) {
for (ConfigTypes c : configKeys.keySet()) {
if (configKey.equals(configKeys.get(c))){
ret.put(c, pref.get(configKey, ""));
}
}
}
} catch (BackingStoreException e) {
}
return ret;
}
示例2: createSettings
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private static void createSettings(IProject project, String backend, String resourcesPath, String sourcesPath, String stylesheetPath,
String targetPath) throws BackingStoreException {
final IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences preferences = projectScope.getNode(Activator.PLUGIN_ID);
if (preferences.keys().length == 0) {
preferences.put(BACKEND_PROPERTY, backend);
preferences.put(RESOURCESPATH_PROPERTY, resourcesPath);
preferences.put(SOURCESPATH_PROPERTY, sourcesPath);
preferences.put(STYLESHEETPATH_PROPERTY, stylesheetPath);
preferences.put(TARGETPATH_PROPERTY, targetPath);
preferences.flush();
}
}
示例3: loadPreferences
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Loads the specified {@link ConnectionTable} based on the current
* preferences.
*
* @param table
* The table to load the current preferences into.
*/
private void loadPreferences(ConnectionTable table) {
// Get the preference node for connection preferences.
CustomScopedPreferenceStore store = (CustomScopedPreferenceStore) getPreferenceStore();
IEclipsePreferences node = store
.getNode(getConnectionsPreferenceNodeId());
// Load the current preferences into the table.
String[] existingKeys;
try {
existingKeys = node.keys();
for (String key : existingKeys) {
int index = table.addRow();
List<VizEntry> row = table.getRow(index);
// Update the key/name in the table.
row.get(0).setValue(key);
// Update the other properties.
String[] preferences = unserializeConnectionPreferences(
node.get(key, null));
for (int i = 0; i < preferences.length; i++) {
row.get(i + 1).setValue(preferences[i]);
}
}
} catch (BackingStoreException e) {
e.printStackTrace();
}
return;
}
示例4: setPreferenceStore
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public ArrayList<Future<ConnectionState>> setPreferenceStore(
CustomScopedPreferenceStore store, String preferenceNodeId)
throws NullPointerException {
// Throw an exception if the preference node ID is null. We must have a
// valid node ID if we have a store.
if (store != null && preferenceNodeId == null) {
throw new NullPointerException("VizConnectionManager error: "
+ "Preference node ID cannot be null.");
}
// A list of future references to conenction states of all attempted
// connections for the manager
ArrayList<Future<ConnectionState>> states = new ArrayList<Future<ConnectionState>>();
if (store != preferenceStore
|| !preferenceNodeId.equals(connectionsNodeId)) {
// If the old store/node ID is valid, unregister the preferences
// listener and remove all current connections from the manager.
if (preferenceStore != null) {
preferenceStore.getNode(connectionsNodeId)
.removePreferenceChangeListener(preferenceListener);
preferenceStore = null;
connectionsNodeId = null;
// Remove all current connections.
connectionsByName.clear();
connectionsByHost.clear();
}
// If the new store/node ID is valid, add all new connections, then
// register the preferences listener.
if (store != null) {
// Get the node under which the connections will be stored.
IEclipsePreferences node = store.getNode(preferenceNodeId);
// Add all connections in the new preference store.
try {
String[] connectionNames = node.keys();
for (String connection : connectionNames) {
String preferences = node.get(connection, null);
states.add(addConnection(connection, preferences));
}
} catch (BackingStoreException e) {
e.printStackTrace();
}
// Register with the new store.
node.addPreferenceChangeListener(preferenceListener);
}
// Update the references to the store and the ID.
preferenceStore = store;
connectionsNodeId = preferenceNodeId;
}
return states;
}