diff options
Diffstat (limited to 'bundles/org.eclipse.jst.jsp.core')
3 files changed, 43 insertions, 40 deletions
diff --git a/bundles/org.eclipse.jst.jsp.core/plugin.xml b/bundles/org.eclipse.jst.jsp.core/plugin.xml index f1ad265a98..e5cfeb359e 100644 --- a/bundles/org.eclipse.jst.jsp.core/plugin.xml +++ b/bundles/org.eclipse.jst.jsp.core/plugin.xml @@ -145,4 +145,9 @@ content-type="org.eclipse.core.runtime.xml" file-extensions="tld"/> </extension> + + <!-- initialize jsp core preferences --> + <extension point="org.eclipse.core.runtime.preferences"> + <initializer class="org.eclipse.jst.jsp.core.internal.preferences.JSPCorePreferenceInitializer"/> + </extension> </plugin> diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java index 579bb56180..3905b7bc96 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java @@ -14,13 +14,9 @@ import org.eclipse.core.resources.IResourceChangeEvent; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Preferences; import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController; import org.eclipse.jst.jsp.core.internal.java.search.JSPIndexManager; import org.eclipse.jst.jsp.core.internal.java.search.JSPSearchSupport; -import org.eclipse.wst.sse.core.internal.encoding.CommonCharsetNames; -import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; -import org.eclipse.wst.sse.core.internal.preferences.CommonModelPreferenceNames; import org.osgi.framework.BundleContext; /** @@ -53,42 +49,6 @@ public class JSPCorePlugin extends Plugin { } /* (non-Javadoc) - * @see org.eclipse.core.runtime.Plugin#initializeDefaultPluginPreferences() - */ - protected void initializeDefaultPluginPreferences() { - Preferences prefs = getDefault().getPluginPreferences(); - // set model preference defaults - prefs.setDefault(CommonModelPreferenceNames.CLEANUP_TAG_NAME_CASE, CommonModelPreferenceNames.ASIS); - prefs.setDefault(CommonModelPreferenceNames.CLEANUP_ATTR_NAME_CASE, CommonModelPreferenceNames.ASIS); - prefs.setDefault(CommonModelPreferenceNames.INSERT_MISSING_TAGS, true); - prefs.setDefault(CommonModelPreferenceNames.QUOTE_ATTR_VALUES, true); - prefs.setDefault(CommonModelPreferenceNames.FORMAT_SOURCE, true); - prefs.setDefault(CommonModelPreferenceNames.CONVERT_EOL_CODES, false); - - prefs.setDefault(CommonEncodingPreferenceNames.INPUT_CODESET, ""); //$NON-NLS-1$ - - String defaultEnc = CommonModelPreferenceNames.UTF_8; - String systemEnc = System.getProperty("file.encoding"); //$NON-NLS-1$ - if (systemEnc != null) { - defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, CommonModelPreferenceNames.UTF_8); - } - prefs.setDefault(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc); - - prefs.setDefault(CommonEncodingPreferenceNames.END_OF_LINE_CODE, ""); //$NON-NLS-1$ - prefs.setDefault(CommonModelPreferenceNames.TAB_WIDTH, CommonModelPreferenceNames.DEFAULT_TAB_WIDTH); - - prefs.setDefault(CommonModelPreferenceNames.FORMATTING_SUPPORTED, true); - prefs.setDefault(CommonModelPreferenceNames.LINE_WIDTH, 72); - prefs.setDefault(CommonModelPreferenceNames.SPLIT_MULTI_ATTRS, false); - prefs.setDefault(CommonModelPreferenceNames.INDENT_USING_TABS, true); - prefs.setDefault(CommonModelPreferenceNames.CLEAR_ALL_BLANK_LINES, false); - - prefs.setDefault(CommonModelPreferenceNames.PREFERRED_MARKUP_CASE_SUPPORTED, true); - prefs.setDefault(CommonModelPreferenceNames.TAG_NAME_CASE, CommonModelPreferenceNames.UPPER); - prefs.setDefault(CommonModelPreferenceNames.ATTR_NAME_CASE, CommonModelPreferenceNames.LOWER); - } - - /* (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/preferences/JSPCorePreferenceInitializer.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/preferences/JSPCorePreferenceInitializer.java new file mode 100644 index 0000000000..762af18836 --- /dev/null +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/preferences/JSPCorePreferenceInitializer.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2005 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jst.jsp.core.internal.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.DefaultScope; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.jst.jsp.core.internal.JSPCorePlugin; +import org.eclipse.wst.sse.core.internal.encoding.CommonCharsetNames; +import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames; + +/** + * Sets default values for JSP Core preferences + */ +public class JSPCorePreferenceInitializer extends AbstractPreferenceInitializer { + + public void initializeDefaultPreferences() { + IEclipsePreferences node = new DefaultScope().getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName()); + + // code generation preferences + node.put(CommonEncodingPreferenceNames.INPUT_CODESET, ""); //$NON-NLS-1$ + String defaultEnc = "ISO-8859-1";//$NON-NLS-1$ + String systemEnc = System.getProperty("file.encoding"); //$NON-NLS-1$ + if (systemEnc != null) { + defaultEnc = CommonCharsetNames.getPreferredDefaultIanaName(systemEnc, "ISO-8859-1");//$NON-NLS-1$ + } + node.put(CommonEncodingPreferenceNames.OUTPUT_CODESET, defaultEnc); + node.put(CommonEncodingPreferenceNames.END_OF_LINE_CODE, ""); //$NON-NLS-1$ + } +} |