Search in sources :

Example 71 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project erlide_eclipse by erlang.

the class PreferencesHelperTest method nextContexts_3.

@Test
public void nextContexts_3() {
    final IScopeContext[] list = PreferencesHelperTest.ALL_SCOPE_CONTEXTS;
    final IScopeContext item = InstanceScope.INSTANCE;
    final IScopeContext[] val = PreferencesHelper.getNextContexts(list, item);
    Assert.assertNotNull(val);
    Assert.assertEquals(2, val.length);
    Assert.assertEquals(ConfigurationScope.INSTANCE, val[0]);
    Assert.assertEquals(DefaultScope.INSTANCE, val[1]);
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Test(org.junit.Test)

Example 72 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project erlide_eclipse by erlang.

the class PreferencesHelper method getNextContexts.

public static IScopeContext[] getNextContexts(final IScopeContext[] list, final IScopeContext item) {
    final List<IScopeContext> result = new ArrayList<>();
    boolean found = false;
    for (final IScopeContext ctx : list) {
        if (found) {
            result.add(ctx);
        }
        if (ctx.equals(item)) {
            found = true;
        }
    }
    return result.toArray(new IScopeContext[result.size()]);
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) ArrayList(java.util.ArrayList)

Example 73 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project erlide_eclipse by erlang.

the class PreferencesHelper method hasAnyAtLowestScope.

public boolean hasAnyAtLowestScope() {
    final IScopeContext sc = storeContext;
    final IEclipsePreferences p = sc.getNode(qualifier);
    if (p != null) {
        try {
            final String[] keys = p.keys();
            return keys.length > 0;
        } catch (final BackingStoreException e) {
        }
    }
    return false;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException)

Example 74 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project erlide_eclipse by erlang.

the class CodeAssistPreferences method getNode.

public static IEclipsePreferences getNode() {
    final IScopeContext context = InstanceScope.INSTANCE;
    final IEclipsePreferences eclipsePreferences = context.getNode(CodeAssistPreferences.QUALIFIER);
    return eclipsePreferences;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Aggregations

IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)74 ProjectScope (org.eclipse.core.resources.ProjectScope)42 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)17 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)16 DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)15 BackingStoreException (org.osgi.service.prefs.BackingStoreException)15 Preferences (org.osgi.service.prefs.Preferences)14 IProject (org.eclipse.core.resources.IProject)13 CoreException (org.eclipse.core.runtime.CoreException)8 ArrayList (java.util.ArrayList)6 IResource (org.eclipse.core.resources.IResource)6 ILiferayProjectProvider (com.liferay.ide.core.ILiferayProjectProvider)5 Iterator (java.util.Iterator)5 HashSet (java.util.HashSet)4 List (java.util.List)4 Set (java.util.Set)4 IFile (org.eclipse.core.resources.IFile)4 IAdaptable (org.eclipse.core.runtime.IAdaptable)4 PreferencesAccess (org.eclipse.jdt.internal.ui.preferences.PreferencesAccess)4 FormatterProfileStore (org.eclipse.jdt.internal.ui.preferences.formatter.FormatterProfileStore)4