| /******************************************************************************* |
| * 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()); |
| |
| // compiler/validation preferences |
| node.putBoolean(JSPCorePreferenceNames.VALIDATE_FRAGMENTS, true); |
| |
| // 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$ |
| } |
| } |