Java 类org.eclipse.core.runtime.Preferences 实例源码

项目:team-explorer-everywhere    文件:TFSGlobalProxiesPreferencePage.java   
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);
}
项目:team-explorer-everywhere    文件:TFSGlobalProxiesPreferencePage.java   
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);
}
项目:team-explorer-everywhere    文件:TFSGlobalProxiesPreferencePage.java   
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);
}
项目:team-explorer-everywhere    文件:BuildStatusManager.java   
/**
 * 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;
    }
}
项目:team-explorer-everywhere    文件:TeamContextCache.java   
/**
 * 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$
    }
}
项目:velocity-edit    文件:ModelTools.java   
/**
 * 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();
}
项目:eclipse-wtp-json    文件:AbstractJSONSourceFormatter.java   
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();
}
项目:eclipse-wtp-json    文件:JSONCleanupStrategyImpl.java   
/**
     * 
     */
    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);
    }
项目:birt    文件:ResultSetPreviewPage.java   
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;
}
项目:birt    文件:PreferenceWrapper.java   
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 ) );
    }
}
项目:birt    文件:PreferenceWrapper.java   
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 ) );
    }
}
项目:birt    文件:PreferenceWrapper.java   
public void setValue( String name, float value )
{
    float oldValue = getFloat( 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 Float( oldValue ),
                        new Float( value ) );
            }
            return;
        }
    }
    if ( oldValue != value )
    {
        prefsStore.setValue( name, value );
        firePreferenceChangeEvent( name,
                new Float( oldValue ),
                new Float( value ) );
    }
}
项目:birt    文件:PreferenceWrapper.java   
public void setValue( String name, int value )
{
    int oldValue = getInt( 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,
                        Integer.valueOf( oldValue ),
                        Integer.valueOf( value ) );
            }
            return;
        }
    }
    if ( oldValue != value )
    {
        prefsStore.setValue( name, value );
        firePreferenceChangeEvent( name,
                Integer.valueOf( oldValue ),
                Integer.valueOf( value ) );
    }
}
项目:birt    文件:PreferenceWrapper.java   
public void setValue( String name, long value )
{
    long oldValue = getLong( 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,
                        Long.valueOf( oldValue ),
                        Long.valueOf( value ) );
            }
            return;
        }
    }
    if ( oldValue != value )
    {
        prefsStore.setValue( name, value );
        firePreferenceChangeEvent( name,
                Long.valueOf( oldValue ),
                Long.valueOf( value ) );
    }
}
项目:birt    文件:PreferenceWrapper.java   
public void setValue( String name, String value )
{
    String oldValue = getString( name );
    if ( this.preferenceType == SPECIAL_TYPE && project != null )
    {
        Preferences preference = prefs.getReportPreference( project );
        if ( preference != null )
        {
            if ( preference.isDefault( name ) || !oldValue.equals( value ) )
            {
                preference.setValue( name, value );
                firePreferenceChangeEvent( name, oldValue, value );
            }
            return;
        }
    }
    if ( !oldValue.equals( value ) )
    {
        prefsStore.setValue( name, value );
        firePreferenceChangeEvent( name, oldValue, value );
    }
}
项目:birt    文件:PreferenceWrapper.java   
public void setValue( String name, boolean value )
{
    boolean oldValue = getBoolean( 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,
                        Boolean.valueOf( oldValue ),
                        Boolean.valueOf( value ) );
            }
            return;
        }
    }
    if ( oldValue != value )
    {
        prefsStore.setValue( name, value );
        firePreferenceChangeEvent( name,
                Boolean.valueOf( oldValue ),
                Boolean.valueOf( value ) );
    }
}
项目:workspacemechanic    文件:OldMechanicPreferences.java   
/**
 * 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);
}
项目:team-explorer-everywhere    文件:ProxyServiceHTTPClientFactory.java   
@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);
}
项目:team-explorer-everywhere    文件:LegacyHTTPClientFactory.java   
@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);
}
项目:team-explorer-everywhere    文件:LegacyHTTPClientFactory.java   
@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);
}
项目:team-explorer-everywhere    文件:EclipseTFProxyServerSettingsFactory.java   
/**
 * {@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;
}
项目:team-explorer-everywhere    文件:BuildNotificationPreferencePage.java   
@Override
protected void performDefaults() {
    // TODO see TODO in initializeValues()

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

    final int refreshIntervalMillis = nonUIPrefs.getDefaultInt(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL);

    int refreshIntervalMins = 0;
    if (refreshIntervalMillis > 0) {
        refreshIntervalMins = refreshIntervalMillis / (60 * 1000);
    }
    if (refreshIntervalMins == 0) {
        refreshIntervalMins = 5;
    }

    refreshTimeText.setText(Integer.toString(refreshIntervalMins));

    // Back to normal UI prefs

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

    notifyBuildSuccessButton.setSelection(
        uiPrefs.getDefaultBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_SUCCESS));
    notifyBuildPartiallySucceededButton.setSelection(
        uiPrefs.getDefaultBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_PARTIALLY_SUCCEEDED));
    notifyBuildFailureButton.setSelection(
        uiPrefs.getDefaultBoolean(UIPreferenceConstants.BUILD_NOTIFICATION_FAILURE));

    super.performDefaults();
}
项目:team-explorer-everywhere    文件:BuildNotificationPreferencePage.java   
@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();
}
项目:team-explorer-everywhere    文件:PreferenceInitializer.java   
@Override
public void initializeDefaultPreferences() {
    // TODO use a non-deprecated API for preferences at the non-UI client
    // layer

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

    prefs.setDefault(PreferenceConstants.BUILD_STATUS_REFRESH_INTERVAL, 60000);
}
项目:team-explorer-everywhere    文件:TeamContextCache.java   
/**
 * Gets the memento for the specified key, trying the in-memory cache first,
 * then trying the Eclipse preference store. If no saved memento was found,
 * a new {@link XMLMemento} is returned.
 *
 * @param key
 *        the key (must not be <code>null</code>)
 * @return the {@link XMLMemento}, never <code>null</code>
 */
