Search in sources :

Example 31 with IScopeContext

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

the class StubUtility method getLineDelimiterPreference.

public static String getLineDelimiterPreference(IProject project) {
    IScopeContext[] scopeContext;
    if (project != null) {
        // project preference
        scopeContext = new IScopeContext[] { new ProjectScope(project) };
        String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
        if (lineDelimiter != null)
            return lineDelimiter;
    }
    // workspace preference
    scopeContext = new IScopeContext[] { InstanceScope.INSTANCE };
    // $NON-NLS-1$ //$NON-NLS-2$
    String platformDefault = System.getProperty("line.separator", "\n");
    return Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, platformDefault, scopeContext);
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext)

Example 32 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project jop by jop-devel.

the class JOPUIUtils method setProjectSetting.

public static void setProjectSetting(ILaunchConfiguration configuration, String key, String value) {
    String projectName = getProjectName(configuration);
    if (projectName == null) {
        return;
    }
    IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    IScopeContext scopeContext = new ProjectScope(project);
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    projectPrefs.put(key, value);
}
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 33 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project jop by jop-devel.

the class JOPPropertyPage method performOk.

/* (non-Javadoc)
     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
     */
@Override
public boolean performOk() {
    IScopeContext scopeContext = new ProjectScope(getProject());
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    if (isValid()) {
        projectPrefs.put(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME, jopDirectoryEditor.getStringValue());
        projectPrefs.put(IJOPLaunchConfigurationConstants.ATTR_QUARTUS_PROJECT, quartusProjectFileEditor.getStringValue());
    }
    return super.performOk();
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) Preferences(org.osgi.service.prefs.Preferences)

Example 34 with IScopeContext

use of org.eclipse.core.runtime.preferences.IScopeContext in project jop by jop-devel.

the class JOPPropertyPage method performDefaults.

/* (non-Javadoc)
     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performDefaults()
     */
@Override
public void performDefaults() {
    super.performDefaults();
    IProject project = getProject();
    IPath projectRoot = project.getLocation();
    IScopeContext scopeContext = new ProjectScope(project);
    Preferences projectPrefs = scopeContext.getNode(IJOPUIConstants.PLUGIN_ID);
    jopDirectoryEditor.setStringValue(projectPrefs.get(IJOPLaunchConfigurationConstants.ATTR_JOP_HOME, projectRoot.toOSString()));
    IPath defaultQuartusProjectFile = projectRoot.append("quartus").append("cycmin").append("jop").addFileExtension("qpf");
    quartusProjectFileEditor.setStringValue(projectPrefs.get(IJOPLaunchConfigurationConstants.ATTR_QUARTUS_PROJECT, defaultQuartusProjectFile.toOSString()));
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IPath(org.eclipse.core.runtime.IPath) Preferences(org.osgi.service.prefs.Preferences) IProject(org.eclipse.core.resources.IProject)

Example 35 with IScopeContext

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

the class JavaProject method getEclipsePreferences.

/**
     * Returns the project custom preference pool.
     * Project preferences may include custom encoding.
     * @return IEclipsePreferences or <code>null</code> if the project
     * 	does not have a java nature.
     */
public IEclipsePreferences getEclipsePreferences() {
    if (!org.eclipse.jdt.internal.core.JavaProject.hasJavaNature(this.project))
        return null;
    // Get cached preferences if exist
    PerProjectInfo perProjectInfo = getJavaModelManager().getPerProjectInfo(this.project, true);
    if (perProjectInfo.preferences != null)
        return perProjectInfo.preferences;
    // Init project preferences
    IScopeContext context = new ProjectScope(getProject());
    final IEclipsePreferences eclipsePreferences = context.getNode(JavaCore.PLUGIN_ID);
    //        updatePreferences(eclipsePreferences);
    perProjectInfo.preferences = eclipsePreferences;
    //        eclipsePreferences.addPreferenceChangeListener(this.preferencesChangeListener);
    return eclipsePreferences;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) PerProjectInfo(org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo) IScopeContext(org.eclipse.core.runtime.preferences.IScopeContext) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences)

Aggregations

IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)73 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