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


Java Preferences类代码示例

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


Preferences类属于org.eclipse.core.runtime包,在下文中一共展示了Preferences类的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: getCurrentSettings

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

    final boolean useHttpProxy = preferences.getBoolean(HTTP_PROXY_ENABLED);
    final String httpProxyUrl = preferences.getString(HTTP_PROXY_URL);
    final boolean useHttpProxyDefaultCredentials = preferences.getBoolean(HTTP_PROXY_DEFAULT_CREDENTIALS);
    final String httpProxyUsername = preferences.getString(HTTP_PROXY_USERNAME);
    final String httpProxyDomain = preferences.getString(HTTP_PROXY_DOMAIN);
    final String httpProxyPassword = preferences.getString(HTTP_PROXY_PASSWORD);
    final boolean useTfProxy = preferences.getBoolean(TFS_PROXY_ENABLED);
    final String tfProxyUrl = preferences.getString(TFS_PROXY_URL);

    return new TFSGlobalProxySettings(
        useHttpProxy,
        httpProxyUrl,
        useHttpProxyDefaultCredentials,
        httpProxyUsername,
        httpProxyDomain,
        httpProxyPassword,
        useTfProxy,
        tfProxyUrl);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:TFSGlobalProxiesPreferencePage.java

示例3: getDefaultSettings

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

    final boolean useHttpProxy = preferences.getDefaultBoolean(HTTP_PROXY_ENABLED);
    final String httpProxyUrl = preferences.getDefaultString(HTTP_PROXY_URL);
    final boolean useHttpProxyDefaultCredentials = preferences.getDefaultBoolean(HTTP_PROXY_DEFAULT_CREDENTIALS);
    final String httpProxyUsername = preferences.getDefaultString(HTTP_PROXY_USERNAME);
    final String httpProxyDomain = preferences.getDefaultString(HTTP_PROXY_DOMAIN);
    final String httpProxyPassword = preferences.getDefaultString(HTTP_PROXY_PASSWORD);
    final boolean useTfProxy = preferences.getDefaultBoolean(TFS_PROXY_ENABLED);
    final String tfProxyUrl = preferences.getDefaultString(TFS_PROXY_URL);

    return new TFSGlobalProxySettings(
        useHttpProxy,
        httpProxyUrl,
        useHttpProxyDefaultCredentials,
        httpProxyUsername,
        httpProxyDomain,
        httpProxyPassword,
        useTfProxy,
        tfProxyUrl);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:23,代码来源:TFSGlobalProxiesPreferencePage.java

示例4: loadConfiguration

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
/**
 * Sets fields from saved preferences.
 */