private XMLMemento getMemento(final String key) {
    Check.notNull(key, "key"); //$NON-NLS-1$

    synchronized (cache) {
        XMLMemento memento = cache.get(key);

        if (memento == null) {
            try {
                final Preferences preferences = TFSCommonClientPlugin.getDefault().getPluginPreferences();
                final String preferenceName = getPreferenceName(key);

                final String mementoString = preferences.getString(preferenceName);

                if (mementoString != null && mementoString.length() > 0) {
                    memento = XMLMemento.read(
                        new ByteArrayInputStream(mementoString.getBytes(PREFERENCE_CHARSET)),
                        PREFERENCE_CHARSET);
                } else {
                    memento = new XMLMemento(MEMENTO_ROOT_KEY);
                }
            } catch (final Exception e) {
                log.warn("Error loading active project and team information", e); //$NON-NLS-1$
                memento = new XMLMemento(MEMENTO_ROOT_KEY);
            }

            cache.put(key, memento);
        }

        return memento;
    }
}
项目:subclipse    文件:PreferenceInitializer.java   
public void initializeDefaultPreferences() {
      Preferences preferences = SVNProviderPlugin.getPlugin().getPluginPreferences();
preferences.setDefault(ISVNCoreConstants.PREF_RECURSIVE_STATUS_UPDATE, true);
      preferences.setDefault(ISVNCoreConstants.PREF_SHOW_OUT_OF_DATE_FOLDERS, false);
      preferences.setDefault(ISVNCoreConstants.PREF_SHARE_NESTED_PROJECTS, true);
      preferences.setDefault(ISVNCoreConstants.PREF_IGNORE_MANAGED_DERIVED_RESOURCES, false);
      preferences.setDefault(ISVNCoreConstants.PREF_SHOW_READ_ONLY, false);
  }
项目:subclipse    文件:SVNDecoratorPreferencesPage.java   
/**
 * 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;
}
项目:subclipse    文件:SVNDecoratorPreferencesPage.java   
/**
 * Defaults was clicked. Restore the SVN preferences to
 * their default values
 */
