Author: mareshkau
Date: 2010-05-06 09:27:44 -0400 (Thu, 06 May 2010)
New Revision: 21934
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6131
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-05-06 09:47:16 UTC (rev
21933)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-05-06 13:27:44 UTC (rev
21934)
@@ -128,20 +128,6 @@
</selection>
</wizard>
<wizard
- category="org.jboss.tools.jst.web"
- class="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard"
-
finalPerspective="org.jboss.tools.jsf.ui.wizard.project.NewProjectWizard"
- icon="$nl$/images/xstudio/wizards/new_html_file.gif"
- id="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard"
- name="%NewXHTMLPage"
- project="false">
- <description>
- %NewXHTMLPageDescription
- </description>
- <selection class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
- <wizard
category="org.jboss.tools.jst.web/org.jboss.tools.jsf"
class="org.jboss.tools.jsf.ui.wizard.project.NewProjectWizard"
finalPerspective="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-05-06 09:47:16 UTC (rev
21933)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/plugin.xml 2010-05-06 13:27:44 UTC (rev
21934)
@@ -119,6 +119,20 @@
</wizard>
<wizard
category="org.jboss.tools.jst.web"
+ class="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard"
+
finalPerspective="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
+ icon="$nl$/images/xstudio/wizards/new_html_file.gif"
+ id="org.jboss.tools.jst.web.ui.wizards.newfile.NewXHTMLWizard"
+ name="%NewXHTMLPage"
+ project="false">
+ <description>
+ %NewXHTMLPageDescription
+ </description>
+ <selection class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ <wizard
+ category="org.jboss.tools.jst.web"
class="org.jboss.tools.jst.web.ui.wizards.css.NewCSSClassWizard"
finalPerspective="org.jboss.tools.jst.web.ui.WebDevelopmentPerspective"
icon="$nl$/images/xstudio/wizards/new_css_class.gif"
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java 2010-05-06
09:47:16 UTC (rev 21933)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java 2010-05-06
13:27:44 UTC (rev 21934)
@@ -26,7 +26,6 @@
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
import org.jboss.tools.jst.web.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
import org.w3c.dom.Node;
@@ -152,26 +151,39 @@
*/
private List<String> getContentTypes(ITextViewer textViewer, int
documentPosition){
List<String> fContextTypes = new ArrayList<String>();
+ //this should be added in any case
+ fContextTypes.add(TemplateContextTypeIdsXHTML.ALL);
IDocument document = textViewer.getDocument();
IStructuredModel model = null;
try {
- // gets source model for read, model should be released see
- // JBIDE-2219
model = StructuredModelManager.getModelManager()
.getExistingModelForRead(document);
- IndexedRegion node = model.getIndexedRegion(documentPosition);
+ Node node = (Node) model.getIndexedRegion(documentPosition);
+
+ if(node==null||node.getNodeType()==Node.DOCUMENT_NODE){
+ fContextTypes.add(TemplateContextTypeIdsXHTML.NEW);
+ }
+ //commented by Maksim Areshkau, because even on attribute we get type ELEMENT_NODE
+// else if(node.getNodeType()==Node.ATTRIBUTE_NODE){
+// fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE);
+// fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
+// }
+ else if(node.getNodeType()==Node.ELEMENT_NODE ||node.getNodeType()==Node.TEXT_NODE) {
+ fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE);
+ fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
+ fContextTypes.add(TemplateContextTypeIdsXHTML.TAG);
+ }
+
}
finally{
if (model != null) {
model.releaseFromRead();
}
}
- //TODO Maksim Areshkau, analize and position here
- fContextTypes.add(TemplateContextTypeIdsXHTML.ALL);
- fContextTypes.add(TemplateContextTypeIdsXHTML.TAG);
- fContextTypes.add(TemplateContextTypeIdsXHTML.NEW);
- fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE);
- fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
+// fContextTypes.add(TemplateContextTypeIdsXHTML.TAG);
+// fContextTypes.add(TemplateContextTypeIdsXHTML.NEW);
+// fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE);
+// fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
return fContextTypes;
}