Search in sources :

Example 51 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project webtools.sourceediting by eclipse.

the class TaskScanningJob method isEnabledOnProject.

private boolean isEnabledOnProject(IProject p) {
    IPreferencesService preferencesService = Platform.getPreferencesService();
    IScopeContext[] lookupOrder = new IScopeContext[] { new ProjectScope(p), new InstanceScope(), new DefaultScope() };
    return preferencesService.getBoolean(TaskTagPreferenceKeys.TASK_TAG_NODE, TaskTagPreferenceKeys.TASK_TAG_ENABLE, false, lookupOrder);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) IPreferencesService(org.eclipse.core.runtime.preferences.IPreferencesService)

Example 52 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project webtools.sourceediting by eclipse.

the class SyntaxValidator method getExcludedElementNames.

private Set getExcludedElementNames(IProject project) {
    IScopeContext[] fLookupOrder = new IScopeContext[] { new InstanceScope(), new DefaultScope() };
    if (project != null) {
        ProjectScope projectScope = new ProjectScope(project);
        if (projectScope.getNode(HTMLCorePlugin.getDefault().getBundle().getSymbolicName()).getBoolean(HTMLCorePreferenceNames.USE_PROJECT_SETTINGS, false))
            fLookupOrder = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
    }
    Set result = new HashSet();
    if (fPreferenceService.getBoolean(HTMLCorePlugin.getDefault().getBundle().getSymbolicName(), HTMLCorePreferenceNames.IGNORE_ELEMENT_NAMES, HTMLCorePreferenceNames.IGNORE_ELEMENT_NAMES_DEFAULT, fLookupOrder)) {
        String ignoreList = fPreferenceService.getString(HTMLCorePlugin.getDefault().getBundle().getSymbolicName(), HTMLCorePreferenceNames.ELEMENT_NAMES_TO_IGNORE, HTMLCorePreferenceNames.ELEMENT_NAMES_TO_IGNORE_DEFAULT, fLookupOrder);
        if (ignoreList.trim().length() == 0)
            return result;
        // $NON-NLS-1$
        String[] names = ignoreList.split(",");
        for (int i = 0; names != null && i < names.length; i++) {
            String name = names[i] == null ? null : names[i].trim();
            if (name != null && name.length() > 0)
                result.add(name.toLowerCase());
        }
    }
    return result;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) HashSet(java.util.HashSet) Set(java.util.Set) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) HashSet(java.util.HashSet)

Example 53 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project liferay-ide by liferay.

the class AbstractValidationSettingsPage method storeValues.

/**
 * (non-Javadoc)
 *
 * @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractSettingsPage#
 *      storeValues()
 */
protected void storeValues() {
    if ((_fCombos == null) || (_fCombos.size() == 0)) {
        return;
    }
    Iterator it = _fCombos.iterator();
    IScopeContext[] contexts = createPreferenceScopes();
    while (it.hasNext()) {
        ComboData data = (ComboData) ((Combo) it.next()).getData();
        if (data.getKey() != null) {
            contexts[0].getNode(getPreferenceNodeQualifier()).putInt(data.getKey(), data.getSeverity());
        }
    }
    for (int i = 0; i < contexts.length; i++) {
        try {
            contexts[i].getNode(getPreferenceNodeQualifier()).flush();
        } catch (BackingStoreException bse) {
        }
    }
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Iterator(java.util.Iterator) BackingStoreException(org.osgi.service.prefs.BackingStoreException)

Example 54 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project liferay-ide by liferay.

the class ProjectProviderDefaultValueService method compute.

@Override
protected String compute() {
    String retval = "ant";
    IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
    String defaultProjectBuildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_PLUGIN_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
    if (defaultProjectBuildType == null) {
        return retval;
    }
    ILiferayProjectProvider provider = LiferayCore.getProvider(defaultProjectBuildType);
    if (provider != null) {
        retval = defaultProjectBuildType;
    }
    return retval;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider)

Example 55 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project liferay-ide by liferay.

the class FragmentProjectProviderDefaultValueService method compute.

@Override
protected String compute() {
    String retval = "gradle-module-fragment";
    final IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
    final String defaultProjectBuildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_MODULE_FRAGMENT_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
    if (defaultProjectBuildType != null) {
        final ILiferayProjectProvider provider = LiferayCore.getProvider(defaultProjectBuildType);
        if (provider != null) {
            retval = defaultProjectBuildType;
        }
    }
    return retval;
}
Also used : IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) ILiferayProjectProvider(com.liferay.ide.core.ILiferayProjectProvider)

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