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


Java Preferences.setValue方法代码示例

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


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

示例1: setSettings

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
private void setSettings(final TFSGlobalProxySettings settings) {
    final Preferences preferences = TFSCommonUIClientPlugin.getDefault().getPluginPreferences();

    final boolean useHttpProxy = settings.isUseHTTPProxy();
    String httpProxyUrl = settings.getHTTPProxyURL();
    final boolean useHttpProxyDefaultCredentials = settings.isUseHTTPProxyDefaultCredentials();
    String httpProxyUsername = settings.getHTTPProxyUsername();
    String httpProxyPassword = settings.getHTTPProxyPassword();
    final boolean useTfProxy = settings.isUseTFProxy();
    String tfProxyUrl = settings.getTFProxyURL();

    httpProxyUrl = normalizeStringForPreferences(httpProxyUrl);
    httpProxyUsername = normalizeStringForPreferences(httpProxyUsername);
    httpProxyPassword = normalizeStringForPreferences(httpProxyPassword);
    tfProxyUrl = normalizeStringForPreferences(tfProxyUrl);

    preferences.setValue(HTTP_PROXY_ENABLED, useHttpProxy);
    preferences.setValue(HTTP_PROXY_URL, httpProxyUrl);
    preferences.setValue(HTTP_PROXY_DEFAULT_CREDENTIALS, useHttpProxyDefaultCredentials);
    preferences.setValue(HTTP_PROXY_USERNAME, httpProxyUsername);
    preferences.setValue(HTTP_PROXY_PASSWORD, httpProxyPassword);
    preferences.setValue(TFS_PROXY_ENABLED, useTfProxy);
    preferences.setValue(TFS_PROXY_URL, tfProxyUrl);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:25,代码来源:TFSGlobalProxiesPreferencePage.java

示例2: setMemento

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * Sets the memento for the specified key into the in-memory cache and the
 * Eclipse preference store.
 * <p>
 * Must hold {@link #cacheLock} while calling this method.
 *
 * @param key
 *        the key (must not be <code>null</code>)
 */
private void setMemento(final String key, final XMLMemento memento) {
    Check.notNull(key, "key"); //$NON-NLS-1$
    Check.notNull(memento, "memento"); //$NON-NLS-1$

    synchronized (cache) {
        cache.put(key, memento);
    }

    try {
        Check.notNull(memento, "memento"); //$NON-NLS-1$

        final Preferences preferences = TFSCommonClientPlugin.getDefault().getPluginPreferences();
        final String preferenceName = getPreferenceName(key);

        final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        memento.write(outputStream, PREFERENCE_CHARSET);

        preferences.setValue(preferenceName, outputStream.toString(PREFERENCE_CHARSET));
        TFSCommonClientPlugin.getDefault().savePluginPreferences();
    } catch (final Exception e) {
        log.warn("Error saving active project and team information", e); //$NON-NLS-1$
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:33,代码来源:TeamContextCache.java

示例3: getMaxRowPreference

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
private int getMaxRowPreference( )
{
	int maxRow;
	Preferences preferences = ReportPlugin.getDefault( )
			.getPluginPreferences( );
	if ( preferences.contains( DateSetPreferencePage.USER_MAXROW ) )
	{
		maxRow = preferences.getInt( DateSetPreferencePage.USER_MAXROW );
	}
	else
	{
		maxRow = DateSetPreferencePage.DEFAULT_MAX_ROW;
		preferences.setValue( DateSetPreferencePage.USER_MAXROW, maxRow );
	}
	return maxRow;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:17,代码来源:ResultSetPreviewPage.java

示例4: setValue

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
public void setValue( String name, double value )
{
	double oldValue = getDouble( name );
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		if ( preference != null )
		{
			if ( preference.isDefault( name ) || oldValue != value )
			{
				preference.setValue( name, value );
				firePreferenceChangeEvent( name,
						new Double( oldValue ),
						new Double( value ) );
			}
			return;
		}
	}
	if ( oldValue != value )
	{
		prefsStore.setValue( name, value );
		firePreferenceChangeEvent( name,
				new Double( oldValue ),
				new Double( value ) );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:27,代码来源:PreferenceWrapper.java

示例5: setBlockedTaskIds

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * Saves the supplied Task id set in the preferences system.
 */
public static void setBlockedTaskIds(Set<String> ids) {
  BlockedTaskIdsParser parser = new BlockedTaskIdsParser();

  String unparse = parser.unparse(ids);

  Preferences prefs = getPreferences();
  prefs.setValue(IMechanicPreferences.BLOCKED_PREF, unparse);
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:12,代码来源:OldMechanicPreferences.java

示例6: performOk

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
@Override
public boolean performOk() {
    final int refreshTime = getRefreshInterval();

    if (refreshTime < 1) {
        return false;
    }

    // TODO see TODO in initializeValues()

    final Preferences nonUIPrefs = TFSCommonClientPlugin.getDefault().getPluginPreferences();

    nonUIPrefs.setValue(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL, refreshTime);

    TFSCommonClientPlugin.getDefault().savePluginPreferences();

    // Back to normal UI prefs

    final IPreferenceStore uiPrefs = TFSCommonUIClientPlugin.getDefault().getPreferenceStore();

    uiPrefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS, notifyBuildSuccessButton.getSelection());
    uiPrefs.setValue(
        UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED,
        notifyBuildPartiallySucceededButton.getSelection());
    uiPrefs.setValue(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE, notifyBuildFailureButton.getSelection());

    final TFSServer currentServer =
        TFSCommonUIClientPlugin.getDefault().getProductPlugin().getServerManager().getDefaultServer();

    if (currentServer != null) {
        currentServer.getBuildStatusManager().setRefreshInterval(refreshTime);
    }

    return super.performOk();
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:36,代码来源:BuildNotificationPreferencePage.java

示例7: performOk

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * OK was clicked. Store the SVN preferences.
 *
 * @return whether it is okay to close the preference page
 */
public boolean performOk() {
	IPreferenceStore store = getPreferenceStore();
	Preferences corePreferences = SVNProviderPlugin.getPlugin().getPluginPreferences();
	store.setValue(ISVNUIConstants.PREF_FILETEXT_DECORATION, fileTextFormat.getText());
	store.setValue(ISVNUIConstants.PREF_FOLDERTEXT_DECORATION, folderTextFormat.getText());
	store.setValue(ISVNUIConstants.PREF_PROJECTTEXT_DECORATION, projectTextFormat.getText());
	
	store.setValue(ISVNUIConstants.PREF_DATEFORMAT_DECORATION, dateFormatText.getText());
	
	store.setValue(ISVNUIConstants.PREF_ADDED_FLAG, addedFlag.getText());
	store.setValue(ISVNUIConstants.PREF_DIRTY_FLAG, dirtyFlag.getText());
       store.setValue(ISVNUIConstants.PREF_EXTERNAL_FLAG, externalFlag.getText());
	
	store.setValue(ISVNUIConstants.PREF_SHOW_DIRTY_DECORATION, imageShowDirty.getSelection());
	store.setValue(ISVNUIConstants.PREF_SHOW_ADDED_DECORATION, imageShowAdded.getSelection());
	store.setValue(ISVNUIConstants.PREF_SHOW_HASREMOTE_DECORATION, imageShowHasRemote.getSelection());
	store.setValue(ISVNUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION, imageShowNewResource.getSelection());
	store.setValue(ISVNUIConstants.PREF_SHOW_EXTERNAL_DECORATION, imageShowExternal.getSelection());
	corePreferences.setValue(ISVNCoreConstants.PREF_SHOW_READ_ONLY, imageShowReadOnly.getSelection());
	
	store.setValue(ISVNUIConstants.PREF_CALCULATE_DIRTY, showDirty.getSelection());
	store.setValue(ISVNUIConstants.PREF_USE_FONT_DECORATORS, enableFontDecorators.getSelection());
       
       // Update the strategy used to calculate the dirty state
	SVNProviderPlugin.getPlugin().getPluginPreferences().setValue(ISVNCoreConstants.PREF_RECURSIVE_STATUS_UPDATE, showDirty.getSelection());
       SVNProviderPlugin.getPlugin().savePluginPreferences();
       
	SVNLightweightDecorator.refresh();

	SVNUIPlugin.getPlugin().savePluginPreferences();
	return true;
}
 
开发者ID:subclipse,项目名称:subclipse,代码行数:38,代码来源:SVNDecoratorPreferencesPage.java

示例8: writeToPrefs

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
public static void writeToPrefs( String prefName, byte[] prefData){
   try {
      Plugin pl = (Plugin) CoreContext.getContext().getObject("p");
      Preferences prefs = pl.getPluginPreferences();

      String str64 = new String(Base64.encodeBase64(prefData), "UTF8");
      prefs.setValue(prefName, str64);
      pl.savePluginPreferences();

   } catch (UnsupportedEncodingException e) {
      ExceptionHandler.handle(e);
   } catch (Exception ignore) {
      ExceptionHandler.handle(ignore);
   }
}
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:16,代码来源:BaseUtils.java

示例9: performOk

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
@Override
public boolean performOk() {
    Preferences preferences = TextUMLUIPlugin.getDefault().getPluginPreferences();
    boolean formatOnSaveSetting = formatOnSaveCheckBox.getSelection();
    preferences.setValue(TextUMLUIPlugin.FORMAT_ON_SAVE, formatOnSaveSetting);
    preferences.setValue(TextUMLUIPlugin.OPTIONS, createStoreString());
    TextUMLUIPlugin.getDefault().savePluginPreferences();
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:10,代码来源:TextUMLPreferencePage.java

示例10: setDefaultPereferencesIfNeed

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
private void setDefaultPereferencesIfNeed( )
{
	Preferences preferences = JdbcPlugin.getDefault( )
			.getPluginPreferences( );
	if ( !preferences.contains( DateSetPreferencePage.SCHEMAS_PREFETCH_CONFIG ) )
	{
		preferences.setValue( DateSetPreferencePage.SCHEMAS_PREFETCH_CONFIG,
				DateSetPreferencePage.ENABLED );
	}
	if ( !preferences.contains( DateSetPreferencePage.ENABLE_CODE_ASSIST ) )
	{
		preferences.setValue( DateSetPreferencePage.ENABLE_CODE_ASSIST,
				DateSetPreferencePage.ENABLED );
	}
	if ( !preferences.contains( DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA ) )
	{
		preferences.setValue( DateSetPreferencePage.USER_MAX_NUM_OF_SCHEMA,
				String.valueOf( DateSetPreferencePage.DEFAULT_MAX_NUM_OF_SCHEMA ) );
	}
	if ( !preferences.contains( DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA ) )
	{
		preferences.setValue( DateSetPreferencePage.USER_MAX_NUM_OF_TABLE_EACH_SCHEMA,
				String.valueOf( DateSetPreferencePage.DEFAULT_MAX_NUM_OF_TABLE_EACH_SCHEMA ) );
	}
	if ( !preferences.contains( DateSetPreferencePage.USER_TIMEOUT_LIMIT ) )
	{
		preferences.setValue( DateSetPreferencePage.USER_TIMEOUT_LIMIT,
				String.valueOf( DateSetPreferencePage.DEFAULT_TIMEOUT_LIMIT ) );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:31,代码来源:SQLDataSetEditorPage.java

示例11: setLong

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * Set the long value of a preference on the MechanicPreferences scope.
 */
public static void setLong(String key, long value) {
  Preferences prefs = getPreferences();
  prefs.setValue(key, value);
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:8,代码来源:OldMechanicPreferences.java

示例12: setString

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * Set the string value of a preference on the MechanicPreferences scope.
 */
public static void setString(String key, String value) {
  Preferences prefs = getPreferences();
  prefs.setValue(key, value);
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:8,代码来源:OldMechanicPreferences.java

示例13: doNotShowPopup

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * Disable the preference that shows the notification popup.
 */
public static void doNotShowPopup() {
  Preferences prefs = getPreferences();
  prefs.setValue(IMechanicPreferences.SHOW_POPUP_PREF, false);
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:8,代码来源:OldMechanicPreferences.java

示例14: createTemporaryCorePreferenceStore

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
private Preferences createTemporaryCorePreferenceStore() {
	Preferences result = new Preferences();
	result.setValue(Prefs.EDITOR_TASK_TAGS, "TASK,TODO"); //$NON-NLS-1$
	return result;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:6,代码来源:AppearanceConfigurationBlock.java

示例15: performOk

import org.eclipse.core.runtime.Preferences; //导入方法依赖的package包/类
/**
 * @see IPreferencePage
 */
public boolean performOk( )
{
	Preferences pref = ViewerPlugin.getDefault( ).getPluginPreferences( );

	// for ( int i = 0; i < externalBrowsers.length; i++ )
	// {
	// if ( externalBrowsers[i].getSelection( ) )
	// {
	// // set new current browser
	// String browserID = ( (BrowserDescriptor) externalBrowsers[i].getData(
	// ) ).getID( );
	// BrowserManager.getInstance( ).setCurrentBrowserID( browserID );
	// // save id in help preferences
	// pref.setValue( BrowserManager.DEFAULT_BROWSER_ID_KEY, browserID );
	// break;
	// }
	// }
	//
	// customBrowserPath.getText( );
	// pref.setValue( CustomBrowser.CUSTOM_BROWSER_PATH_KEY,
	// customBrowserPath.getText( ) );

	if ( svgFlag != null )
	{
		pref.setValue( WebViewer.SVG_FLAG, svgFlag.getSelection( ) );
	}

	if ( masterPageContent != null )
	{
		pref.setValue( WebViewer.MASTER_PAGE_CONTENT,
				masterPageContent.getSelection( ) );
	}

	if ( alwaysExternal != null )
	{
		pref.setValue( BrowserManager.ALWAYS_EXTERNAL_BROWSER_KEY,
				alwaysExternal.getSelection( ) );
		BrowserManager.getInstance( )
				.setAlwaysUseExternal( alwaysExternal.getSelection( ) );
	}

	if ( timeZoneCombo != null )
	{
		String timeZoneId = ViewerPlugin.getTimeZoneTable_disKey().get( timeZoneCombo.getText( ) );
		if ( timeZoneId == null || timeZoneId.trim( ).length( ) <= 0 )
		{
			timeZoneId = TimeZone.getDefault( ).getID( );
		}
		pref.setValue( WebViewer.USER_TIME_ZONE, timeZoneId );
	}

	if ( localeCombo != null )
	{
		if ( WebViewer.LOCALE_TABLE.containsKey( localeCombo.getText( ) ) )
		{
			pref.setValue( WebViewer.USER_LOCALE,
					WebViewer.LOCALE_TABLE.get( localeCombo.getText( ) ) );
		}
		else
			pref.setValue( WebViewer.USER_LOCALE, localeCombo.getText( ) );
	}

	if ( bidiCombo != null )
	{
		int selection = bidiCombo.getSelectionIndex( );
		selection = selection < 0 ? 0 : selection;
		pref.setValue( WebViewer.BIDI_ORIENTATION,
				BIDI_CHOICE_NAMES[selection] );
	}
	ViewerPlugin.getDefault( ).savePluginPreferences( );

	return true;
}
 
开发者ID:eclipse,项目名称:birt,代码行数:77,代码来源:PreviewPreferencePage.java


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