Example usage for org.eclipse.jface.preference IPreferenceStore STRING_DEFAULT_DEFAULT

List of usage examples for org.eclipse.jface.preference IPreferenceStore STRING_DEFAULT_DEFAULT

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore STRING_DEFAULT_DEFAULT.

Prototype

String STRING_DEFAULT_DEFAULT

To view the source code for org.eclipse.jface.preference IPreferenceStore STRING_DEFAULT_DEFAULT.

Click Source Link

Document

The default-default value for String preferences ("").

Usage

From source file:org.eclipse.xtext.ui.preferences.EclipsePreferencesProvider.java

License:Open Source License

@Override
public IPreferenceValues getPreferenceValues(Resource context) {
    final IProject project = getProject(context);
    final IPreferenceStore store = project != null ? access.getContextPreferenceStore(project)
            : access.getPreferenceStore();

    final Map<String, String> preferenceCache = Maps.newHashMap();

    return new IPreferenceValues() {
        @Override//ww  w .ja  va  2 s  .  c o m
        public String getPreference(PreferenceKey key) {
            try {
                String id = key.getId();
                String string = preferenceCache.get(id);
                if (string == null) {
                    string = store.getString(id);
                    preferenceCache.put(id, string);
                }
                return org.eclipse.jface.preference.IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(string)
                        ? key.getDefaultValue()
                        : string;
            } catch (Exception e) {
                log.error("Error getting preference for key '" + key.getId() + "'.", e);
                return key.getDefaultValue();
            }
        }
    };
}

From source file:org.fedoraproject.eclipse.packager.git.Activator.java

License:Open Source License

/**
 * @param prefKey/*from w  w  w  .j a v a  2 s.  c o m*/
 * @return The set preference for the given key or {@code null} if not set.
 */
public static String getStringPreference(String prefKey) {
    IPreferenceStore store = getDefault().getPreferenceStore();
    String candidate = store.getString(prefKey);
    if (candidate.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT)) {
        return null;
    }
    return candidate;
}

From source file:org.fedoraproject.eclipse.packager.PackagerPlugin.java

License:Open Source License

/**
 * Get a String preference related to this plug-in.
 * /*www. ja v  a  2  s  .  co m*/
 * @param prefrenceIdentifier
 *            The identifier of the preference to retrieve.
 * @return The value of the prefrence in question, or {@code null} if not
 *         set.
 */
public static String getStringPreference(final String prefrenceIdentifier) {
    IPreferenceStore store = getDefault().getPreferenceStore();
    String candidate = store.getString(prefrenceIdentifier);
    if (candidate.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT)) {
        return null;
    }
    return candidate;
}

From source file:org.hawk.service.api.dt.prefs.ServerStore.java

License:Open Source License

public List<Server> readAllServers() {
    final String sValue = prefStore.getString(MONDO_SERVERS_PREFERENCE);

    final ArrayList<Server> servers = new ArrayList<>();
    if (!IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(sValue)) {
        String[] urls = sValue.split(URL_SEPARATOR);
        for (String url : urls) {
            servers.add(new Server(url));
        }/*from  w w w.j  av a  2  s  .  com*/
    }

    return servers;
}

From source file:org.objectstyle.wolips.preferences.Preferences.java

License:Open Source License

/**
 * Method getString.//from w  w w  .j  a v a  2s. com
 * 
 * @param key
 * @return String
 */
public static synchronized String getString(String key) {
    IPreferenceStore store = getPreferenceStore();
    String returnValue = store.getString(key);
    if (returnValue.equals(IPreferenceStore.STRING_DEFAULT_DEFAULT)) {
        Preferences.setDefaults();
        Preferences.SET_DEFAULTS_STRING = key;
        returnValue = store.getString(key);
    }
    return returnValue;
}

From source file:org.xmind.ui.internal.sharing.SharedLibrariesViewer.java

License:Open Source License

private boolean showConnectButton(Object category) {
    IPreferenceStore prefStore = LocalNetworkSharingUI.getDefault().getPreferenceStore();
    String arrangeMode = prefStore.getString(SharingConstants.PREF_ARRANGE_MODE);
    if (SharingConstants.ARRANGE_MODE_PEOPLE.equals(arrangeMode)
            || IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(arrangeMode)) {
        if (category instanceof ISharedLibrary) {
            ISharedLibrary library = (ISharedLibrary) category;
            if (library.isLocal())
                return false;

            String contactID = library.getContactID();
            if (contactID == null || "".equals(contactID)) //$NON-NLS-1$
                return false;

            IContactManager contactManager = LocalNetworkSharing.getDefault().getSharingService()
                    .getContactManager();

            if (!contactManager.isContact(contactID))
                return true;
        }// w  w  w .  j a va 2s . c om
    }
    return false;
}