protected void performDefaults() {
    super.performDefaults();
    IPreferenceStore store = getPreferenceStore();
    Preferences corePreferences = SVNProviderPlugin.getPlugin().getPluginPreferences();

    fileTextFormat.setText(store.getDefaultString(ISVNUIConstants.PREF_FILETEXT_DECORATION));
    folderTextFormat.setText(store.getDefaultString(ISVNUIConstants.PREF_FOLDERTEXT_DECORATION));
    projectTextFormat.setText(store.getDefaultString(ISVNUIConstants.PREF_PROJECTTEXT_DECORATION));

    dateFormatText.setText(""); //$NON-NLS-1$

    addedFlag.setText(store.getDefaultString(ISVNUIConstants.PREF_ADDED_FLAG));
    dirtyFlag.setText(store.getDefaultString(ISVNUIConstants.PREF_DIRTY_FLAG));
       externalFlag.setText(store.getDefaultString(ISVNUIConstants.PREF_EXTERNAL_FLAG));

    imageShowDirty.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_DIRTY_DECORATION));
    imageShowAdded.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_ADDED_DECORATION));
    imageShowHasRemote.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
    imageShowNewResource.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
    imageShowExternal.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_EXTERNAL_DECORATION));
    imageShowReadOnly.setSelection(false);

    showDirty.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_CALCULATE_DIRTY));
    enableFontDecorators.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_USE_FONT_DECORATORS));

    setValid(true);
   }
项目:http4e    文件:BaseUtils.java   
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);
   }
}
项目:http4e    文件:BaseUtils.java   
public static byte[] readFromPrefs( String prefName){
   try {
      Plugin pl = (Plugin) CoreContext.getContext().getObject("p");
      Preferences prefs = pl.getPluginPreferences();
      String str64 = prefs.getString(prefName);
      byte[] data = Base64.decodeBase64(str64.getBytes("UTF8"));
      return data;

   } catch (UnsupportedEncodingException e) {
      ExceptionHandler.handle(e);
   } catch (Exception ignore) {
      ExceptionHandler.handle(ignore);
   }
   return null;
}
项目:agui_eclipse_plugin    文件:BuildFatJar.java   
private static String getRelPropertiesFilename(IJavaProject jproject) {
    Preferences prefs = AguiPlugin.getDefault().getPluginPreferences();
    String result = prefs.getString(FatJarPreferencePage.P_CONFIGFILE);
    if (Strings.isNullOrEmpty(result)) {
        return result = getProjectName(jproject) + "-agui.properties";
    }
    return result.replaceAll("[<]project[>]", getProjectName(jproject));
}
项目:agui_eclipse_plugin    文件:FatJarPreferenceInitializer.java   
public void initializeDefaultPreferences() {
    Preferences prefs = AguiPlugin.getDefault().getPluginPreferences();
    prefs.setDefault(FatJarPreferencePage.P_CONFIGFILE, ".fatjar");
    prefs.setDefault(FatJarPreferencePage.P_JARNAME, "<project>_fat.jar");
       prefs.setDefault(FatJarPreferencePage.P_MERGEMANIFEST, true);
       prefs.setDefault(FatJarPreferencePage.P_REMOVESIGNERS, true);
    prefs.setDefault(FatJarPreferencePage.P_SCMAUTOCHECKOUT, true);
    prefs.setDefault(FatJarPreferencePage.P_ESCAPEUPPERCASE, false);
}
项目:eclipse-wtp-json    文件:JSONPairFormatter.java   
/**
 * 
 */
