Search in sources :

Example 46 with InstanceScope

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

the class NewJSPWizard method applyLineDelimiter.

private String applyLineDelimiter(IFile file, String text) {
    // $NON-NLS-1$
    String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] { new ProjectScope(file.getProject()), new InstanceScope() });
    String convertedText = StringUtils.replace(text, "\r\n", "\n");
    convertedText = StringUtils.replace(convertedText, "\r", "\n");
    convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter);
    return convertedText;
}
Also used : ProjectScope(org.eclipse.core.resources.ProjectScope) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope)

Example 47 with InstanceScope

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

the class JSPCorePreferencesTest method testPluginSetPreferences.

/**
 * Tests setting preference values by setting preference value to be a
 * certain value, then getting the preference value to verify it was set.
 */
public void testPluginSetPreferences() {
    IEclipsePreferences node = new InstanceScope().getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName());
    pluginSetPreferenceBoolean(node, JSPCorePreferenceNames.VALIDATE_FRAGMENTS);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope)

Example 48 with InstanceScope

use of org.eclipse.core.runtime.preferences.InstanceScope 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 49 with InstanceScope

use of org.eclipse.core.runtime.preferences.InstanceScope 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 50 with InstanceScope

use of org.eclipse.core.runtime.preferences.InstanceScope in project webtools.servertools by eclipse.

the class ProfilerPreferences method setServerProfilerId.

/**
 * Sets the profiler to use when profiling on server
 * @param profilerId the id of the server profiler
 */
public void setServerProfilerId(String profilerId) {
    Preferences node = new InstanceScope().getNode(PREF_PROFILER_QUALIFIER);
    node.put(PREF_SELECTED_PROFILER, profilerId);
    try {
        node.flush();
    } catch (BackingStoreException e) {
        if (Trace.SEVERE) {
            Trace.trace(Trace.STRING_SEVERE, "Could not save server profiler preference", e);
        }
    }
}
Also used : InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) BackingStoreException(org.osgi.service.prefs.BackingStoreException) Preferences(org.osgi.service.prefs.Preferences)

Aggregations

InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)54 ProjectScope (org.eclipse.core.resources.ProjectScope)30 DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)16 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)16 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)15 IProject (org.eclipse.core.resources.IProject)11 BackingStoreException (org.osgi.service.prefs.BackingStoreException)9 IFile (org.eclipse.core.resources.IFile)7 ConfigurationScope (org.eclipse.core.runtime.preferences.ConfigurationScope)7 IXMLMemento (com.cubrid.cubridmanager.core.common.xml.IXMLMemento)6 IResource (org.eclipse.core.resources.IResource)5 Preferences (org.osgi.service.prefs.Preferences)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 Iterator (java.util.Iterator)4 Set (java.util.Set)4 IAdaptable (org.eclipse.core.runtime.IAdaptable)4 XMLMemento (com.cubrid.cubridmanager.core.common.xml.XMLMemento)3 List (java.util.List)3