From source file:org.xmind.ui.internal.sharing.SharedLibrariesViewer.java

License:Open Source License

private boolean isPreviousVersion(Object category) {
    IPreferenceStore prefStore = LocalNetworkSharingUI.getDefault().getPreferenceStore();
    String arrangeMode = prefStore.getString(SharingConstants.PREF_ARRANGE_MODE);
    if (SharingConstants.ARRANGE_MODE_PEOPLE.equals(arrangeMode)
            || IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(arrangeMode)) {
        if (category instanceof ISharedLibrary) {
            ISharedLibrary library = (ISharedLibrary) category;
            if (library.isLocal())
                return false;

            String contactId = library.getContactID();
            if (contactId == null)
                return true;
        }/*w ww .j a  va  2  s. c om*/
    }
    return false;
}

From source file:org.xmind.ui.internal.sharing.SharedMapLabelProvider.java

License:Open Source License

@Override
public String getText(Object element) {
    if (element instanceof ISharedMap)
        return ((ISharedMap) element).getResourceName();
    if (element instanceof ISharedLibrary) {
        ISharedLibrary library = (ISharedLibrary) element;
        int mapCount = library.getMapCount();
        String name = library.getName();
        if (library.isLocal())
            return getLibraryTitle(mapCount, name);

        String arrangeMode = LocalNetworkSharingUI.getDefault().getPreferenceStore()
                .getString(SharingConstants.PREF_ARRANGE_MODE);

        if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(arrangeMode)
                || arrangeMode.equals(SharingConstants.ARRANGE_MODE_PEOPLE)) {
            String contactID = library.getContactID();
            if (contactID == null || "".equals(contactID)) { //$NON-NLS-1$
                return getLibraryTitle(mapCount, name);
            }/*from   www . jav a 2 s .  co m*/

            if (!LocalNetworkSharing.getDefault().getSharingService().getContactManager()
                    .isContact(contactID)) {
                return name;
            }
        }
        return getLibraryTitle(mapCount, name);
    }
    return super.getText(element);
}

From source file:org.xmind.ui.internal.sharing.SharedMapsContentProvider.java

License:Open Source License

private Object[] getCategories(ISharingService sharingService) {
    IPreferenceStore prefStore = LocalNetworkSharingUI.getDefault().getPreferenceStore();
    String arrangeMode = prefStore.getString(SharingConstants.PREF_ARRANGE_MODE);

    List<Object> categories = new ArrayList<Object>();
    ILocalSharedLibrary localLibrary = sharingService.getLocalLibrary();

    if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(arrangeMode)
            || SharingConstants.ARRANGE_MODE_PEOPLE.equals(arrangeMode)) {
        localLibrary.sortMaps(AbstractSharedMap.MAP_COMPARATOR);
        categories.add(localLibrary);/*from w w  w. j a va  2  s .  c  om*/
        categories.addAll(sharingService.getRemoteLibraries());
        Collections.sort(categories, LIBRARY_COMPARATOR);
    } else {
        RemoteSharedLibrary bigLibrary = new RemoteSharedLibrary(null,
                SharingMessages.SharedMapsContentProvider_remoteLibraryName);
        List<ISharedMap> maps = new ArrayList<ISharedMap>();
        for (IRemoteSharedLibrary remote : sharingService.getRemoteLibraries()) {
            if (!sharingService.getContactManager().isContact(remote.getContactID()))
                continue;

            for (ISharedMap map : remote.getMaps()) {
                maps.add(map);
            }
        }
        bigLibrary.addMaps(maps);
        if (SharingConstants.ARRANGE_MODE_NAME.equals(arrangeMode)) {
            localLibrary.sortMaps(AbstractSharedMap.MAP_COMPARATOR);
        } else if (SharingConstants.ARRANGE_MODE_TIME.equals(arrangeMode)) {
            localLibrary.sortMaps(AbstractSharedMap.MAP_COMPARATOR_BY_MODIFIED_TIME);
            bigLibrary.sortMaps(AbstractSharedMap.MAP_COMPARATOR_BY_MODIFIED_TIME);
        }
        categories.add(localLibrary);
        categories.add(bigLibrary);
    }
    return categories.toArray();
}