Search in sources :

Example 36 with ProjectScope

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

the class UnicodeEscapeTest method getProject.

private IProject getProject(String encoding) throws CoreException {
    IProject project = workbenchTestHelper.getProject();
    ScopedPreferenceStore projectPreferenceStore = new ScopedPreferenceStore(new ProjectScope(project), Platform.PI_RUNTIME);
    projectPreferenceStore.setValue(Platform.PREF_LINE_SEPARATOR, "\n");
    project.setDefaultCharset(encoding, null);
    return project;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IProject(org.eclipse.core.resources.IProject) ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore)

Example 37 with ProjectScope

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

the class XtendPreferenceStoreAccess method getContextPreferenceStore.

@SuppressWarnings("all")
@Override
public IPreferenceStore getContextPreferenceStore(Object context) {
    IProject project = getProject(context);
    if (project == null)
        return getPreferenceStore();
    IPreferenceStore store = super.getContextPreferenceStore(context);
    ProjectScope projectScope = new ProjectScope(project);
    FixedScopedPreferenceStore jdtStore = new FixedScopedPreferenceStore(projectScope, JavaCore.PLUGIN_ID);
    jdtStore.setSearchContexts(new IScopeContext[] { projectScope, new InstanceScope(), new ConfigurationScope() });
    return new ChainedPreferenceStore(new IPreferenceStore[] { store, jdtStore, PreferenceConstants.getPreferenceStore() });
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) ChainedPreferenceStore(org.eclipse.ui.texteditor.ChainedPreferenceStore) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) FixedScopedPreferenceStore(org.eclipse.xtext.ui.editor.preferences.FixedScopedPreferenceStore) IProject(org.eclipse.core.resources.IProject) ConfigurationScope(org.eclipse.core.runtime.preferences.ConfigurationScope)

Example 38 with ProjectScope

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

the class XtendProjectConfigurator method writePreferences.

private void writePreferences(OutputConfiguration configuration, IProject project) {
    ProjectScope projectPreferences = new ProjectScope(project);
    IEclipsePreferences languagePreferences = projectPreferences.getNode("org.eclipse.xtend.core.Xtend");
    languagePreferences.putBoolean(OptionsConfigurationBlock.isProjectSpecificPropertyKey(BuilderConfigurationBlock.PROPERTY_PREFIX), true);
    languagePreferences.putBoolean(getKey(configuration, INSTALL_DSL_AS_PRIMARY_SOURCE), configuration.isInstallDslAsPrimarySource());
    languagePreferences.putBoolean(getKey(configuration, HIDE_LOCAL_SYNTHETIC_VARIABLES), configuration.isHideSyntheticLocalVariables());
    languagePreferences.putBoolean(getKey(configuration, USE_OUTPUT_PER_SOURCE_FOLDER), true);
    for (SourceMapping sourceMapping : configuration.getSourceMappings()) {
        languagePreferences.put(getOutputForSourceFolderKey(configuration, sourceMapping.getSourceFolder()), Strings.nullToEmpty(sourceMapping.getOutputDirectory()));
    }
    try {
        languagePreferences.flush();
    } catch (BackingStoreException e) {
        throw new RuntimeIOException(e);
    }
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) RuntimeIOException(org.eclipse.xtext.util.RuntimeIOException) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) BackingStoreException(org.osgi.service.prefs.BackingStoreException) SourceMapping(org.eclipse.xtext.generator.OutputConfiguration.SourceMapping)

Example 39 with ProjectScope

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

the class ServerUtils method getProjectNode.

public static IEclipsePreferences getProjectNode(String nodeQualifier, IProject project) {
    IScopeContext context = new ProjectScope(project);
    IEclipsePreferences node = context.getNode(nodeQualifier);
    return node;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Example 40 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)

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