protected void formatBefore(IJSONNode node, IJSONNode child,
        IRegion region, String toAppend, StringBuilder source) {
    IJSONCleanupStrategy stgy = getCleanupStrategy(node);

    IJSONModel cssModel = node.getOwnerDocument().getModel();
    // BUG202615 - it is possible to have a style declaration
    // with no model associated with it
    if (cssModel != null) {
        IStructuredDocument structuredDocument = cssModel
                .getStructuredDocument();
        if (structuredDocument != null) {
            CompoundRegion[] regions = getRegionsWithoutWhiteSpaces(
                    structuredDocument, region, stgy);
            CompoundRegion[] outside = getOutsideRegions(
                    structuredDocument, region);

            for (int i = 0; i < regions.length; i++) {
                if (i != 0 || needS(outside[0]))
                    appendSpaceBefore(node, regions[i], source);
                source.append(decoratedRegion(regions[i], 0, stgy)); // must
                                                                        // be
                                                                        // comments
            }
            Preferences preferences = JSONCorePlugin.getDefault()
                    .getPluginPreferences();
            if (needS(outside[1])) {
                if (((IndexedRegion) child).getStartOffset() == region
                        .getOffset() + region.getLength()
                        && preferences
                                .getBoolean(JSONCorePreferenceNames.WRAPPING_ONE_PER_LINE)
                        && (node.getOwnerDocument() != node || !preferences
                                .getBoolean(JSONCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR))) {
                    appendDelimBefore(node, null, source);
                } else
                    appendSpaceBefore(node, toAppend, source);
            }
        }
    }
}
项目:eclipse-wtp-json    文件:AbstractJSONSourceFormatter.java   
/**
     * 
     */
    protected String decoratedIdentRegion(CompoundRegion region,
            IJSONCleanupStrategy stgy) {
        if (isFormat())
            return region.getText();

        String text = null;
        if (!stgy.isFormatSource())
            text = region.getFullText();
        else
            text = region.getText();

//      if (region.getType() == JSONRegionContexts.WHITE_SPACETRING
//              || region.getType() == JSONRegionContexts.JSON_URI)
//          return decoratedRegion(region, 0, stgy);

        if (isCleanup()) {
            if (stgy.getIdentCase() == IJSONCleanupStrategy.ASIS
                    /*|| region.getType() == JSONRegionContexts.JSON_COMMENT*/)
                return text;
            else if (stgy.getIdentCase() == IJSONCleanupStrategy.UPPER)
                return text.toUpperCase();
            else
                return text.toLowerCase();
        }

        Preferences preferences = JSONCorePlugin.getDefault()
                .getPluginPreferences();
//      if (region.getType() == JSONRegionContexts.JSON_COMMENT)
//          return text;
//      else if (preferences.getInt(JSONCorePreferenceNames.CASE_IDENTIFIER) == JSONCorePreferenceNames.UPPER)
//          return text.toUpperCase();
//      else
            return text.toLowerCase();
    }
项目:eclipse-wtp-json    文件:AbstractJSONSourceFormatter.java   
/**
     * 
     */
    protected String decoratedPropNameRegion(CompoundRegion region,
            IJSONCleanupStrategy stgy) {
        if (isFormat())
            return region.getText();

        String text = null;
        if (!stgy.isFormatSource())
            text = region.getFullText();
        else
            text = region.getText();

//      if (region.getType() == JSONRegionContexts.WHITE_SPACETRING
//              || region.getType() == JSONRegionContexts.JSON_URI)
//          return decoratedRegion(region, 1, stgy);
        if (isCleanup()) {
            /*if (stgy.getPropNameCase() == JSONCleanupStrategy.ASIS
                    || region.getType() != JSONRegionContexts.JSON_DECLARATION_PROPERTY)
                return text;
            else*/ 
                if (stgy.getPropNameCase() == IJSONCleanupStrategy.UPPER)
                return text.toUpperCase();
            else
                return text.toLowerCase();
        }
        Preferences preferences = JSONCorePlugin.getDefault()
                .getPluginPreferences();

//      if (region.getType() != JSONRegionContexts.JSON_DECLARATION_PROPERTY)
//          return text;
        //else 
            if (preferences.getInt(JSONCorePreferenceNames.CASE_PROPERTY_NAME) == JSONCorePreferenceNames.UPPER)
            return text.toUpperCase();
        else
            return text.toLowerCase();
    }
