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


Java IEclipsePreferences.IPreferenceChangeListener方法代码示例

本文整理汇总了Java中org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java IEclipsePreferences.IPreferenceChangeListener方法的具体用法?Java IEclipsePreferences.IPreferenceChangeListener怎么用?Java IEclipsePreferences.IPreferenceChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.runtime.preferences.IEclipsePreferences的用法示例。


在下文中一共展示了IEclipsePreferences.IPreferenceChangeListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChangeListener

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
 * return the listener for preferences changes.
 * @return the change listener
 */
private IEclipsePreferences.IPreferenceChangeListener getChangeListener() {
	if (changeListener==null) {
		changeListener = new IEclipsePreferences.IPreferenceChangeListener() {
			@Override
			public void preferenceChange(PreferenceChangeEvent pce) {
				
				if (debug==true) System.out.println("Property '" + pce.getKey() + "' changed from " + pce.getOldValue() + " to "+ pce.getNewValue());
				
				switch(pce.getKey()) {
				case DEF_RUNAS:
					boolean changedExecutionMode = (pce.getOldValue()!=null && pce.getNewValue()!=pce.getOldValue());
					if (changedExecutionMode==true) {
						if (debug==true) System.out.println("Changed Execution Mode: changed from " + pce.getOldValue() + " to "+ pce.getNewValue());
						//TODO if the preference dialog was set to SWT!
					}
				}
			}
		};
	}
	return changeListener;
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:26,代码来源:BundleProperties.java

示例2: initializePreferencesListener

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
 * Initialize the preferences listener.
 */
private void initializePreferencesListener() {
	if (preferencesListener == null) {
		preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() {
			/*
			 * (non-Javadoc)
			 * 
			 * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
			 */
			public void preferenceChange(PreferenceChangeEvent event) {

				if (silentRunning) {
					return;
				}

				Object oldValue = event.getOldValue();
				Object newValue = event.getNewValue();
				String key = event.getKey();
				if (newValue == null) {
					newValue = getDefault(key, oldValue);
				} else if (oldValue == null) {
					oldValue = getDefault(key, newValue);
				}
				firePropertyChangeEvent(event.getKey(), oldValue, newValue);
			}
		};
		getStorePreferences().addPreferenceChangeListener(
				preferencesListener);
	}

}
 
开发者ID:cplutte,项目名称:bts,代码行数:34,代码来源:ScopedPreferenceStore.java

示例3: initializePreferencesListener

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
 * Initialize the preferences listener.
 */
private void initializePreferencesListener() {
	if (preferencesListener == null) {
		preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() {
			/*
			 * (non-Javadoc)
			 * 
			 * @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
			 */
			@Override
			public void preferenceChange(PreferenceChangeEvent event) {

				if (silentRunning) {
					return;
				}

				Object oldValue = event.getOldValue();
				Object newValue = event.getNewValue();
				String key = event.getKey();
				if (newValue == null) {
					newValue = getDefault(key, oldValue);
				} else if (oldValue == null) {
					oldValue = getDefault(key, newValue);
				}
				firePropertyChangeEvent(event.getKey(), oldValue, newValue);
			}
		};
		getStorePreferences().addPreferenceChangeListener(
				preferencesListener);
	}

}
 
开发者ID:fipro78,项目名称:e4-cookbook-migration-guide,代码行数:35,代码来源:ScopedPreferenceStore.java

示例4: nodeSrcPath

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
protected synchronized IPath nodeSrcPath()
{
	// Cache value and hook pref listener
	if (fNodeSrcPathListener == null)
	{
		fNodeSrcPathListener = new IEclipsePreferences.IPreferenceChangeListener()
		{
			public void preferenceChange(PreferenceChangeEvent event)
			{
				if (IPreferenceConstants.NODEJS_SOURCE_PATH.equals(event.getKey()))
				{
					String value = (String) event.getNewValue();
					if (StringUtil.isEmpty(value))
					{
						fNodeSrcPath = null;
					}
					else
					{
						fNodeSrcPath = Path.fromOSString(value);
					}
				}
			}
		};
		EclipseUtil.instanceScope().getNode(JSCorePlugin.PLUGIN_ID)
				.addPreferenceChangeListener(fNodeSrcPathListener);

		String value = Platform.getPreferencesService().getString(JSCorePlugin.PLUGIN_ID,
				IPreferenceConstants.NODEJS_SOURCE_PATH, null, null);
		if (StringUtil.isEmpty(value))
		{
			fNodeSrcPath = null;
		}
		else
		{
			fNodeSrcPath = Path.fromOSString(value);
		}
	}

	return fNodeSrcPath;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:41,代码来源:NodeModuleResolver.java

示例5: initializeValues

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
 * Add a pref change listener for changes to values, set up starting values. This is a performance change so we
 * don't lookup the preference values repeatedly.
 */
protected synchronized static void initializeValues()
{
	if (fgPrefListener == null)
	{
		final IScopeContext[] contexts = new IScopeContext[] { EclipseUtil.instanceScope(),
				EclipseUtil.defaultScope() };
		try
		{
			fgPrefListener = new IEclipsePreferences.IPreferenceChangeListener()
			{

				public void preferenceChange(PreferenceChangeEvent event)
				{
					if (ICorePreferenceConstants.TASK_TAGS_CASE_SENSITIVE.equals(event.getKey()))
					{
						fgCaseSensitive = Platform.getPreferencesService().getBoolean(PREF_PLUGIN_ID,
								ICorePreferenceConstants.TASK_TAGS_CASE_SENSITIVE, true, contexts);
					}
					else if (ICorePreferenceConstants.TASK_TAG_PRIORITIES.equals(event.getKey())
							|| ICorePreferenceConstants.TASK_TAG_NAMES.equals(event.getKey()))
					{
						fgTaskTags = getCurrentTaskTags();
					}
				}
			};
			EclipseUtil.instanceScope().getNode(PREF_PLUGIN_ID).addPreferenceChangeListener(fgPrefListener);
		}
		catch (Exception e)
		{
			IdeLog.logError(CorePlugin.getDefault(), "Failed to attach preference listener for task tag prefs", e); //$NON-NLS-1$
			fgPrefListener = null;
		}
		fgCaseSensitive = Platform.getPreferencesService().getBoolean(PREF_PLUGIN_ID,
				ICorePreferenceConstants.TASK_TAGS_CASE_SENSITIVE, true, contexts);
	}
	if (fgTaskTags == null)
	{
		fgTaskTags = getCurrentTaskTags();
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:45,代码来源:TaskTag.java


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