Search in sources :

Example 31 with ProjectScope

use of org.eclipse.core.resources.ProjectScope in project erlide_eclipse by erlang.

the class InternalProjectConfigurationTest method outputPathShouldFollowPropertyChange.

@Test
public void outputPathShouldFollowPropertyChange() throws BackingStoreException {
    final String expected = "hello/world";
    final IProject wproject = project.getWorkspaceProject();
    final IEclipsePreferences node = new ProjectScope(wproject).getNode("org.erlide.core");
    node.put(ProjectPreferencesConstants.OUTPUT_DIR, expected);
    node.flush();
    final ErlangProjectProperties pp = project.getProperties();
    final String actual = pp.getOutputDir().toPortableString();
    assertThat(actual).isEqualTo(expected);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) ErlangProjectProperties(org.erlide.engine.model.root.ErlangProjectProperties) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 32 with ProjectScope

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

the class ContentAssistTest method testEnableHibernateNature.

@Test
public void testEnableHibernateNature() throws BackingStoreException, CoreException {
    IJavaProject prj = hcth.getProject().getIJavaProject();
    IScopeContext scope = new ProjectScope(prj.getProject());
    Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
    node.putBoolean(HibernatePropertiesConstants.HIBERNATE3_ENABLED, true);
    // $NON-NLS-1$
    node.put(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, "testcfg");
    node.flush();
    ProjectUtils.addProjectNature(prj.getProject(), HibernatePropertiesConstants.HIBERNATE_NATURE, new NullProgressMonitor());
    ProjectUtils.removeProjectNature(prj.getProject(), HibernatePropertiesConstants.HIBERNATE_NATURE, new NullProgressMonitor());
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IJavaProject(org.eclipse.jdt.core.IJavaProject) Preferences(org.osgi.service.prefs.Preferences) Test(org.junit.Test)

Example 33 with ProjectScope

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

the class HibernateNature method getDefaultConsoleConfigurationName.

public String getDefaultConsoleConfigurationName() {
    IJavaProject prj = JavaCore.create(project);
    IScopeContext scope = new ProjectScope(prj.getProject());
    Preferences node = scope.getNode(HibernatePropertiesConstants.HIBERNATE_CONSOLE_NODE);
    if (node != null) {
        String cfg = node.get(HibernatePropertiesConstants.DEFAULT_CONFIGURATION, prj.getProject().getName());
        return cfg;
    } else {
        return null;
    }
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IJavaProject(org.eclipse.jdt.core.IJavaProject) Preferences(org.osgi.service.prefs.Preferences)

Example 34 with ProjectScope

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

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

the class LineSeparatorConversionTest method testSeparator.

private void testSeparator(String separator) throws Exception {
    IProject project = workbenchTestHelper.getProject();
    ScopedPreferenceStore projectPreferenceStore = new ScopedPreferenceStore(new ProjectScope(project), Platform.PI_RUNTIME);
    projectPreferenceStore.setValue(Platform.PREF_LINE_SEPARATOR, separator);
    workbenchTestHelper.createFile("Foo.xtend", "class Foo {}");
    waitForBuild();
    IFile compiledFile = project.getFile("xtend-gen/Foo.java");
    workbenchTestHelper.getFiles().add(compiledFile);
    String contents = WorkbenchTestHelper.getContentsAsString(compiledFile);
    List<String> expectedLines = ImmutableList.of("@SuppressWarnings(\"all\")", "public class Foo {", "}", "");
    String expectedContent = Joiner.on(separator).join(expectedLines);
    assertEquals(expectedContent, contents);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IFile(org.eclipse.core.resources.IFile) IProject(org.eclipse.core.resources.IProject) ScopedPreferenceStore(org.eclipse.ui.preferences.ScopedPreferenceStore)

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