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


Java IEclipsePreferences.put方法代码示例

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


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

示例1: save

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public IStatus save() {
	try {
		final IEclipsePreferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
		for (final Entry<Binary, URI> entry : getOrCreateState().entrySet()) {
			final URI path = entry.getValue();
			if (null != path) {
				final File file = new File(path);
				if (file.isDirectory()) {
					node.put(entry.getKey().getId(), file.getAbsolutePath());
				}
			} else {
				// Set to default.
				node.put(entry.getKey().getId(), "");
			}
		}
		node.flush();
		return OK_STATUS;
	} catch (final BackingStoreException e) {
		final String message = "Unexpected error when trying to persist binary preferences.";
		LOGGER.error(message, e);
		return statusHelper.createError(message, e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:OsgiBinariesPreferenceStore.java

示例2: save

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public void save() throws BackingStoreException {
	// Save Themes in the
	// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
	String json = PreferenceHelper.toJsonThemes(
			Arrays.stream(getThemes()).filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
	IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(TMUIPlugin.PLUGIN_ID);
	prefs.put(PreferenceConstants.THEMES, json);

	// Save Theme associations in the
	// "${workspace_loc}/metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.tm4e.ui.prefs"
	json = PreferenceHelper.toJsonThemeAssociations(Arrays.stream(getAllThemeAssociations())
			.filter(t -> t.getPluginId() == null).collect(Collectors.toList()));
	prefs.put(PreferenceConstants.THEME_ASSOCIATIONS, json);

	// Save preferences
	prefs.flush();
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:19,代码来源:ThemeManager.java

示例3: testCompositeReconcilerReconciles

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public void testCompositeReconcilerReconciles() throws Exception {

    IEclipsePreferences root = mock(IEclipsePreferences.class);
    IEclipsePreferences wee = mock(IEclipsePreferences.class);

    when(root.node(WEE.getPath()))
        .thenReturn(wee);

    // should return an incorrect value
    when(wee.get(WEE.getKey(), null))
        .thenReturn(HAA.getValue());

    // It's a weird idiom, but we have to call this method before the
    // replay so that easy-mock will be aware of the fact that we will
    // be calling it after the replay. Else we get an exception.
    wee.put(WEE.getKey(), WEE.getValue());

    // needs reconciliation
    Reconciler reconciler = new CompositeReconciler(root, HAA,
        new EqualsMatcher(WEE), new SimpleResolver(WEE));

    assertFalse(reconciler.isReconciled());
    reconciler.reconcile(); // causes wee.put to be called.

    verify(wee).flush();
  }
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:27,代码来源:PreferenceReconcilerTaskTest.java

示例4: testProjectSavedInPreferencesSelected

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Test
public void testProjectSavedInPreferencesSelected()
    throws ProjectRepositoryException, InterruptedException, BackingStoreException {
  IEclipsePreferences node =
      new ProjectScope(project).getNode(DeployPreferences.PREFERENCE_STORE_QUALIFIER);
  try {
    node.put("project.id", "projectId1");
    node.put("account.email", EMAIL_1);
    model = new DeployPreferences(project);

    initializeProjectRepository();
    when(loginService.getAccounts()).thenReturn(twoAccountSet);
    deployPanel = createPanel(true /* requireValues */);
    deployPanel.latestGcpProjectQueryJob.join();

    ProjectSelector projectSelector = getProjectSelector();
    IStructuredSelection selection = projectSelector.getViewer().getStructuredSelection();
    assertThat(selection.size(), is(1));
    assertThat(((GcpProject) selection.getFirstElement()).getId(), is("projectId1"));
  } finally {
    node.clear();
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:AppEngineDeployPreferencesPanelTest.java

示例5: storeRootFilename

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
    * Stores root file name in project preferences
    * @param project
    * @param rootFilename
    */
public static void storeRootFilename(IProject project, String rootFilename) {
	// If this condition does not hold, the subsequent code but also
	// AddModuleHandler will not work. The claim is that spec files are
	// always in the parent folder of the IProject.
	final IPath path = new Path(rootFilename);
	Assert.isTrue(ResourceHelper.isProjectParent(path.removeLastSegments(1), project),
			project.getLocation().toOSString() + " is *not* a subdirectory of " + rootFilename
					+ ". This is commonly caused by a symlink contained in the latter path.");
	// Store the filename *without* any path information, but prepend the
	// magical PARENT-1-PROJECT-LOC. It indicates that the file can be found
	// *one* level up (hence the "1") from the project location.
	// readProjectRootFile can later easily deduce the relative location of
	// the file.
	rootFilename = ResourceHelper.PARENT_ONE_PROJECT_LOC + path.lastSegment();
       IEclipsePreferences projectPrefs = getProjectPreferences(project);
       projectPrefs.put(IPreferenceConstants.P_PROJECT_ROOT_FILE, rootFilename);
       storePreferences(projectPrefs);        
   }
 
开发者ID:tlaplus,项目名称:tlaplus,代码行数:24,代码来源:PreferenceStoreHelper.java

示例6: performOk

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
/**
   * @see org.eclipse.jface.preference.IPreferencePage#performOk()
   */
  public boolean performOk() {
      IEclipsePreferences prefs = MsgEditorPreferences.getEclipsePreferenceStore();
      prefs.put(MsgEditorPreferences.GROUP__LEVEL_SEPARATOR, keyGroupSeparator.getText());
      prefs.put(MsgEditorPreferences.FILTER_LOCALES_STRING_MATCHERS,filterLocales.getText());
      prefs.putBoolean(MsgEditorPreferences.UNICODE_UNESCAPE_ENABLED, convertEncodedToUnicode.getSelection());
      prefs.putBoolean(MsgEditorPreferences.NL_SUPPORT_ENABLED,supportNL.getSelection());
      prefs.putBoolean(MsgEditorPreferences.ADD_MSG_EDITOR_BUILDER_TO_JAVA_PROJECTS, setupRbeNatureAutomatically.getSelection());
      prefs.putBoolean(MsgEditorPreferences.KEY_TREE_HIERARCHICAL, keyTreeHierarchical.getSelection());
      prefs.putBoolean(MsgEditorPreferences.KEY_TREE_EXPANDED,  keyTreeExpanded.getSelection());
      prefs.putBoolean(MsgEditorPreferences.FIELD_TAB_INSERTS, fieldTabInserts.getSelection());
      try {
	prefs.flush();
} catch (BackingStoreException e) {
	e.printStackTrace();
}
      refreshEnabledStatuses();
      return super.performOk();
  }
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:GeneralPrefPage.java

示例7: setPreferenceShellPath

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void setPreferenceShellPath(IPath path)
{
	IEclipsePreferences prefs = EclipseUtil.instanceScope().getNode(CorePlugin.PLUGIN_ID);
	if (path != null)
	{
		prefs.put(ICorePreferenceConstants.PREF_SHELL_EXECUTABLE_PATH, path.toOSString());
	}
	else
	{
		prefs.remove(ICorePreferenceConstants.PREF_SHELL_EXECUTABLE_PATH);
	}
	try
	{
		prefs.flush();
	}
	catch (BackingStoreException e)
	{
		IdeLog.logError(CorePlugin.getDefault(), "Saving preferences failed.", e); //$NON-NLS-1$
	}
	shellPath = null;
	shellEnvironment = null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:23,代码来源:ShellExecutable.java

示例8: setLocalModuleToCloudModuleMapping

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
private void setLocalModuleToCloudModuleMapping(Map<String, String> list) {
	String string = convertMapToString(list);
	IEclipsePreferences node = new InstanceScope().getNode(CloudFoundryPlugin.PLUGIN_ID);
	CloudFoundryPlugin.trace("Updated mapping: " + string); //$NON-NLS-1$
	node.put(KEY_MODULE_MAPPING_LIST + ":" + getServerId(), string); //$NON-NLS-1$
	try {
		node.flush();
	}
	catch (BackingStoreException e) {
		CloudFoundryPlugin
				.getDefault()
				.getLog()
				.log(new Status(IStatus.ERROR, CloudFoundryPlugin.PLUGIN_ID,
						"Failed to update application mappings", e)); //$NON-NLS-1$
	}
}
 
开发者ID:eclipse,项目名称:cft,代码行数:17,代码来源:ModuleCache.java

示例9: initializeDefaultPreferences

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences prefs = EclipseUtil.defaultScope().getNode(CSSPlugin.PLUGIN_ID);

	// prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.LINK_OUTLINE_WITH_EDITOR, true);
	prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_AUTO_INDENT, true);
	prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_ENABLE_FOLDING, true);
	prefs.put(
			com.aptana.editor.common.contentassist.IPreferenceConstants.COMPLETION_PROPOSAL_ACTIVATION_CHARACTERS,
			".#:"); //$NON-NLS-1$
	prefs.put(
			com.aptana.editor.common.contentassist.IPreferenceConstants.CONTEXT_INFORMATION_ACTIVATION_CHARACTERS,
			"(,"); //$NON-NLS-1$
	prefs.put(com.aptana.editor.common.contentassist.IPreferenceConstants.PROPOSAL_TRIGGER_CHARACTERS,
			StringUtil.EMPTY);

	// mark occurrences
	// prefs.putBoolean(com.aptana.editor.common.preferences.IPreferenceConstants.EDITOR_MARK_OCCURRENCES, true);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:PreferenceInitializer.java

示例10: setSemanticToken

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
protected void setSemanticToken(IEclipsePreferences prefs, Theme theme, String ourTokenType, String jdtToken,
		boolean revertToDefaults)
{
	String prefix = "semanticHighlighting."; //$NON-NLS-1$
	jdtToken = prefix + jdtToken;
	if (revertToDefaults)
	{
		prefs.remove(jdtToken + ".color"); //$NON-NLS-1$
		prefs.remove(jdtToken + ".bold"); //$NON-NLS-1$
		prefs.remove(jdtToken + ".italic"); //$NON-NLS-1$
		prefs.remove(jdtToken + ".underline"); //$NON-NLS-1$
		prefs.remove(jdtToken + ".strikethrough"); //$NON-NLS-1$
		prefs.remove(jdtToken + ".enabled"); //$NON-NLS-1$
	}
	else
	{
		TextAttribute attr = theme.getTextAttribute(ourTokenType);
		prefs.put(jdtToken + ".color", StringConverter.asString(attr.getForeground().getRGB())); //$NON-NLS-1$
		prefs.putBoolean(jdtToken + ".bold", (attr.getStyle() & SWT.BOLD) != 0); //$NON-NLS-1$
		prefs.putBoolean(jdtToken + ".italic", (attr.getStyle() & SWT.ITALIC) != 0); //$NON-NLS-1$
		prefs.putBoolean(jdtToken + ".underline", (attr.getStyle() & TextAttribute.UNDERLINE) != 0); //$NON-NLS-1$
		prefs.putBoolean(jdtToken + ".strikethrough", (attr.getStyle() & TextAttribute.STRIKETHROUGH) != 0); //$NON-NLS-1$
		prefs.putBoolean(jdtToken + ".enabled", true); //$NON-NLS-1$
	}
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:26,代码来源:InvasiveThemeHijacker.java

示例11: doSave

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
protected IStatus doSave(final ExternalLibraryPreferenceModel modelToSave) {
	final IEclipsePreferences node = InstanceScope.INSTANCE.getNode(QUALIFIER);
	node.put(CONFIGURATION_KEY, modelToSave.toJsonString());
	try {
		node.flush();
		return OK_STATUS;
	} catch (final BackingStoreException e) {
		final String message = "Unexpected error when trying to persist external library preferences.";
		LOGGER.error(message, e);
		return statusHelper.createError(message, e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:14,代码来源:OsgiExternalLibraryPreferenceStore.java

示例12: initializeDefaultPreferences

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
@Override
public void initializeDefaultPreferences() {
	IEclipsePreferences node = DefaultScope.INSTANCE.getNode("com.twinsoft.convertigo.studio");
	node.put(ConvertigoPlugin.PREFERENCE_LOG_LEVEL, "3");
	node.put(ConvertigoPlugin.PREFERENCE_OPENED_CONSOLES, "");
	node.put(ConvertigoPlugin.PREFERENCE_TRACEPLAYER_PORT, "2323");
	node.put(ConvertigoPlugin.PREFERENCE_TREE_HIGHLIGHT_DETECTED, "true");
	node.put(ConvertigoPlugin.PREFERENCE_IGNORE_NEWS, "false");
	node.put(ConvertigoPlugin.PREFERENCE_LOCAL_BUILD_FOLDER, SWT.getPlatform().startsWith("win") ? "C:\\TMP\\C8O_build" : "/tmp/C8O_build");
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:11,代码来源:ConvertigoPluginPreferenceInitializer.java

示例13: saveSettings

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public EclipsePreferencesSerializer<T> saveSettings(final T settings) {
	IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(prefereneceId);
	Gson gson = new Gson();
	preferences.put(preferenceKey, gson.toJson(settings));
	try {
		preferences.flush();
	} catch (BackingStoreException e) {
		throw new RuntimeException(e);
	}
	return this;
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:12,代码来源:EclipsePreferencesSerializer.java

示例14: saveLastDb

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void saveLastDb(DbInfo lastDb, IProject project) {
    IEclipsePreferences prefs = PgDbProject.getPrefs(project);
    if (prefs != null) {
        prefs.put(PROJ_PREF.LAST_DB_STORE, lastDb.toString());
        try {
            prefs.flush();
        } catch (BackingStoreException ex) {
            Log.log(ex);
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:12,代码来源:ProjectEditorDiffer.java

示例15: saveLastDb

import org.eclipse.core.runtime.preferences.IEclipsePreferences; //导入方法依赖的package包/类
public static void saveLastDb(DbInfo lastDb, IEditorInput inputForProject) {
    IResource res = ResourceUtil.getResource(inputForProject);
    if (res != null) {
        IEclipsePreferences prefs = PgDbProject.getPrefs(res.getProject());
        if (prefs != null) {
            prefs.put(PROJ_PREF.LAST_DB_STORE_EDITOR, lastDb.toString());
            try {
                prefs.flush();
            } catch (BackingStoreException ex) {
                Log.log(ex);
            }
        }
    }
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:15,代码来源:SQLEditor.java


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