当前位置: 首页>>代码示例>>Java>>正文


Java IEclipsePreferences.addPreferenceChangeListener方法代码示例

本文整理汇总了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);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:20,代码来源:Activator.java

示例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);
	}
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:19,代码来源:ThemeManager.java

示例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;
}
 
开发者ID:google,项目名称:depan,代码行数:14,代码来源:RendererPreferences.java

示例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);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:10,代码来源:UIPlugin.java

示例5: addListener

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private void addListener(IEclipsePreferences node) {
  node.addNodeChangeListener(listener);
  node.addPreferenceChangeListener(listener);
  recordedNodes.add(node);
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:6,代码来源:PreferenceRecorder.java

示例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;
}
 
开发者ID:eclipse,项目名称:eavp,代码行数:58,代码来源:VizConnectionManager.java

示例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);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:7,代码来源:InvasiveThemeHijacker.java


注:本文中的org.eclipse.core.runtime.preferences.IEclipsePreferences.addPreferenceChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。