Author: vrubezhny
Date: 2009-09-17 17:47:15 -0400 (Thu, 17 Sep 2009)
New Revision: 17642
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
Log:
JBIDE-512 context variable code completion dropdown should show their "source"
JBIDE-2541 Show java-doc for EL content assist item
The values of type, sourceType and JavaDoc are gathered to be displayed in CA
The JavaDoc comments are shown even from classes stored in JavaSource folders
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-09-17 17:47:25
UTC (rev 17641)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2009-09-17 21:47:15
UTC (rev 17642)
@@ -12,7 +12,8 @@
org.jboss.tools.common.el.core,
org.eclipse.jface.text,
org.eclipse.wst.sse.core,
- org.eclipse.wst.xml.ui;bundle-version="1.1.0"
+ org.eclipse.wst.xml.ui;bundle-version="1.1.0",
+ org.eclipse.jdt.ui;bundle-version="3.5.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-09-17
17:47:25 UTC (rev 17641)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/AbstractELCompletionEngine.java 2009-09-17
21:47:15 UTC (rev 17642)
@@ -17,9 +17,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.internal.ui.text.java.ProposalInfo;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.swt.graphics.Image;
import org.jboss.tools.common.el.core.model.ELArgumentInvocation;
@@ -109,6 +111,14 @@
return resolution;
}
+ /**
+ * Resolves EL Operand
+ *
+ * @param operand
+ * @param context
+ * @param returnEqualedVariablesOnly
+ * @return
+ */
public ELResolution resolveELOperand(ELExpression operand, ELContext context, boolean
returnEqualedVariablesOnly) {
List<Var> vars = new ArrayList<Var>();
Var[] array = context.getVars();
@@ -282,14 +292,8 @@
}
IJavaElement element = memberInfo == null ? null : memberInfo.getJavaElement();
- String attachedJavaDoc = null;
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
String varNameProposal = v.getName().substring(prefix.length());
TextProposal proposal = new TextProposal();
proposal.setLabel(v.getName());
@@ -406,14 +410,8 @@
typeName = Signature.getSimpleName(typeName);
IJavaElement element = member == null ? null : member.getJavaElement();
- String attachedJavaDoc = null;
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
TextProposal proposal = new TextProposal();
proposal.setLabel(varName);
proposal.setReplacementString(varName.substring(operand.getLength()));
@@ -460,14 +458,8 @@
if (typeName != null && typeName.indexOf('.') != -1)
typeName = Signature.getSimpleName(typeName);
IJavaElement element = member == null ? null : member.getJavaElement();
- String attachedJavaDoc = null;
-
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
+
String varName = var.getName();
if(operand.getLength()<=varName.length()) {
TextProposal proposal = new TextProposal();
@@ -685,14 +677,8 @@
if (typeName != null && typeName.indexOf('.') != -1)
typeName = Signature.getSimpleName(typeName);
IJavaElement element = member == null ? null : member.getJavaElement();
- String attachedJavaDoc = null;
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
TextProposal proposal = new TextProposal();
proposal.setReplacementString(presentationString);
proposal.setLabel(presentationString);
@@ -733,14 +719,8 @@
if (typeName != null && typeName.indexOf('.') != -1)
typeName = Signature.getSimpleName(typeName);
IJavaElement element = member == null ? null : member.getJavaElement();
- String attachedJavaDoc = null;
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
TextProposal proposal = new TextProposal();
proposal.setReplacementString(presentationString);
proposal.setLabel(presentationString);
@@ -815,13 +795,7 @@
if (typeName != null && typeName.indexOf('.') != -1)
typeName = Signature.getSimpleName(typeName);
IJavaElement element = member == null ? null : member.getJavaElement();
- String attachedJavaDoc = null;
-
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
TextProposal kbProposal = new TextProposal();
kbProposal.setReplacementString(proposal.getPresentation().substring(filter.length()));
@@ -910,14 +884,8 @@
if (typeName != null && typeName.indexOf('.') != -1)
typeName = Signature.getSimpleName(typeName);
IJavaElement element = member == null ? null : member.getJavaElement();
- String attachedJavaDoc = null;
+ String attachedJavaDoc = (element instanceof IMember)?(new
ProposalInfo((IMember)element)).getInfo(null):null;
- try {
- attachedJavaDoc = element == null ? null : element.getAttachedJavadoc(null);
- } catch (JavaModelException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
TextProposal kbProposal = new TextProposal();
String replacementString = proposal.getPresentation().substring(filter.length());