Search in sources :

Example 11 with DefaultScope

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

the class JSONCorePreferenceInitializer method initializeDefaultPreferences.

public void initializeDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope().getNode(JSONCorePlugin.getDefault().getBundle().getSymbolicName());
    // Validation preferences
    node.putBoolean(JSONCorePreferenceNames.SYNTAX_VALIDATION, false);
    node.putBoolean(JSONCorePreferenceNames.SCHEMA_VALIDATION, false);
    node.putInt(JSONCorePreferenceNames.MISSING_BRACKET, 2);
    // formatting preferences
    node.putInt(JSONCorePreferenceNames.LINE_WIDTH, 72);
    node.putBoolean(JSONCorePreferenceNames.CLEAR_ALL_BLANK_LINES, false);
    node.put(JSONCorePreferenceNames.INDENTATION_CHAR, JSONCorePreferenceNames.TAB);
    node.putInt(JSONCorePreferenceNames.INDENTATION_SIZE, 1);
    // cleanup preferences
    node.putBoolean(JSONCorePreferenceNames.QUOTE_ATTR_VALUES, true);
    node.putBoolean(JSONCorePreferenceNames.FORMAT_SOURCE, true);
    // code generation preferences
    // $NON-NLS-1$
    node.put(CommonEncodingPreferenceNames.INPUT_CODESET, "");
    // $NON-NLS-1$
    String defaultEnc = "UTF-8";
    // $NON-NLS-1$
    String systemEnc = System.getProperty("file.encoding");
    if (systemEnc != null) {
        defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, // $NON-NLS-1$
        "UTF-8");
    }
    node.put(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc);
    // $NON-NLS-1$
    node.put(CommonEncodingPreferenceNames.END_OF_LINE_CODE, "");
    // this could be made smarter by actually looking up the content
    // type's valid extensions
    // $NON-NLS-1$
    node.put(JSONCorePreferenceNames.DEFAULT_EXTENSION, "json");
    // additional css core preferences
    node.putInt(JSONCorePreferenceNames.FORMAT_PROP_PRE_DELIM, 0);
    node.putInt(JSONCorePreferenceNames.FORMAT_PROP_POST_DELIM, 1);
    // $NON-NLS-1$
    node.put(JSONCorePreferenceNames.FORMAT_QUOTE, "\"");
    // $NON-NLS-1$
    node.put(JSONCorePreferenceNames.FORMAT_BETWEEN_VALUE, " ");
    node.putBoolean(JSONCorePreferenceNames.FORMAT_SPACE_BETWEEN_SELECTORS, true);
    node.putBoolean(JSONCorePreferenceNames.FORMAT_QUOTE_IN_URI, true);
    node.putBoolean(JSONCorePreferenceNames.WRAPPING_ONE_PER_LINE, true);
    node.putBoolean(JSONCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, true);
    node.putBoolean(JSONCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE, false);
    node.putInt(JSONCorePreferenceNames.CASE_IDENTIFIER, JSONCorePreferenceNames.UPPER);
    node.putInt(JSONCorePreferenceNames.CASE_SELECTOR, JSONCorePreferenceNames.LOWER);
    node.putInt(JSONCorePreferenceNames.CASE_PROPERTY_NAME, JSONCorePreferenceNames.LOWER);
    node.putInt(JSONCorePreferenceNames.CASE_PROPERTY_VALUE, JSONCorePreferenceNames.LOWER);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 12 with DefaultScope

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

the class HTMLCorePreferencesTest method testPluginGetDefaultPreferences.

/**
 * Tests default values of preferences.
 *
 * NOTE: Expected default values are hard-coded, so if default values do
 * get changed, assertions need to be updated as well
 */
public void testPluginGetDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope().getNode(HTMLCorePlugin.getDefault().getBundle().getSymbolicName());
    pluginGetDefaultPreference(node, HTMLCorePreferenceNames.SPLIT_MULTI_ATTRS, Boolean.toString(false));
    pluginGetDefaultPreference(node, HTMLCorePreferenceNames.ATTR_NAME_CASE, Integer.toString(HTMLCorePreferenceNames.LOWER));
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 13 with DefaultScope

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

the class CSSCorePreferencesTest method testPluginGetDefaultPreferences.

/**
 * Tests default values of preferences.
 *
 * NOTE: Expected default values are hard-coded, so if default values do
 * get changed, assertions need to be updated as well
 */
public void testPluginGetDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope().getNode(CSSCorePlugin.getDefault().getBundle().getSymbolicName());
    pluginGetDefaultPreference(node, CSSCorePreferenceNames.CASE_IDENTIFIER, "1");
    pluginGetDefaultPreference(node, CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.TAB);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 14 with DefaultScope

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

the class PreferenceInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope().getNode(XSLCorePlugin.getDefault().getBundle().getSymbolicName());
    node.putInt(ValidationPreferences.MAX_ERRORS, 100);
    node.putInt(ValidationPreferences.MISSING_PARAM, IMarker.SEVERITY_WARNING);
    node.putInt(ValidationPreferences.XPATHS, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.CALL_TEMPLATES, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.EMPTY_PARAM, IMarker.SEVERITY_WARNING);
    node.putInt(ValidationPreferences.MISSING_INCLUDE, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.CIRCULAR_REF, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.TEMPLATE_CONFLICT, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.NAME_ATTRIBUTE_MISSING, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.NAME_ATTRIBUTE_EMPTY, IMarker.SEVERITY_ERROR);
    node.putInt(ValidationPreferences.DUPLICATE_PARAMETER, IMarker.SEVERITY_ERROR);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 15 with DefaultScope

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

the class XSDCorePreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope().getNode(XSDCorePlugin.getDefault().getBundle().getSymbolicName());
    // In order to provide the best compatibility and conformance to the XML Schema
    // specification it is recommended that this be defaulted to true.
    node.putBoolean(XSDCorePreferenceNames.FULL_SCHEMA_CONFORMANCE, true);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Aggregations

DefaultScope (org.eclipse.core.runtime.preferences.DefaultScope)44 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)24 ProjectScope (org.eclipse.core.resources.ProjectScope)17 InstanceScope (org.eclipse.core.runtime.preferences.InstanceScope)16 IScopeContext (org.eclipse.core.runtime.preferences.IScopeContext)15 IProject (org.eclipse.core.resources.IProject)7 IResource (org.eclipse.core.resources.IResource)6 HashSet (java.util.HashSet)4 Set (java.util.Set)4 IFile (org.eclipse.core.resources.IFile)4 IAdaptable (org.eclipse.core.runtime.IAdaptable)4 ArrayList (java.util.ArrayList)3 Iterator (java.util.Iterator)3 List (java.util.List)3 BackingStoreException (org.osgi.service.prefs.BackingStoreException)3 IOException (java.io.IOException)2 Map (java.util.Map)2 CoreException (org.eclipse.core.runtime.CoreException)2 IPreferencesService (org.eclipse.core.runtime.preferences.IPreferencesService)2 PreferenceDialog (org.eclipse.jface.preference.PreferenceDialog)2