Search in sources :

Example 66 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project jbosstools-hibernate by jbosstools.

the class HibernatePropertyPage method saveNamigStrategyChanges.

protected boolean saveNamigStrategyChanges() {
    if (initNamingStrategy == enableNamingStrategy.getSelection())
        return true;
    IScopeContext scope = new ProjectScope(getProject());
    Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
    if (node != null) {
        node.putBoolean(HibernatePropertiesConstants.NAMING_STRATEGY_ENABLED, enableNamingStrategy.getSelection());
        try {
            node.flush();
            return true;
        } catch (BackingStoreException e) {
            HibernateConsolePlugin.getDefault().logErrorMessage(HibernateConsoleMessages.ProjectUtils_could_not_save_changes_to_preferences, e);
        }
    }
    return false;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences)

Example 67 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project jbosstools-hibernate by jbosstools.

the class SimpleTestProjectWithMapping method setDefaultConsoleConfiguration.

public void setDefaultConsoleConfiguration(String ccName) throws BackingStoreException, CoreException {
    IScopeContext scope = new ProjectScope(getIProject());
    Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
    node.putBoolean(HibernatePropertiesConstants.HIBERNATE3_ENABLED, true);
    // $NON-NLS-1$
    node.put(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, ccName);
    node.flush();
    addHibernateNature();
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Preferences(org.osgi.service.prefs.Preferences)

Example 68 with IScopeContext

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

the class ErlangOutlinePage method getPrefsNode.

public static IEclipsePreferences getPrefsNode() {
    final String qualifier = ErlideUIPlugin.PLUGIN_ID;
    final IScopeContext context = InstanceScope.INSTANCE;
    final IEclipsePreferences eclipsePreferences = context.getNode(qualifier);
    return eclipsePreferences;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Example 69 with IScopeContext

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

the class ErlideUIPlugin method getPrefsNode.

public static IEclipsePreferences getPrefsNode() {
    final String qualifier = ErlideUIPlugin.PLUGIN_ID;
    final IScopeContext context = InstanceScope.INSTANCE;
    final IEclipsePreferences eclipsePreferences = context.getNode(qualifier);
    return eclipsePreferences;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Example 70 with IScopeContext

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

the class PreferencesHelperTest method nextContexts_2.

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

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