本文整理汇总了Java中org.eclipse.core.runtime.preferences.IEclipsePreferences.addPreferenceChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java IEclipsePreferences.addPreferenceChangeListener方法的具体用法?Java IEclipsePreferences.addPreferenceChangeListener怎么用?Java IEclipsePreferences.addPreferenceChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.runtime.preferences.IEclipsePreferences
的用法示例。
在下文中一共展示了IEclipsePreferences.addPreferenceChangeListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
final IEclipsePreferences node = getPreferencesRootNode();
repoSvc = new WorkflowRepositoryServiceImpl(node.get(REPOSITORY_LOCATION_PREFNAME, REPOSITORY_LOCATION_DEFVALUE));
preferenceChangeListener = new IPreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if(REPOSITORY_LOCATION_PREFNAME.equals(event.getKey()) && (repoSvc != null)) {
// it seems that when you Restore Defaults for preferences, this gives a new value null i.o. the default value!
String newValue = (event.getNewValue()!=null)? (String) event.getNewValue() : REPOSITORY_LOCATION_DEFVALUE;
repoSvc.setRootFolder(new File(newValue));
}
}
};
node.addPreferenceChangeListener(preferenceChangeListener);
Hashtable<String, String> svcProps = new Hashtable<>();
svcProps.put("type", "FILE");
repoSvcReg = context.registerService(WorkflowRepositoryService.class, repoSvc, svcProps);
}
示例2: addPreferenceChangeListener
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Add preference change listener to observe changed of Eclipse E4 Theme and
* TextMate theme association with grammar.
*
* @param themeChangeListener
*/
public void addPreferenceChangeListener(IPreferenceChangeListener themeChangeListener) {
// Observe change of Eclipse E4 Theme
IEclipsePreferences preferences = getPreferenceE4CSSTheme();
if (preferences != null) {
preferences.addPreferenceChangeListener(themeChangeListener);
}
// Observe change of TextMate Theme association
preferences = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
if (preferences != null) {
preferences.addPreferenceChangeListener(themeChangeListener);
}
}
示例3: preparePreferences
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Create a new updater for the user's Eclipse preferences, and configure
* it to keep the OGL renderer up to date.
*/
public static RendererPreferences preparePreferences(GLPanel glPanel) {
RendererPreferences result = new RendererPreferences(glPanel);
result.setPreferences();
// Register the new instance for preference changes
IEclipsePreferences prefs = PreferencesIds.getInstanceNode();
prefs.addPreferenceChangeListener(result);
return result;
}
示例4: addAutoBuildListener
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
* Adds a listener to changes in the Project->Build Automatically changes.
*/
private void addAutoBuildListener()
{
IEclipsePreferences node = EclipseUtil.instanceScope().getNode(ResourcesPlugin.PI_RESOURCES);
autoBuildListener = new AutoBuildListener();
node.addPreferenceChangeListener(autoBuildListener);
}
示例5: addListener
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private void addListener(IEclipsePreferences node) {
node.addNodeChangeListener(listener);
node.addPreferenceChangeListener(listener);
recordedNodes.add(node);
}
示例6: 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;
}
示例7: apply
import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public void apply()
{
earlyStartup();
IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(ThemePlugin.PLUGIN_ID);
prefs.addPreferenceChangeListener(this);
}