项目:eclipse-wtp-json    文件:DefaultJSONSourceFormatter.java   
/**
     * 
     */
    protected void appendSpaceBetween(IJSONNode node, CompoundRegion prev, CompoundRegion next, StringBuilder source) {
        if (isCleanup() && !getCleanupStrategy(node).isFormatSource())
            return; // for not formatting case on cleanup action
        final Preferences preferences = JSONCorePlugin.getDefault().getPluginPreferences();
        // in selector
        String prevType = prev.getType();
        String nextType = next.getType();

//      if (prevType == JSONRegionContexts.JSON_PAGE || prevType == JSONRegionContexts.JSON_CHARSET || prevType == JSONRegionContexts.JSON_ATKEYWORD || prevType == JSONRegionContexts.JSON_FONT_FACE || prevType == JSONRegionContexts.JSON_IMPORT || prevType == JSONRegionContexts.JSON_MEDIA) {
//          appendSpaceBefore(node, next, source);
//          return;
//      }

//      if (prevType == JSONRegionContexts.JSON_UNKNOWN && nextType != JSONRegionContexts.JSON_COMMENT) {
//          if (prev.getEndOffset() != next.getStartOffset()) { // not
//                                                              // sequential
//              appendSpaceBefore(node, next, source);
//          }
//          return;
//      }
//
//      if (prevType == JSONRegionContexts.JSON_DECLARATION_VALUE_OPERATOR || prevType == JSONRegionContexts.JSON_COMMENT || nextType == JSONRegionContexts.JSON_COMMENT || nextType == JSONRegionContexts.JSON_LBRACE || nextType == JSONRegionContexts.JSON_UNKNOWN || (prevType == JSONRegionContexts.JSON_SELECTOR_SEPARATOR && preferences.getBoolean(JSONCorePreferenceNames.FORMAT_SPACE_BETWEEN_SELECTORS))) {
//          appendSpaceBefore(node, next, source);
//          return;
//      }
    }
项目:APICloud-Studio    文件:SVNDecoratorPreferencesPage.java   
/**
 * 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;
}
项目:APICloud-Studio    文件:SVNDecoratorPreferencesPage.java   
/**
 * Defaults was clicked. Restore the SVN preferences to
 * their default values
 */
protected void performDefaults() {
    super.performDefaults();
    IPreferenceStore store = getPreferenceStore();
    Preferences corePreferences = SVNProviderPlugin.getPlugin().getPluginPreferences();

    fileTextFormat.setText(store.getDefaultString(ISVNUIConstants.PREF_FILETEXT_DECORATION));
    folderTextFormat.setText(store.getDefaultString(ISVNUIConstants.PREF_FOLDERTEXT_DECORATION));
    projectTextFormat.setText(store.getDefaultString(ISVNUIConstants.PREF_PROJECTTEXT_DECORATION));

    dateFormatText.setText(""); //$NON-NLS-1$

    addedFlag.setText(store.getDefaultString(ISVNUIConstants.PREF_ADDED_FLAG));
    dirtyFlag.setText(store.getDefaultString(ISVNUIConstants.PREF_DIRTY_FLAG));
       externalFlag.setText(store.getDefaultString(ISVNUIConstants.PREF_EXTERNAL_FLAG));

    imageShowDirty.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_DIRTY_DECORATION));
    imageShowAdded.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_ADDED_DECORATION));
    imageShowHasRemote.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_HASREMOTE_DECORATION));
    imageShowNewResource.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_NEWRESOURCE_DECORATION));
    imageShowExternal.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_SHOW_EXTERNAL_DECORATION));
    imageShowReadOnly.setSelection(false);

    showDirty.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_CALCULATE_DIRTY));
    enableFontDecorators.setSelection(store.getDefaultBoolean(ISVNUIConstants.PREF_USE_FONT_DECORATORS));

    setValid(true);
   }
项目:APICloud-Studio    文件:PreferenceInitializer.java   
public void initializeDefaultPreferences() {
      Preferences preferences = SVNProviderPlugin.getPlugin().getPluginPreferences();
preferences.setDefault(ISVNCoreConstants.PREF_RECURSIVE_STATUS_UPDATE, true);
      preferences.setDefault(ISVNCoreConstants.PREF_SHOW_OUT_OF_DATE_FOLDERS, false);
      preferences.setDefault(ISVNCoreConstants.PREF_SHARE_NESTED_PROJECTS, true);
      preferences.setDefault(ISVNCoreConstants.PREF_IGNORE_MANAGED_DERIVED_RESOURCES, false);
      preferences.setDefault(ISVNCoreConstants.PREF_SHOW_READ_ONLY, false);
  }
项目:mytourbook    文件:MsgEditorPreferences.java   
/**
 * Notified when the value of the filter locales preferences changes.
 *
 * @param event the property change event object describing which
 *    property changed and how
 */
public void propertyChange(Preferences.PropertyChangeEvent event) {
    if (FILTER_LOCALES_STRING_MATCHERS.equals(event.getProperty())) {
        onLocalFilterChange();
    } else if (ADD_MSG_EDITOR_BUILDER_TO_JAVA_PROJECTS.equals(event.getProperty())) {
        onAddValidationBuilderChange();
    }
}