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


Java Preferences.remove方法代码示例

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


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

示例1: removeResource

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Remove a resource (i.e. all its properties) from the builder's preferences.
 * 
 * @param prefs the preferences
 * @param resource the resource
 * @throws BackingStoreException
 */
public static void removeResource(Preferences prefs, IResource resource) 
		throws CoreException {
	try {
		String[] keys = prefs.keys();
		for (String key: keys) {
			if (key.endsWith("//" + resource.getProjectRelativePath().toPortableString())) {
				prefs.remove(key);
			}
		}
		prefs.flush();
	} catch (BackingStoreException e) {
		throw new CoreException(new Status(
				IStatus.ERROR, MinifyBuilder.BUILDER_ID, e.getMessage(), e));
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:23,代码来源:PrefsAccess.java

示例2: moveResource

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Associate one resource's properties with another resource.
 * 
 * @param fromPrefs the preferences to take the properties from
 * @param fromResource the resource to take the properties from
 * @param toPrefs the preferences to move the properties to
 * @param toResource the resource to associated with the properties
 * @throws BackingStoreException
 */
public static void moveResource(Preferences fromPrefs, IResource fromResource,
		Preferences toPrefs, IResource toResource) 
		throws CoreException {
	try {
		String[] keys = fromPrefs.keys();
		for (String key: keys) {
			if (key.endsWith("//" + fromResource.getProjectRelativePath().toPortableString())) {
				String resourcePreference = key.substring(0, key.indexOf('/'));
				toPrefs.put(preferenceKey(toResource, resourcePreference), fromPrefs.get(key, ""));
				fromPrefs.remove(key);
			}
		}
		fromPrefs.flush();
		toPrefs.flush();
	} catch (BackingStoreException e) {
		throw new CoreException(new Status(
				IStatus.ERROR, MinifyBuilder.BUILDER_ID, e.getMessage(), e));
	}
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:29,代码来源:PrefsAccess.java

示例3: performSpecificOk

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
@Override
protected boolean performSpecificOk(Preferences prefs) throws CoreException {
	prefs.remove(preferenceKey(MinifyBuilder.YUI_PRESERVE_SEMICOLONS));
	prefs.remove(preferenceKey(MinifyBuilder.YUI_DISABLE_OPTIMIZATIONS));
	prefs.remove(preferenceKey(MinifyBuilder.GCC_OPTIMIZATION));
	if (selection().getText().equals(OPTIONS[1][1])) {
		prefs.putBoolean(preferenceKey(MinifyBuilder.YUI_PRESERVE_SEMICOLONS),
				preserveSemicolons.getSelection());
		prefs.putBoolean(preferenceKey(MinifyBuilder.YUI_DISABLE_OPTIMIZATIONS),
				disableOptimizations.getSelection());
	} else if (selection().getText().equals(OPTIONS[1][2])) {
		for (int i = 0; i < optimizations[0].length; i++) {
			if (gccOptimization.getText().equals(optimizations[1][i])) {
				prefs.put(preferenceKey(MinifyBuilder.GCC_OPTIMIZATION), optimizations[0][i]);
				break;
			}
		}
	}
		
	return true;
}
 
开发者ID:mnlipp,项目名称:EclipseMinifyBuilder,代码行数:22,代码来源:MinifyJsPropertyPage.java

示例4: deletePre

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private void deletePre() {
	try {
		String[] sa = pref.node("fileList").keys();
		if (sa.length == 0){
			return;
		}
		ElementListSelectionDialog dialog = new ElementListSelectionDialog(input.getShell(), new LabelProvider());
		dialog.setTitle("Select file list that you want to remove");
		dialog.setElements(sa);
		dialog.setMessage("Type to filter by name:");
		dialog.setMultipleSelection(true);
		if (dialog.open() == ElementListSelectionDialog.OK) {
			Object[] oa = dialog.getResult();
			Preferences p = pref.node("fileList");
			for (int i = 0; i < oa.length; i++) {
				String key = (String)oa[i];
				remove(key);
				p.remove(key);
			}
			pref.put("selectedList", "");
		}
	} catch (Exception e) {
		TFMPlugin.error("FileListMenuMgr deletePre", e);
	}
}
 
开发者ID:BeckYang,项目名称:TeamFileList,代码行数:26,代码来源:FileListMenuMgr.java

示例5: deleteProjectProperty

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
/**
 * 
 * Removes specified property key from the project properties file.
 * 
 * @param project 
 * 			Project in explorer tree view.
 * @param key 
 * 			Key to remove from the properties.
 */
public static synchronized void deleteProjectProperty(IProject project, String key) {
	
	final Preferences preferences = getProjectProperties(project);
	preferences.remove(key);
	
	BatchExecutor.getInstance().addTask(preferences, "flush", new Runnable() {
		@Override
		public void run() {
			try {
				preferences.flush();
			} 
			catch (BackingStoreException e) {
				e.printStackTrace();
			}
		}
	});
	
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:28,代码来源:ExplorerProjectPaths.java

示例6: delete

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
private void delete(IScopeContext context)
{
	try
	{
		IEclipsePreferences prefs = context.getNode(ThemePlugin.PLUGIN_ID);
		Preferences preferences = prefs.node(ThemeManager.THEMES_NODE);
		preferences.remove(getName());
		preferences.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(ThemePlugin.getDefault(), e);
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:15,代码来源:Theme.java

示例7: cleanJavaCore

import org.osgi.service.prefs.Preferences; //导入方法依赖的package包/类
/**
 * Clean imported preferences from obsolete keys.
 *
 * @param preferences JavaCore preferences.
 */
void cleanJavaCore(Preferences preferences) {
	try {
		String[] keys = preferences.keys();
		for (int k = 0, kl= keys.length; k<kl; k++) {
			String key = keys[k];
			if (key.startsWith(JavaModelManager.CP_CONTAINER_PREFERENCES_PREFIX) && !isJavaProjectAccessible(key)) {
				preferences.remove(key);
			}
		}
	} catch (BackingStoreException e) {
		// do nothing
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:JavaCorePreferenceModifyListener.java


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