private void loadConfiguration() {
    /*
     * TODO Use a non-deprecated preference interface for this non-UI
     * plug-in. When Eclipse deprecated Preferences and
     * getPluginPreferences(), it put the modern equivalent only in
     * AbstractUIPlugin (which this plug-in isn't). We need to write our own
     * adapter or other preference layer and use that instead.
     */

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

    int refreshIntervalMillis = prefs.getInt(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL);

    if (refreshIntervalMillis <= 0) {
        refreshIntervalMillis = prefs.getDefaultInt(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL);
    }

    if (refreshIntervalMillis > 0) {
        refreshInterval = refreshIntervalMillis;
    }
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:25,代码来源:BuildStatusManager.java

示例5: 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

示例6: getVariables

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
/**
 * DOCUMENT ME!
 * 
 * @param aLine
 *            DOCUMENT ME!
 * 
 * @return DOCUMENT ME!
 */
public List getVariables(int aLine)
{
    ITreeNode node = fEditor.getLastRootNode();
    if (node != null)
    {
        TreeNodeVariableVisitor visitor = new TreeNodeVariableVisitor(aLine);
        node.accept(visitor);
        List variables = visitor.getVariables();
        if (isLineWithinLoop(fEditor.getCursorLine()))
        {
            Preferences prefs = VelocityPlugin.getDefault().getPluginPreferences();
            String countName = "$" + prefs.getString(IPreferencesConstants.VELOCITY_COUNTER_NAME);
            variables.add(countName);
        }
        return variables;
    }
    return new ArrayList();
}
 
开发者ID:ninneko,项目名称:velocity-edit,代码行数:27,代码来源:ModelTools.java

示例7: getIndentString

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
private String getIndentString() {
	StringBuilder indent = new StringBuilder();

	Preferences preferences = JSONCorePlugin.getDefault()
			.getPluginPreferences();
	if (preferences != null) {
		char indentChar = ' ';
		String indentCharPref = preferences
				.getString(JSONCorePreferenceNames.INDENTATION_CHAR);
		if (JSONCorePreferenceNames.TAB.equals(indentCharPref)) {
			indentChar = '\t';
		}
		int indentationWidth = preferences
				.getInt(JSONCorePreferenceNames.INDENTATION_SIZE);

		for (int i = 0; i < indentationWidth; i++) {
			indent.append(indentChar);
		}
	}
	return indent.toString();
}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:AbstractJSONSourceFormatter.java

示例8: initialize

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
/**
	 * 
	 */
	private void initialize() {
		Preferences prefs = JSONCorePlugin.getDefault().getPluginPreferences();
//		fIdentCase = getCleanupCaseValue(prefs
//				.getInt(JSONCorePreferenceNames.CLEANUP_CASE_IDENTIFIER));
//		fPropNameCase = getCleanupCaseValue(prefs
//				.getInt(JSONCorePreferenceNames.CLEANUP_CASE_PROPERTY_NAME));
//		fPropValueCase = getCleanupCaseValue(prefs
//				.getInt(JSONCorePreferenceNames.CLEANUP_CASE_PROPERTY_VALUE));
//		fSelectorTagCase = getCleanupCaseValue(prefs
//				.getInt(JSONCorePreferenceNames.CLEANUP_CASE_SELECTOR));
//		fIdCase = getCleanupCaseValue(prefs
//				.getInt(JSONCorePreferenceNames.CLEANUP_CASE_ID_SELECTOR));
//		fClassCase = getCleanupCaseValue(prefs
//				.getInt(JSONCorePreferenceNames.CLEANUP_CASE_CLASS_SELECTOR));
		fQuoteValues = prefs
				.getBoolean(JSONCorePreferenceNames.QUOTE_ATTR_VALUES);
		fFormatSource = prefs.getBoolean(JSONCorePreferenceNames.FORMAT_SOURCE);
	}
 
开发者ID:angelozerr,项目名称:eclipse-wtp-json,代码行数:22,代码来源:JSONCleanupStrategyImpl.java

示例9: 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

示例10: setToDefault

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
public void setToDefault( String name )
{
	if ( this.preferenceType == SPECIAL_TYPE && project != null )
	{
		Preferences preference = prefs.getReportPreference( project );
		preference.setToDefault( name );
		firePreferenceChangeEvent( PreferenceChangeEvent.SPECIALTODEFAULT,
				null,
				null );
	}
	else
	{
		String oldValue = prefsStore.getString( name );
		prefsStore.setToDefault( name );
		firePreferenceChangeEvent( name,
				oldValue,
				prefsStore.getDefaultString( name ) );
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:20,代码来源:PreferenceWrapper.java

示例11: 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

示例12: 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

示例13: shouldAcceptUntrustedCertificates

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
@Override
protected boolean shouldAcceptUntrustedCertificates(final ConnectionInstanceData connectionInstanceData) {
    final Preferences preferences = TFSCommonUIClientPlugin.getDefault().getPluginPreferences();

    if (preferences.getBoolean(UIPreferenceConstants.ACCEPT_UNTRUSTED_CERTIFICATES)) {
        return true;
    }

    // Let the base class test for environment variables, sysprops, etc.
    return super.shouldAcceptUntrustedCertificates(connectionInstanceData);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:12,代码来源:ProxyServiceHTTPClientFactory.java

示例14: configureClientProxy

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
@Override
public void configureClientProxy(
    final HttpClient httpClient,
    final HostConfiguration hostConfiguration,
    final HttpState httpState,
    final ConnectionInstanceData connectionInstanceData) {
    final Preferences preferences = TFSCommonUIClientPlugin.getDefault().getPluginPreferences();

    final IPropertyChangeListener preferenceChangeListener = new PreferenceChangeListener(httpClient);
    preferences.addPropertyChangeListener(preferenceChangeListener);
    httpClient.getParams().setParameter(PREFERENCE_CHANGE_LISTENER_KEY, preferenceChangeListener);

    configureProxy(httpClient);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:15,代码来源:LegacyHTTPClientFactory.java

示例15: newProxyServerSettings

import org.eclipse.core.runtime.Preferences; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * <p>
 * The object returned is reconfigured with new values when Eclipse
 * preferences change.
 */
@Override
public TFProxyServerSettings newProxyServerSettings() {
    final DefaultTFProxyServerSettings proxyServerSettings = new DefaultTFProxyServerSettings(null);

    final Preferences preferences = TFSCommonUIClientPlugin.getDefault().getPluginPreferences();

    final IPropertyChangeListener preferenceChangeListener = new PreferenceChangeListener(proxyServerSettings);
    preferences.addPropertyChangeListener(preferenceChangeListener);
    listeners.put(proxyServerSettings, preferenceChangeListener);

    configureProxySettings(proxyServerSettings);

    return proxyServerSettings;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:21,代码来源:EclipseTFProxyServerSettingsFactory.java


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