Search in sources :

Example 16 with DefaultScope

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

the class XMLCorePreferenceInitializer method initializeDefaultPreferences.

/*
	 * (non-Javadoc)
	 * 
	 * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
	 */
public void initializeDefaultPreferences() {
    IEclipsePreferences node = new DefaultScope().getNode(XMLCorePlugin.getDefault().getBundle().getSymbolicName());
    // formatting preferences
    node.putInt(XMLCorePreferenceNames.LINE_WIDTH, 72);
    node.putBoolean(XMLCorePreferenceNames.CLEAR_ALL_BLANK_LINES, false);
    node.put(XMLCorePreferenceNames.INDENTATION_CHAR, XMLCorePreferenceNames.TAB);
    node.putInt(XMLCorePreferenceNames.INDENTATION_SIZE, 1);
    node.putBoolean(XMLCorePreferenceNames.SPLIT_MULTI_ATTRS, false);
    node.putBoolean(XMLCorePreferenceNames.ALIGN_END_BRACKET, false);
    node.putBoolean(XMLCorePreferenceNames.PRESERVE_CDATACONTENT, false);
    node.putBoolean(XMLCorePreferenceNames.SPACE_BEFORE_EMPTY_CLOSE_TAG, true);
    node.putBoolean(XMLCorePreferenceNames.FORMAT_COMMENT_TEXT, true);
    node.putBoolean(XMLCorePreferenceNames.FORMAT_COMMENT_JOIN_LINES, true);
    // cleanup preferences
    node.putBoolean(XMLCorePreferenceNames.COMPRESS_EMPTY_ELEMENT_TAGS, true);
    node.putBoolean(XMLCorePreferenceNames.INSERT_REQUIRED_ATTRS, true);
    node.putBoolean(XMLCorePreferenceNames.INSERT_MISSING_TAGS, true);
    node.putBoolean(XMLCorePreferenceNames.QUOTE_ATTR_VALUES, true);
    node.putBoolean(XMLCorePreferenceNames.FORMAT_SOURCE, true);
    node.putBoolean(XMLCorePreferenceNames.CONVERT_EOL_CODES, false);
    node.putBoolean(XMLCorePreferenceNames.FIX_XML_DECLARATION, true);
    // $NON-NLS-1$
    node.put(CommonEncodingPreferenceNames.INPUT_CODESET, "");
    // $NON-NLS-1$
    node.put(CommonEncodingPreferenceNames.OUTPUT_CODESET, "UTF-8");
    // $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(XMLCorePreferenceNames.DEFAULT_EXTENSION, "xml");
    node.putBoolean(XMLCorePreferenceNames.WARN_NO_GRAMMAR, true);
    // 1 = IMarker.SEVERITY_WARNING
    node.putInt(XMLCorePreferenceNames.INDICATE_NO_GRAMMAR, 1);
    node.putInt(XMLCorePreferenceNames.INDICATE_REFERENCED_FILE_CONTAINS_ERRORS, 2);
    // ignore
    node.putInt(XMLCorePreferenceNames.INDICATE_NO_DOCUMENT_ELEMENT, -1);
    node.putBoolean(XMLCorePreferenceNames.USE_XINCLUDE, false);
    node.putBoolean(XMLCorePreferenceNames.HONOUR_ALL_SCHEMA_LOCATIONS, true);
    node.putBoolean(XMLCorePreferenceNames.CMDOCUMENT_GLOBAL_CACHE_ENABLED, true);
    node.putBoolean(XMLCorePreferenceNames.RESOLVE_EXTERNAL_ENTITIES, Boolean.valueOf(System.getProperty("xmlvalidation.resolve-external-entities")).booleanValue());
    node.putBoolean(XMLCorePreferenceNames.MARKUP_VALIDATION, false);
    node.putInt(XMLCorePreferenceNames.ATTRIBUTE_HAS_NO_VALUE, 2);
    node.putInt(XMLCorePreferenceNames.END_TAG_WITH_ATTRIBUTES, 2);
    node.putInt(XMLCorePreferenceNames.MISSING_START_TAG, 2);
    node.putInt(XMLCorePreferenceNames.MISSING_END_TAG, 2);
    node.putInt(XMLCorePreferenceNames.MISSING_TAG_NAME, 2);
    node.putInt(XMLCorePreferenceNames.MISSING_QUOTES, 2);
    node.putInt(XMLCorePreferenceNames.MISSING_CLOSING_BRACKET, 2);
    node.putInt(XMLCorePreferenceNames.MISSING_CLOSING_QUOTE, 2);
    node.putInt(XMLCorePreferenceNames.NAMESPACE_IN_PI_TARGET, 2);
    node.putInt(XMLCorePreferenceNames.WHITESPACE_AT_START, 2);
    node.putInt(XMLCorePreferenceNames.WHITESPACE_BEFORE_TAGNAME, 2);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 17 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(JAXPLaunchingPlugin.PLUGIN_ID);
    ProcessorPreferences prefs = new ProcessorPreferences();
    prefs.setDefaultProcessorId(JAXPRuntime.JRE_DEFAULT_PROCESSOR_ID);
    OutputPropertyPreferences outputPrefs = new OutputPropertyPreferences();
    outputPrefs.setOutputPropertyValues(JAXPRuntime.JRE_DEFAULT_PROCESSOR_TYPE_ID, JAXPRuntime.createDefaultOutputProperties(JAXPRuntime.JRE_DEFAULT_PROCESSOR_TYPE_ID));
    outputPrefs.setOutputPropertyValues(JAXPLaunchConfigurationConstants.XALAN_TYPE_ID, JAXPRuntime.createDefaultOutputProperties(JAXPLaunchConfigurationConstants.XALAN_TYPE_ID));
    outputPrefs.setOutputPropertyValues(JAXPLaunchConfigurationConstants.SAXON_TYPE_ID, JAXPRuntime.createDefaultOutputProperties(JAXPLaunchConfigurationConstants.SAXON_TYPE_ID));
    outputPrefs.setOutputPropertyValues(JAXPLaunchConfigurationConstants.SAXON_1_0_TYPE_ID, JAXPRuntime.createDefaultOutputProperties(JAXPLaunchConfigurationConstants.SAXON_1_0_TYPE_ID));
    try {
        String xml = prefs.getAsXML();
        node.put(JAXPRuntime.PREF_PROCESSOR_XML, xml);
        xml = outputPrefs.getAsXML();
        node.put(JAXPRuntime.PREF_OUTPUT_PROPERTIES_XML, xml);
        // $NON-NLS-1$
        node.put(JAXPLaunchConfigurationConstants.ATTR_DEFAULT_DEBUGGING_INSTALL_ID, "org.eclipse.wst.xsl.launching.xalan.processor");
    } catch (ParserConfigurationException e) {
        JAXPLaunchingPlugin.log(e);
    } catch (IOException e) {
        JAXPLaunchingPlugin.log(e);
    } catch (TransformerException e) {
        JAXPLaunchingPlugin.log(e);
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) IOException(java.io.IOException) TransformerException(javax.xml.transform.TransformerException)

Example 18 with DefaultScope

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

the class XMLValidatorPreferencePage method performDefaultsForMarkupValidationGroup.

protected void performDefaultsForMarkupValidationGroup() {
    IEclipsePreferences modelPreferences = new DefaultScope().getNode(getPreferenceNodeQualifier());
    boolean useExtendedMarkupValidation = modelPreferences.getBoolean(XMLCorePreferenceNames.MARKUP_VALIDATION, false);
    if (fExtendedMarkupValidation != null) {
        if (fExtendedMarkupValidation.getSelection() != useExtendedMarkupValidation) {
            handleMarkupSeveritySelection(useExtendedMarkupValidation);
        }
        fExtendedMarkupValidation.setSelection(useExtendedMarkupValidation);
    }
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 19 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(XPathCorePlugin.PLUGIN_ID);
    node.putBoolean(XPathProcessorPreferences.XPATH_1_0_PROCESSOR, true);
    node.putBoolean(XPathProcessorPreferences.XPATH_2_0_PROCESSOR, false);
    node.putBoolean(XPathProcessorPreferences.XPATH_OTHER, false);
}
Also used : IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) DefaultScope(org.eclipse.core.runtime.preferences.DefaultScope)

Example 20 with DefaultScope

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

the class XMLCorePreferencesTest 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(XMLCorePlugin.getDefault().getBundle().getSymbolicName());
    pluginGetDefaultPreference(node, XMLCorePreferenceNames.SPLIT_MULTI_ATTRS, Boolean.toString(false));
    pluginGetDefaultPreference(node, XMLCorePreferenceNames.INDENTATION_CHAR, XMLCorePreferenceNames.TAB);
}
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