Author: dmaliarevich
Date: 2011-01-24 12:47:41 -0500 (Mon, 24 Jan 2011)
New Revision: 28573
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLCustomTemplateProposal.java
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/XHTMLTemplateCompletionProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateContentAssistComputer.java
Log:
https://issues.jboss.org/browse/JBIDE-8139 , proposals additional info has been added.
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 2011-01-24
17:35:55 UTC (rev 28572)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java 2011-01-24
17:47:41 UTC (rev 28573)
@@ -90,8 +90,10 @@
private void addTemplates(ITextViewer fTextViewer,
List<ICompletionProposal> contentAssistRequest,
List<String> fTemplateContexts, int startOffset) {
- if (contentAssistRequest == null)
+
+ if (contentAssistRequest == null) {
return;
+ }
// if already adding template proposals for a certain context type, do
// not add again
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLCustomTemplateProposal.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLCustomTemplateProposal.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLCustomTemplateProposal.java 2011-01-24
17:47:41 UTC (rev 28573)
@@ -0,0 +1,23 @@
+package org.jboss.tools.jst.web.ui.editor.pref.template.contentassist;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateProposal;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceCompletionProposal;
+
+public class XHTMLCustomTemplateProposal extends TemplateProposal implements
+ IRelevanceCompletionProposal {
+
+ public XHTMLCustomTemplateProposal(Template template,
+ TemplateContext context, IRegion region, Image image, int relevance) {
+ super(template, context, region, image, relevance);
+ }
+
+ public String getAdditionalProposalInfo() {
+ String additionalInfo = super.getAdditionalProposalInfo();
+ return StringUtils.convertToHTMLContent(additionalInfo);
+ }
+}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java 2011-01-24
17:35:55 UTC (rev 28572)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java 2011-01-24
17:47:41 UTC (rev 28573)
@@ -31,6 +31,8 @@
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.html.ui.internal.contentassist.ReplaceNameTemplateContext;
+import org.eclipse.wst.html.ui.internal.editor.HTMLEditorPluginImageHelper;
+import org.eclipse.wst.html.ui.internal.editor.HTMLEditorPluginImages;
import org.jboss.tools.jst.web.ui.WebUiPlugin;
@@ -89,7 +91,7 @@
}
Collections.sort(matches, fgProposalComparator);
-
+
return (ICompletionProposal[]) matches.toArray(new
ICompletionProposal[matches.size()]);
}
@@ -124,7 +126,7 @@
@Override
protected ICompletionProposal createProposal(Template template, TemplateContext context,
IRegion region, int relevance) {
- return new TemplateProposal(template, context, region, getImage(template), relevance);
+ return new XHTMLCustomTemplateProposal(template, context, region, getImage(template),
relevance);
}
@Override
@@ -168,7 +170,6 @@
@Override
protected Image getImage(Template template) {
- // TODO Auto-generated method stub
- return null;
+ return
HTMLEditorPluginImageHelper.getInstance().getImage(HTMLEditorPluginImages.IMG_OBJ_TAG_TEMPLATE);
}
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateContentAssistComputer.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateContentAssistComputer.java 2011-01-24
17:35:55 UTC (rev 28572)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/editor/pref/template/contentassist/XHTMLTemplateContentAssistComputer.java 2011-01-24
17:47:41 UTC (rev 28573)
@@ -141,8 +141,10 @@
private void addTemplates(ITextViewer fTextViewer,
List<ICompletionProposal> contentAssistRequest,
List<String> fTemplateContexts, int startOffset) {
- if (contentAssistRequest == null)
+
+ if (contentAssistRequest == null) {
return;
+ }
// if already adding template proposals for a certain context type, do
// not add again