[304352] [content assist] HTMLMinimalContentModelGenerator needs to be updated and its use corrected
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java
index 53035f6..0bdd85f 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLMinimalContentModelGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 2010 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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.eclipse.wst.html.ui.internal.contentassist;
-import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.wst.html.core.internal.HTMLCorePlugin;
import org.eclipse.wst.html.core.internal.contentmodel.HTMLElementDeclaration;
import org.eclipse.wst.html.core.internal.preferences.HTMLCorePreferenceNames;
@@ -34,10 +34,9 @@
}
private void init() {
- //IPreferenceStore prefs = CommonPreferencesPlugin.getDefault().getPreferenceStore(ContentType.ContentTypeID_HTML);
- Preferences prefs = HTMLCorePlugin.getDefault().getPluginPreferences();
- fTagCase = prefs.getInt(HTMLCorePreferenceNames.TAG_NAME_CASE);
- fAttrCase = prefs.getInt(HTMLCorePreferenceNames.ATTR_NAME_CASE);
+ String qualifier = HTMLCorePlugin.getDefault().getBundle().getSymbolicName();
+ fTagCase = Platform.getPreferencesService().getInt(qualifier, HTMLCorePreferenceNames.TAG_NAME_CASE, 0, null);
+ fAttrCase = Platform.getPreferencesService().getInt(qualifier, HTMLCorePreferenceNames.ATTR_NAME_CASE, 0, null);
}
protected void generateEndTag(String tagName, Node parentNode, CMElementDeclaration elementDecl, StringBuffer buffer) {
@@ -111,6 +110,11 @@
}
}
}
+
+ //if not an html element and empty, assume start tag needs to be closed
+ else if (elementDecl.getContentType() == CMElementDeclaration.EMPTY) {
+ return "/>"; //$NON-NLS-1$
+ }
return ">"; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTagsCompletionProposalComputer.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTagsCompletionProposalComputer.java
index 40738a9..b22ff1e 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTagsCompletionProposalComputer.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/contentassist/HTMLTagsCompletionProposalComputer.java
@@ -58,9 +58,6 @@
*/
public class HTMLTagsCompletionProposalComputer extends
AbstractXMLModelQueryCompletionProposalComputer {
-
- /** the content generator for generating proposals */
- protected XMLContentModelGenerator fGenerator;
/** <code>true</code> if the document the proposal request is on is XHTML */
protected boolean isXHTML = false;
@@ -80,7 +77,6 @@
IDOMNode node = (IDOMNode) treeNode;
boolean isXHTMLNode = isXHTMLNode(node);
if(this.isXHTML != isXHTMLNode) {
- this.fGenerator = null;
this.isXHTML = isXHTMLNode;
}
@@ -94,14 +90,11 @@
* @see org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLModelQueryCompletionProposalComputer#getContentGenerator()
*/
protected XMLContentModelGenerator getContentGenerator() {
- if (fGenerator == null) {
- if (isXHTML) {
- fGenerator = XHTMLMinimalContentModelGenerator.getInstance();
- } else {
- fGenerator = HTMLMinimalContentModelGenerator.getInstance();
- }
+ if (isXHTML) {
+ return XHTMLMinimalContentModelGenerator.getInstance();
+ } else {
+ return HTMLMinimalContentModelGenerator.getInstance();
}
- return fGenerator;
}
/**