Search in sources :

Example 81 with ProjectScope

use of org.eclipse.core.resources.ProjectScope 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 82 with ProjectScope

use of org.eclipse.core.resources.ProjectScope in project xtext-eclipse by eclipse.

the class JavaProjectSetupUtil method setUnixLineEndings.

public static void setUnixLineEndings(IProject project) {
    IEclipsePreferences prefs = new ProjectScope(project).getNode(Platform.PI_RUNTIME);
    prefs.put(Platform.PREF_LINE_SEPARATOR, "\n");
    try {
        prefs.flush();
    } catch (BackingStoreException e) {
        throw new RuntimeException(e);
    }
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException)

Example 83 with ProjectScope

use of org.eclipse.core.resources.ProjectScope in project xtext-eclipse by eclipse.

the class BinFolderConfigurator method compileToBin.

/**
 * Read a setting from the project scope (higher prio) or the instance scope (lower prio) to decide if Eclipse should use its own output
 * dir or compile to the maven standard output directories.
 *
 * Defaults to {@code false}.
 */
private boolean compileToBin(IProject project) {
    String pluginId = "org.eclipse.xtext.m2e";
    String key = "compileToBin";
    ProjectScope projectScope = new ProjectScope(project);
    IEclipsePreferences projectPreferences = projectScope.getNode(pluginId);
    String value = projectPreferences.get(key, null);
    if (value != null) {
        return "true".equals(value);
    }
    IEclipsePreferences instancePreferences = InstanceScope.INSTANCE.getNode(pluginId);
    return "true".equals(instancePreferences.get(key, "false"));
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Example 84 with ProjectScope

use of org.eclipse.core.resources.ProjectScope in project jop by jop-devel.

the class JOPUIUtils method getProjectSetting.

public static String getProjectSetting(ILaunchConfiguration configuration, String key, String def) {
    String projectName = getProjectName(configuration);
    if (projectName == null) {
        return def;
    }
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    IScopeContext scopeContext = new ProjectScope(project);
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    return projectPrefs.get(key, def);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Preferences(org.osgi.service.prefs.Preferences) IProject(org.eclipse.core.resources.IProject)

Example 85 with ProjectScope

use of org.eclipse.core.resources.ProjectScope in project jbosstools-hibernate by jbosstools.

the class ProjectDefaultConfigurationChange method perform.

/* (non-Javadoc)
	 * @see org.eclipse.ltk.core.refactoring.Change#perform(org.eclipse.core.runtime.IProgressMonitor)
	 */
@Override
public Change perform(IProgressMonitor pm) throws CoreException {
    try {
        IScopeContext scope = new ProjectScope(project);
        Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
        String oldName = node.get(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, null);
        node.putBoolean(HibernatePropertiesConstants.HIBERNATE3_ENABLED, true);
        node.put(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, newConsoleName);
        node.flush();
        return new ProjectDefaultConfigurationChange(project, oldName);
    } catch (BackingStoreException e) {
        HibernateConsolePlugin.openError(new Shell(), Messages.ProjectDefaultConfigurationChange_error_title, e.getLocalizedMessage(), e, HibernateConsolePlugin.PERFORM_SYNC_EXEC);
        return new NullChange();
    }
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Shell(org.eclipse.swt.widgets.Shell) NullChange(org.eclipse.ltk.core.refactoring.NullChange) BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences)

Aggregations

ProjectScope (org.eclipse.core.resources.ProjectScope)92 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)42 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)31 IProject (org.eclipse.core.resources.IProject)28 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)24 Preferences (org.osgi.service.prefs.Preferences)18 DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)17 BackingStoreException (org.osgi.service.prefs.BackingStoreException)17 ScopedPreferenceStore (org.eclipse.ui.preferences.ScopedPreferenceStore)11 IFile (org.eclipse.core.resources.IFile)9 IResource (org.eclipse.core.resources.IResource)9 CoreException (org.eclipse.core.runtime.CoreException)8 IAdaptable (org.eclipse.core.runtime.IAdaptable)5 IPath (org.eclipse.core.runtime.IPath)5 HashSet (java.util.HashSet)4 Set (java.util.Set)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 Path (org.eclipse.core.runtime.Path)4 Test (org.junit.Test)4 File (java.io.File)3