本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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$
}
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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 ) );
}
}
示例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 ) );
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}