當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。