Search in sources :

Example 76 with Preferences

use of org.osgi.service.prefs.Preferences in project webtools.sourceediting by eclipse.

the class XPathProcessorHandler method toggleState.

protected void toggleState(String xpathState) {
    Preferences osgiPrefs = XPathCoreHelper.getPreferences();
    if (xpathState.equals("xpath10")) {
        osgiPrefs.putBoolean(XPathProcessorPreferences.XPATH_1_0_PROCESSOR, true);
        osgiPrefs.putBoolean(XPathProcessorPreferences.XPATH_2_0_PROCESSOR, false);
    } else if (xpathState.equals("xpath2")) {
        osgiPrefs.putBoolean(XPathProcessorPreferences.XPATH_1_0_PROCESSOR, false);
        osgiPrefs.putBoolean(XPathProcessorPreferences.XPATH_2_0_PROCESSOR, true);
    }
    try {
        osgiPrefs.flush();
    } catch (BackingStoreException ex) {
        XPathUIPlugin.log(ex);
    }
}
Also used : BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences) XPathProcessorPreferences(org.eclipse.wst.xml.xpath.core.XPathProcessorPreferences)

Example 77 with Preferences

use of org.osgi.service.prefs.Preferences in project webtools.sourceediting by eclipse.

the class ContentBasedPreferenceGateway method getPreferencesString.

public static String getPreferencesString(IContentType contentType, String key) {
    Preferences preferences = getPreferences(contentType);
    String value = preferences.get(key, getDefaultPreferences(contentType).get(key, null));
    return value;
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) Preferences(org.osgi.service.prefs.Preferences)

Example 78 with Preferences

use of org.osgi.service.prefs.Preferences in project webtools.sourceediting by eclipse.

the class ContentBasedPreferenceGateway method getPreferencesString.

public static String getPreferencesString(String contentTypeId, String key) {
    Preferences preferences = getPreferences(contentTypeId);
    String value = preferences.get(key, getDefaultPreferences(contentTypeId).get(key, null));
    return value;
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) Preferences(org.osgi.service.prefs.Preferences)

Example 79 with Preferences

use of org.osgi.service.prefs.Preferences in project webtools.sourceediting by eclipse.

the class TestPreferences method testContentBasedPrefXML.

public void testContentBasedPrefXML() {
    IContentType contentType = Platform.getContentTypeManager().findContentTypeFor("test.xml");
    Preferences preferences = ContentBasedPreferenceGateway.getPreferences(contentType);
    assertNotNull(preferences);
}
Also used : IContentType(org.eclipse.core.runtime.content.IContentType) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) Preferences(org.osgi.service.prefs.Preferences)

Example 80 with Preferences

use of org.osgi.service.prefs.Preferences in project webtools.sourceediting by eclipse.

the class TestPreferences method displayPreferenceTree.

private void displayPreferenceTree() {
    IEclipsePreferences eclipsePreferences = Platform.getPreferencesService().getRootNode();
    try {
        String[] children = eclipsePreferences.childrenNames();
        System.out.println(eclipsePreferences.absolutePath());
        printChildren(children);
        for (int i = 0; i < children.length; i++) {
            String string = children[i];
            Preferences preferences = eclipsePreferences.node(string);
            printChildren(preferences);
        }
    } catch (BackingStoreException e) {
        e.printStackTrace();
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) Preferences(org.osgi.service.prefs.Preferences)

Aggregations

Preferences (org.osgi.service.prefs.Preferences)157 BackingStoreException (org.osgi.service.prefs.BackingStoreException)82 EclipsePreferences (org.eclipse.core.internal.preferences.EclipsePreferences)41 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)37 ProjectScope (org.eclipse.core.resources.ProjectScope)18 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)14 IStatus (org.eclipse.core.runtime.IStatus)10 IOException (java.io.IOException)7 Test (org.junit.Test)7 IProject (org.eclipse.core.resources.IProject)6 Status (org.eclipse.core.runtime.Status)6 PerformanceTestRunner (org.eclipse.core.tests.harness.PerformanceTestRunner)6 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)5 ISecurePreferences (org.eclipse.equinox.security.storage.ISecurePreferences)5 Field (java.lang.reflect.Field)4 ArrayList (java.util.ArrayList)4 ExportedPreferences (org.eclipse.core.internal.preferences.ExportedPreferences)4 IExportedPreferences (org.eclipse.core.runtime.preferences.IExportedPreferences)4 ContentTypeEncodingPreferences (org.eclipse.wst.sse.core.internal.encoding.ContentTypeEncodingPreferences)4 IEncodedDocument (org.eclipse.wst.sse.core.internal.provisional.document.IEncodedDocument)4