diff options
Diffstat (limited to 'bundles')
25 files changed, 474 insertions, 17 deletions
diff --git a/bundles/org.eclipse.jst.jsp.ui/plugin.properties b/bundles/org.eclipse.jst.jsp.ui/plugin.properties index 24649a3388..dc3cc92c6d 100644 --- a/bundles/org.eclipse.jst.jsp.ui/plugin.properties +++ b/bundles/org.eclipse.jst.jsp.ui/plugin.properties @@ -21,6 +21,7 @@ JSP_Syntax_Coloring=Syntax Coloring JSP_Source_target_name=JSP Source JSP_Validation=Validation JSP_Property_validation=JSP Syntax +JSP_Typing=Typing # Snippets contributions for helping with JSP syntax jsp_scriptlet=<%..%> scriptlet diff --git a/bundles/org.eclipse.jst.jsp.ui/plugin.xml b/bundles/org.eclipse.jst.jsp.ui/plugin.xml index c98347ced1..e1cf860b47 100644 --- a/bundles/org.eclipse.jst.jsp.ui/plugin.xml +++ b/bundles/org.eclipse.jst.jsp.ui/plugin.xml @@ -231,6 +231,12 @@ id="org.eclipse.jst.jsp.ui.preferences.validation"> <keywordReference id="org.eclipse.jst.jsp.ui.severities"/> </page> + <page + name="%JSP_Typing" + category="org.eclipse.wst.sse.ui.preferences.jsp.source" + class="org.eclipse.jst.jsp.ui.internal.preferences.ui.JSPTypingPreferencePage" + id="org.eclipse.jst.jsp.ui.preferences.typing"> + </page> </extension> <!-- Keywords for preference and properties pages --> diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java index 7063aa7737..9fa5aaab05 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIMessages.java @@ -123,6 +123,10 @@ public class JSPUIMessages extends NLS { public static String SyntaxColoringPage_5; public static String SyntaxColoringPage_6; public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK; + + public static String JSPTyping_Auto_Complete; + public static String JSPTyping_Complete_Scriptlets; + public static String JSPTyping_Complete_Braces; public static String JSPValidationPreferencePage_0; // below are the strings for the validation page diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties index c00182166e..4d1bb37f4d 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties @@ -105,6 +105,10 @@ SyntaxColoringPage_5=&Strikethrough SyntaxColoringPage_6=&Underline _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=JSP editing preferences. Note that some preferences may be set on the <a>{0}</a> preference page. +# JSP Typing Preference Page +JSPTyping_Auto_Complete=Automatically close +JSPTyping_Complete_Scriptlets=&Scriptlet regions +JSPTyping_Complete_Braces=&Braces in EL expressions # Validation page strings Validation_description=Select the severity level for the following validation problems: Validation_Warning=Warning diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/autoedit/StructuredAutoEditStrategyJSP.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/autoedit/StructuredAutoEditStrategyJSP.java index 2445b71565..82a8f9fabb 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/autoedit/StructuredAutoEditStrategyJSP.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/autoedit/StructuredAutoEditStrategyJSP.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2006 IBM Corporation and others. + * Copyright (c) 2004, 2008 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 @@ -14,7 +14,9 @@ import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.DocumentCommand; import org.eclipse.jface.text.IAutoEditStrategy; import org.eclipse.jface.text.IDocument; +import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin; import org.eclipse.jst.jsp.ui.internal.Logger; +import org.eclipse.jst.jsp.ui.internal.preferences.JSPUIPreferenceNames; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; @@ -37,7 +39,7 @@ public class StructuredAutoEditStrategyJSP implements IAutoEditStrategy { if (model != null) { if (command.text != null) { - if (command.text.equals("%")) { //$NON-NLS-1$ + if (command.text.equals("%") && isPreferenceEnabled(JSPUIPreferenceNames.TYPING_COMPLETE_SCRIPTLETS)) { //$NON-NLS-1$ // scriptlet - add end %> IDOMNode node = (IDOMNode) model.getIndexedRegion(command.offset); if (prefixedWith(document, command.offset, "<") && !node.getSource().endsWith("%>")) { //$NON-NLS-1$ //$NON-NLS-2$ @@ -47,7 +49,7 @@ public class StructuredAutoEditStrategyJSP implements IAutoEditStrategy { command.doit = false; } } - if (command.text.equals("{")) { //$NON-NLS-1$ + if (command.text.equals("{") && isPreferenceEnabled(JSPUIPreferenceNames.TYPING_COMPLETE_EL_BRACES)) { //$NON-NLS-1$ IDOMNode node = (IDOMNode) model.getIndexedRegion(command.offset); if ((prefixedWith(document, command.offset, "$") || prefixedWith(document, command.offset, "#")) && //$NON-NLS-1$ //$NON-NLS-2$ !node.getSource().endsWith("}")) { //$NON-NLS-1$ //$NON-NLS-2$ @@ -65,6 +67,10 @@ public class StructuredAutoEditStrategyJSP implements IAutoEditStrategy { model.releaseFromRead(); } } + + private boolean isPreferenceEnabled(String key) { + return (key != null && JSPUIPlugin.getDefault().getPreferenceStore().getBoolean(key)); + } /** * Return the active text editor if possible, otherwise the active editor diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java index 441664e112..447efb3dbf 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceInitializer.java @@ -66,6 +66,9 @@ public class JSPUIPreferenceInitializer extends AbstractPreferenceInitializer { if (template != null) templateName = template.getName(); store.setDefault(JSPUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName); + + store.setDefault(JSPUIPreferenceNames.TYPING_COMPLETE_EL_BRACES, true); + store.setDefault(JSPUIPreferenceNames.TYPING_COMPLETE_SCRIPTLETS, true); } } diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java index c185063249..fb67d1a70f 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/JSPUIPreferenceNames.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2008 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 @@ -62,4 +62,22 @@ public class JSPUIPreferenceNames { * </p> */ public static final String NEW_FILE_TEMPLATE_NAME = "newFileTemplateName"; //$NON-NLS-1$ + + /** + * The key to store the option for auto-completing EL braces after entering + * <code>${</code> + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_COMPLETE_EL_BRACES = "typingCompleteElBraces"; //$NON-NLS-1$ + + /** + * The key to store the option for auto-completing scriptlets after entering + * <code><%</code> + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_COMPLETE_SCRIPTLETS = "typingCompleteScriptlets"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTypingPreferencePage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTypingPreferencePage.java new file mode 100644 index 0000000000..9db2d84197 --- /dev/null +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPTypingPreferencePage.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2008 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.ui.internal.preferences.ui; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jst.jsp.ui.internal.JSPUIMessages; +import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin; +import org.eclipse.jst.jsp.ui.internal.preferences.JSPUIPreferenceNames; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage; + +public class JSPTypingPreferencePage extends AbstractPreferencePage { + + private Button fCloseBraces; + private Button fCloseScriptlets; + + protected Control createContents(Composite parent) { + Composite composite = super.createComposite(parent, 1); + + createAutoComplete(composite); + + setSize(composite); + loadPreferences(); + + return composite; + } + + private void createAutoComplete(Composite parent) { + Group group = createGroup(parent, 2); + + group.setText(JSPUIMessages.JSPTyping_Auto_Complete); + + fCloseBraces = createCheckBox(group, JSPUIMessages.JSPTyping_Complete_Braces); + ((GridData) fCloseBraces.getLayoutData()).horizontalSpan = 2; + + fCloseScriptlets = createCheckBox(group, JSPUIMessages.JSPTyping_Complete_Scriptlets); + ((GridData) fCloseScriptlets.getLayoutData()).horizontalSpan = 2; + + } + + public boolean performOk() { + boolean result = super.performOk(); + + JSPUIPlugin.getDefault().savePluginPreferences(); + + return result; + } + + protected void initializeValues() { + initCheckbox(fCloseBraces, JSPUIPreferenceNames.TYPING_COMPLETE_EL_BRACES); + initCheckbox(fCloseScriptlets, JSPUIPreferenceNames.TYPING_COMPLETE_SCRIPTLETS); + } + + protected void performDefaults() { + defaultCheckbox(fCloseBraces, JSPUIPreferenceNames.TYPING_COMPLETE_EL_BRACES); + defaultCheckbox(fCloseScriptlets, JSPUIPreferenceNames.TYPING_COMPLETE_SCRIPTLETS); + } + + private void initCheckbox(Button box, String key) { + if(box != null && key != null) + box.setSelection(getPreferenceStore().getBoolean(key)); + } + + private void defaultCheckbox(Button box, String key) { + if(box != null && key != null) + box.setSelection(getPreferenceStore().getDefaultBoolean(key)); + } + + protected void storeValues() { + getPreferenceStore().setValue(JSPUIPreferenceNames.TYPING_COMPLETE_EL_BRACES, (fCloseBraces != null) ? fCloseBraces.getSelection() : false); + getPreferenceStore().setValue(JSPUIPreferenceNames.TYPING_COMPLETE_SCRIPTLETS, (fCloseScriptlets != null) ? fCloseScriptlets.getSelection() : false); + } + + protected IPreferenceStore doGetPreferenceStore() { + return JSPUIPlugin.getDefault().getPreferenceStore(); + } + +} diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPValidationPreferencePage.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPValidationPreferencePage.java index f0f11de589..07c05e96da 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPValidationPreferencePage.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/preferences/ui/JSPValidationPreferencePage.java @@ -129,7 +129,7 @@ public class JSPValidationPreferencePage extends AbstractValidationSettingsPage addComboBox(section, JSPUIMessages.VALIDATION_DIRECTIVE_TAGLIB_MISSING_URI_OR_TAGDIR, JSPCorePreferenceNames.VALIDATION_DIRECTIVE_TAGLIB_MISSING_URI_OR_TAGDIR, SEVERITIES, errorWarningIgnoreLabels, 0); addComboBox(section, JSPUIMessages.VALIDATION_DIRECTIVE_INCLUDE_FILE_NOT_FOUND, JSPCorePreferenceNames.VALIDATION_DIRECTIVE_INCLUDE_FILE_NOT_FOUND, SEVERITIES, errorWarningIgnoreLabels, 0); addComboBox(section, JSPUIMessages.VALIDATION_DIRECTIVE_INCLUDE_NO_FILE_SPECIFIED, JSPCorePreferenceNames.VALIDATION_DIRECTIVE_INCLUDE_NO_FILE_SPECIFIED, SEVERITIES, errorWarningIgnoreLabels, 0); - addComboBox(section, JSPUIMessages.VALIDATION_DIRECTIVE_PAGE_SUPERCLASS_NOT_FOUND, JSPCorePreferenceNames.VALIDATION_DIRECTIVE_PAGE_SUPERCLASS_NOT_FOUND, SEVERITIES, errorWarningIgnoreLabels, 0); +// addComboBox(section, JSPUIMessages.VALIDATION_DIRECTIVE_PAGE_SUPERCLASS_NOT_FOUND, JSPCorePreferenceNames.VALIDATION_DIRECTIVE_PAGE_SUPERCLASS_NOT_FOUND, SEVERITIES, errorWarningIgnoreLabels, 0); // end directives section // begin custom actions section diff --git a/bundles/org.eclipse.wst.html.ui/plugin.properties b/bundles/org.eclipse.wst.html.ui/plugin.properties index b7306db9e7..7c40c40518 100644 --- a/bundles/org.eclipse.wst.html.ui/plugin.properties +++ b/bundles/org.eclipse.wst.html.ui/plugin.properties @@ -17,6 +17,7 @@ HTML_Source.name=Editor HTML_Templates.name=Templates HTML_Styles.name=Styles HTML_Syntax_Coloring=Syntax Coloring +HTML_Typing=Typing HTML_Validation=Validation HTML_Property_validation=HTML Syntax WebContentSettings.name=Web Content Settings diff --git a/bundles/org.eclipse.wst.html.ui/plugin.xml b/bundles/org.eclipse.wst.html.ui/plugin.xml index 9590c603b6..86ad32ac23 100644 --- a/bundles/org.eclipse.wst.html.ui/plugin.xml +++ b/bundles/org.eclipse.wst.html.ui/plugin.xml @@ -113,7 +113,12 @@ class="org.eclipse.wst.html.ui.internal.preferences.ui.HTMLValidationPreferencePage" id="org.eclipse.wst.html.ui.preferences.validation"> </page> - + <page + name="%HTML_Typing" + category="org.eclipse.wst.html.ui.preferences.source" + class="org.eclipse.wst.html.ui.internal.preferences.ui.HTMLTypingPreferencePage" + id="org.eclipse.wst.html.ui.preferences.typing"> + </page> </extension> <!-- Web content settings --> <extension point="org.eclipse.ui.propertyPages"> diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java index 42a67acd69..6d37c93196 100644 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java +++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIMessages.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2005, 2007 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2005, 2008 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 @@ -134,6 +134,13 @@ public class HTMLUIMessages extends NLS { public static String EmptyFilePreferencePage_0; public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK; + // HTML Typing Preferences + public static String HTMLTyping_Auto_Complete; + public static String HTMLTyping_Auto_Remove; + public static String HTMLTyping_Complete_Comments; + public static String HTMLTyping_Complete_End_Tags; + public static String HTMLTyping_Remove_End_Tags; + // below are the strings for the validation page public static String Validation_description; public static String Validation_Warning; diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties index 75f9299f7d..e98c09c7f7 100644 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties +++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2004, 2007 IBM Corporation and others. +# Copyright (c) 2004, 2008 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 @@ -108,6 +108,13 @@ EmptyFilePreferencePage_0=Expand the tree to edit preferences for a specific fea _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=HTML editing preferences. Note that some preferences may be set on the <a>{0}</a> preference page. # above are possibly unused strings that may be deleted +# HTML Typing Preference Page +HTMLTyping_Auto_Complete=Automatically close +HTMLTyping_Auto_Remove=Automatically remove +HTMLTyping_Complete_Comments=&Comments +HTMLTyping_Complete_End_Tags=&End tags +HTMLTyping_Remove_End_Tags=E&nd tags when creating empty self-closing tags + # Validation strings Validation_description=Select the severity level for the following validation problems: diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/autoedit/StructuredAutoEditStrategyHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/autoedit/StructuredAutoEditStrategyHTML.java index 3985d55c6b..620911b1c3 100644 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/autoedit/StructuredAutoEditStrategyHTML.java +++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/autoedit/StructuredAutoEditStrategyHTML.java @@ -22,6 +22,8 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.texteditor.ITextEditor; import org.eclipse.ui.texteditor.ITextEditorExtension3; +import org.eclipse.wst.html.ui.internal.HTMLUIPlugin; +import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames; import org.eclipse.wst.sse.core.StructuredModelManager; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; @@ -61,6 +63,10 @@ public class StructuredAutoEditStrategyHTML implements IAutoEditStrategy { } } + private boolean isPreferenceEnabled(String key) { + return (key != null && HTMLUIPlugin.getDefault().getPreferenceStore().getBoolean(key)); + } + private boolean isCommentNode(IDOMNode node) { return (node != null && node instanceof IDOMElement && ((IDOMElement) node).isCommentTag()); } @@ -80,7 +86,7 @@ public class StructuredAutoEditStrategyHTML implements IAutoEditStrategy { private void smartRemoveEndTag(DocumentCommand command, IDocument document, IStructuredModel model) { try { // An opening tag is now a self-terminated end-tag - if ("/".equals(command.text) && ">".equals(document.get(command.offset, 1))) { //$NON-NLS-1$ //$NON-NLS-2$ + if ("/".equals(command.text) && ">".equals(document.get(command.offset, 1)) && isPreferenceEnabled(HTMLUIPreferenceNames.TYPING_REMOVE_END_TAGS)) { //$NON-NLS-1$ //$NON-NLS-2$ IDOMNode node = (IDOMNode) model.getIndexedRegion(command.offset); if (node != null && !node.hasChildNodes()) { IStructuredDocumentRegion region = node.getEndStructuredDocumentRegion(); @@ -97,7 +103,7 @@ public class StructuredAutoEditStrategyHTML implements IAutoEditStrategy { private void smartInsertForComment(DocumentCommand command, IDocument document, IStructuredModel model) { try { - if (command.text.equals("-") && document.getLength() >= 3 && document.get(command.offset - 3, 3).equals("<!-")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (command.text.equals("-") && document.getLength() >= 3 && document.get(command.offset - 3, 3).equals("<!-") && isPreferenceEnabled(HTMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS)) { //$NON-NLS-1$ //$NON-NLS-2$ command.text += " -->"; //$NON-NLS-1$ command.shiftsCaret = false; command.caretOffset = command.offset + 2; @@ -112,7 +118,7 @@ public class StructuredAutoEditStrategyHTML implements IAutoEditStrategy { private void smartInsertForEndTag(DocumentCommand command, IDocument document, IStructuredModel model) { try { - if (command.text.equals("/") && document.getLength() >= 1 && document.get(command.offset - 1, 1).equals("<")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (command.text.equals("/") && document.getLength() >= 1 && document.get(command.offset - 1, 1).equals("<") && isPreferenceEnabled(HTMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS)) { //$NON-NLS-1$ //$NON-NLS-2$ IDOMNode parentNode = (IDOMNode) ((IDOMNode) model.getIndexedRegion(command.offset - 1)).getParentNode(); if (isCommentNode(parentNode)) { // loop and find non comment node parent diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java index 50238c2269..8ef13c9fc6 100644 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java +++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 IBM Corporation and others. + * Copyright (c) 2006, 2008 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 @@ -102,6 +102,11 @@ public class HTMLUIPreferenceInitializer extends AbstractPreferenceInitializer { if (template != null) templateName = template.getName(); store.setDefault(HTMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName); + + // Defaults for the Typing preference page + store.setDefault(HTMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS, true); + store.setDefault(HTMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS, true); + store.setDefault(HTMLUIPreferenceNames.TYPING_REMOVE_END_TAGS, true); } } diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java index b4fc96894d..fbe9c7b0e1 100644 --- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java +++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/HTMLUIPreferenceNames.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005 IBM Corporation and others. + * Copyright (c) 2005, 2008 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 @@ -62,4 +62,31 @@ public class HTMLUIPreferenceNames { * </p> */ public static final String NEW_FILE_TEMPLATE_NAME = "newFileTemplateName"; //$NON-NLS-1$ + + /** + * The key to store the option for auto-completing comments while + * typing. + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_COMPLETE_COMMENTS = "completeComments"; //$NON-NLS-1$ + + /** + * The key to store the option for auto-completing end-tags after entering + * <code></</code> + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_COMPLETE_END_TAGS = "completeEndTags"; //$NON-NLS-1$ + + /** + * The key to store the option for removing an end-tag if the start tag is + * converted to an empty-tag. + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_REMOVE_END_TAGS = "removeEndTags"; //$NON-NLS-1$ } diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTypingPreferencePage.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTypingPreferencePage.java new file mode 100644 index 0000000000..1aa0676d3a --- /dev/null +++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/preferences/ui/HTMLTypingPreferencePage.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2008 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.wst.html.ui.internal.preferences.ui; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.wst.html.ui.internal.HTMLUIMessages; +import org.eclipse.wst.html.ui.internal.HTMLUIPlugin; +import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames; +import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage; + +public class HTMLTypingPreferencePage extends AbstractPreferencePage { + + private Button fCloseComment; + private Button fCloseEndTag; + private Button fRemoveEndTag; + + protected Control createContents(Composite parent) { + Composite composite = super.createComposite(parent, 1); + + createAutoComplete(composite); + createAutoRemove(composite); + + setSize(composite); + loadPreferences(); + + return composite; + } + + private void createAutoComplete(Composite parent) { + Group group = createGroup(parent, 2); + + group.setText(HTMLUIMessages.HTMLTyping_Auto_Complete); + + fCloseComment = createCheckBox(group, HTMLUIMessages.HTMLTyping_Complete_Comments); + ((GridData) fCloseComment.getLayoutData()).horizontalSpan = 2; + + fCloseEndTag = createCheckBox(group, HTMLUIMessages.HTMLTyping_Complete_End_Tags); + ((GridData) fCloseEndTag.getLayoutData()).horizontalSpan = 2; + + } + + private void createAutoRemove(Composite parent) { + Group group = createGroup(parent, 2); + + group.setText(HTMLUIMessages.HTMLTyping_Auto_Remove); + + fRemoveEndTag = createCheckBox(group, HTMLUIMessages.HTMLTyping_Remove_End_Tags); + ((GridData) fRemoveEndTag.getLayoutData()).horizontalSpan = 2; + } + + public boolean performOk() { + boolean result = super.performOk(); + + HTMLUIPlugin.getDefault().savePluginPreferences(); + + return result; + } + + protected void initializeValues() { + initCheckbox(fCloseComment, HTMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS); + initCheckbox(fCloseEndTag, HTMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS); + initCheckbox(fRemoveEndTag, HTMLUIPreferenceNames.TYPING_REMOVE_END_TAGS); + } + + protected void performDefaults() { + defaultCheckbox(fCloseComment, HTMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS); + defaultCheckbox(fCloseEndTag, HTMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS); + defaultCheckbox(fRemoveEndTag, HTMLUIPreferenceNames.TYPING_REMOVE_END_TAGS); + } + + private void initCheckbox(Button box, String key) { + if(box != null && key != null) + box.setSelection(getPreferenceStore().getBoolean(key)); + } + + private void defaultCheckbox(Button box, String key) { + if(box != null && key != null) + box.setSelection(getPreferenceStore().getDefaultBoolean(key)); + } + + protected void storeValues() { + getPreferenceStore().setValue(HTMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS, (fCloseComment != null) ? fCloseComment.getSelection() : false); + getPreferenceStore().setValue(HTMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS, (fCloseEndTag != null) ? fCloseEndTag.getSelection() : false); + getPreferenceStore().setValue(HTMLUIPreferenceNames.TYPING_REMOVE_END_TAGS, (fRemoveEndTag != null) ? fRemoveEndTag.getSelection() : false); + } + + protected IPreferenceStore doGetPreferenceStore() { + return HTMLUIPlugin.getDefault().getPreferenceStore(); + } + +} diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.properties b/bundles/org.eclipse.wst.xml.ui/plugin.properties index 96b5834bfe..fa3c39ce2d 100644 --- a/bundles/org.eclipse.wst.xml.ui/plugin.properties +++ b/bundles/org.eclipse.wst.xml.ui/plugin.properties @@ -20,6 +20,7 @@ XML_Source.name=Editor XML_Templates.name=Templates XML_Styles.name=Styles XML_Syntax_Coloring=Syntax Coloring +XML_Typing=Typing XML_Editor.name=XML Editor ############################################################################### _UI_WIZARD_NEW_XML=XML diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.xml b/bundles/org.eclipse.wst.xml.ui/plugin.xml index 95e1c936d8..d8f9ba5db1 100644 --- a/bundles/org.eclipse.wst.xml.ui/plugin.xml +++ b/bundles/org.eclipse.wst.xml.ui/plugin.xml @@ -136,6 +136,12 @@ id="org.eclipse.wst.xml.core.ui.XMLCatalogPreferencePage"> <keywordReference id="org.eclipse.wst.xml.ui.xmlcatalog"/> </page> + <page + name="%XML_Typing" + category="org.eclipse.wst.sse.ui.preferences.xml.source" + class="org.eclipse.wst.xml.ui.internal.preferences.XMLTypingPreferencePage" + id="org.eclipse.wst.sse.ui.preferences.xml.typing"> + </page> </extension> <!-- Keywords for preference and properties pages --> diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java index 864bdd1404..b460f6d255 100644 --- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java +++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java @@ -266,6 +266,11 @@ public class XMLUIMessages extends NLS { public static String OpenFileFromSource_tooltip; // Resource bundle public static String OpenFileFromSource_description; // Resource bundle public static String XMLContentOutlineConfiguration_0; + public static String XMLTyping_Auto_Complete; + public static String XMLTyping_Auto_Remove; + public static String XMLTyping_Complete_Comments; + public static String XMLTyping_Complete_End_Tags; + public static String XMLTyping_Remove_End_Tags; public static String StructureSelectEnclosing_label; public static String StructureSelectEnclosing_tooltip; public static String StructureSelectEnclosing_description; diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties index 70d4493e65..e44d9aaa31 100644 --- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties +++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties @@ -298,6 +298,11 @@ OpenFileFromSource_label=Op&en Selection OpenFileFromSource_tooltip=Open an editor on the selected link OpenFileFromSource_description=Open an editor on the selected link XMLContentOutlineConfiguration_0=Show Attributes +XMLTyping_Auto_Complete=Automatically close +XMLTyping_Auto_Remove=Automatically remove +XMLTyping_Complete_Comments=&Comments +XMLTyping_Complete_End_Tags=&End tags +XMLTyping_Remove_End_Tags=E&nd tags when creating empty self-closing tags StructureSelectEnclosing_label=Enclosing Element StructureSelectEnclosing_tooltip=Expand selection to include enclosing element StructureSelectEnclosing_description=Expand selection to include enclosing element diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/autoedit/StructuredAutoEditStrategyXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/autoedit/StructuredAutoEditStrategyXML.java index 494a4e178b..df619e79f0 100644 --- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/autoedit/StructuredAutoEditStrategyXML.java +++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/autoedit/StructuredAutoEditStrategyXML.java @@ -28,6 +28,8 @@ import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentReg import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode; import org.eclipse.wst.xml.ui.internal.Logger; +import org.eclipse.wst.xml.ui.internal.XMLUIPlugin; +import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames; import org.w3c.dom.Node; /** @@ -62,6 +64,10 @@ public class StructuredAutoEditStrategyXML implements IAutoEditStrategy { } } } + + private boolean isPreferenceEnabled(String key) { + return (key != null && XMLUIPlugin.getDefault().getPreferenceStore().getBoolean(key)); + } private boolean isCommentNode(IDOMNode node) { return ((node != null) && (node instanceof IDOMElement) && ((IDOMElement) node).isCommentTag()); @@ -82,7 +88,7 @@ public class StructuredAutoEditStrategyXML implements IAutoEditStrategy { private void smartRemoveEndTag(DocumentCommand command, IDocument document, IStructuredModel model) { try { // An opening tag is now a self-terminated end-tag - if ("/".equals(command.text) && ">".equals(document.get(command.offset, 1))) { //$NON-NLS-1$ //$NON-NLS-2$ + if ("/".equals(command.text) && ">".equals(document.get(command.offset, 1)) && isPreferenceEnabled(XMLUIPreferenceNames.TYPING_REMOVE_END_TAGS)) { //$NON-NLS-1$ //$NON-NLS-2$ IDOMNode node = (IDOMNode) model.getIndexedRegion(command.offset); if (node != null && !node.hasChildNodes()) { IStructuredDocumentRegion region = node.getEndStructuredDocumentRegion(); @@ -99,7 +105,7 @@ public class StructuredAutoEditStrategyXML implements IAutoEditStrategy { private void smartInsertForComment(DocumentCommand command, IDocument document, IStructuredModel model) { try { - if (command.text.equals("-") && (document.getLength() >= 3) && document.get(command.offset - 3, 3).equals("<!-")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (command.text.equals("-") && (document.getLength() >= 3) && document.get(command.offset - 3, 3).equals("<!-") && isPreferenceEnabled(XMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS)) { //$NON-NLS-1$ //$NON-NLS-2$ command.text += " -->"; //$NON-NLS-1$ command.shiftsCaret = false; command.caretOffset = command.offset + 2; @@ -114,7 +120,7 @@ public class StructuredAutoEditStrategyXML implements IAutoEditStrategy { private void smartInsertForEndTag(DocumentCommand command, IDocument document, IStructuredModel model) { try { - if (command.text.equals("/") && (document.getLength() >= 1) && document.get(command.offset - 1, 1).equals("<")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (command.text.equals("/") && (document.getLength() >= 1) && document.get(command.offset - 1, 1).equals("<") && isPreferenceEnabled(XMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS)) { //$NON-NLS-1$ //$NON-NLS-2$ IDOMNode parentNode = (IDOMNode) ((IDOMNode) model.getIndexedRegion(command.offset - 1)).getParentNode(); if (isCommentNode(parentNode)) { // loop and find non comment node parent diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTypingPreferencePage.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTypingPreferencePage.java new file mode 100644 index 0000000000..a30a7dd7e8 --- /dev/null +++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLTypingPreferencePage.java @@ -0,0 +1,106 @@ +/******************************************************************************* + * Copyright (c) 2008 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.wst.xml.ui.internal.preferences; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.PlatformUI; +import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage; +import org.eclipse.wst.xml.ui.internal.XMLUIMessages; +import org.eclipse.wst.xml.ui.internal.XMLUIPlugin; +import org.eclipse.wst.xml.ui.internal.editor.IHelpContextIds; + +public class XMLTypingPreferencePage extends AbstractPreferencePage { + + private Button fCloseComment; + private Button fCloseEndTag; + private Button fRemoveEndTag; + + protected Control createContents(Composite parent) { + Composite composite = super.createComposite(parent, 1); + PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.XML_PREFWEBX_FILES_HELPID); + + createAutoComplete(composite); + createAutoRemove(composite); + + setSize(composite); + loadPreferences(); + + return composite; + } + + private void createAutoComplete(Composite parent) { + Group group = createGroup(parent, 2); + + group.setText(XMLUIMessages.XMLTyping_Auto_Complete); + + fCloseComment = createCheckBox(group, XMLUIMessages.XMLTyping_Complete_Comments); + ((GridData) fCloseComment.getLayoutData()).horizontalSpan = 2; + + fCloseEndTag = createCheckBox(group, XMLUIMessages.XMLTyping_Complete_End_Tags); + ((GridData) fCloseEndTag.getLayoutData()).horizontalSpan = 2; + + } + + private void createAutoRemove(Composite parent) { + Group group = createGroup(parent, 2); + + group.setText(XMLUIMessages.XMLTyping_Auto_Remove); + + fRemoveEndTag = createCheckBox(group, XMLUIMessages.XMLTyping_Remove_End_Tags); + ((GridData) fRemoveEndTag.getLayoutData()).horizontalSpan = 2; + } + + public boolean performOk() { + boolean result = super.performOk(); + + XMLUIPlugin.getDefault().savePluginPreferences(); + + return result; + } + + protected void initializeValues() { + initCheckbox(fCloseComment, XMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS); + initCheckbox(fCloseEndTag, XMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS); + initCheckbox(fRemoveEndTag, XMLUIPreferenceNames.TYPING_REMOVE_END_TAGS); + } + + protected void performDefaults() { + defaultCheckbox(fCloseComment, XMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS); + defaultCheckbox(fCloseEndTag, XMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS); + defaultCheckbox(fRemoveEndTag, XMLUIPreferenceNames.TYPING_REMOVE_END_TAGS); + } + + private void initCheckbox(Button box, String key) { + if(box != null && key != null) + box.setSelection(getPreferenceStore().getBoolean(key)); + } + + private void defaultCheckbox(Button box, String key) { + if(box != null && key != null) + box.setSelection(getPreferenceStore().getDefaultBoolean(key)); + } + + protected void storeValues() { + getPreferenceStore().setValue(XMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS, (fCloseComment != null) ? fCloseComment.getSelection() : false); + getPreferenceStore().setValue(XMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS, (fCloseEndTag != null) ? fCloseEndTag.getSelection() : false); + getPreferenceStore().setValue(XMLUIPreferenceNames.TYPING_REMOVE_END_TAGS, (fRemoveEndTag != null) ? fRemoveEndTag.getSelection() : false); + } + + protected IPreferenceStore doGetPreferenceStore() { + return XMLUIPlugin.getDefault().getPreferenceStore(); + } +} diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java index 8a9bcfdc69..80ac7a4910 100644 --- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java +++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceInitializer.java @@ -122,6 +122,11 @@ public class XMLUIPreferenceInitializer extends AbstractPreferenceInitializer { if (template != null) templateName = template.getName(); store.setDefault(XMLUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName); + + // Defaults for the Typing preference page + store.setDefault(XMLUIPreferenceNames.TYPING_COMPLETE_COMMENTS, true); + store.setDefault(XMLUIPreferenceNames.TYPING_COMPLETE_END_TAGS, true); + store.setDefault(XMLUIPreferenceNames.TYPING_REMOVE_END_TAGS, true); } } diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java index 293e5781cb..d71a7a3652 100644 --- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java +++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/preferences/XMLUIPreferenceNames.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. + * Copyright (c) 2005, 2008 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 @@ -92,4 +92,31 @@ public class XMLUIPreferenceNames { * </p> */ public static final String NEW_FILE_TEMPLATE_NAME = "newFileTemplateName"; //$NON-NLS-1$ + + /** + * The key to store the option for auto-completing comments while + * typing. + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_COMPLETE_COMMENTS = "completeComments"; //$NON-NLS-1$ + + /** + * The key to store the option for auto-completing end-tags after entering + * <code></</code> + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_COMPLETE_END_TAGS = "completeEndTags"; //$NON-NLS-1$ + + /** + * The key to store the option for removing an end-tag if the start tag is + * converted to an empty-tag. + * <p> + * Value is of type <code>boolean</code>. + * </p> + */ + public static final String TYPING_REMOVE_END_TAGS = "removeEndTags"; //$NON-NLS-1$ } |