Author: akazakov
Date: 2009-09-18 12:56:22 -0400 (Fri, 18 Sep 2009)
New Revision: 17670
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4771
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-09-18
16:12:07 UTC (rev 17669)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-09-18
16:56:22 UTC (rev 17670)
@@ -12,6 +12,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -121,8 +122,10 @@
try {
model = mm.getModelForRead(file);
} catch (IOException e) {
+ Activator.getDefault().logError(e);
return null;
} catch (CoreException e) {
+ Activator.getDefault().logError(e);
return null;
}
}
@@ -151,7 +154,7 @@
if(node!=null) {
return findAllVars(node);
}
- return null;
+ return Collections.emptyList();
}
/**
@@ -173,7 +176,7 @@
if(node!=null) {
return findAllVars(node, resolver.getParserFactory());
}
- return null;
+ return Collections.emptyList();
}
/**
@@ -186,7 +189,7 @@
if(node!=null) {
return findAllVars(node, factory);
}
- return null;
+ return Collections.emptyList();
}
/**
@@ -324,5 +327,4 @@
}
return null;
}
-
-}
+}
\ No newline at end of file
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-09-18
16:12:07 UTC (rev 17669)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-09-18
16:56:22 UTC (rev 17670)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.resources.IFile;
@@ -23,6 +24,7 @@
import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolutionImpl;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
import org.jboss.tools.common.el.core.resolver.Var;
@@ -62,7 +64,7 @@
ELExpression operand, boolean returnEqualedVariablesOnly,
List<Var> vars, ElVarSearcher varSearcher)
throws BadLocationException, StringIndexOutOfBoundsException {
- return null;
+ return new ELResolutionImpl();
}
public ELParserFactory getParserFactory() {
@@ -70,11 +72,11 @@
}
public List<TextProposal> getProposals(ELContext context, String el) {
- return null;
+ return Collections.emptyList();
}
public ELResolution resolve(ELContext context, ELExpression operand) {
- return null;
+ return new ELResolutionImpl();
}
};
ElVarSearcher varSearcher = new ElVarSearcher(file, fakeEngine);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-09-18
16:12:07 UTC (rev 17669)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-09-18
16:56:22 UTC (rev 17670)
@@ -387,43 +387,32 @@
}
return false;
}
-
+
private void resolve(IFile file, ELExpression operand, int offset, int length){
ELResolver[] resolvers = ELResolverFactoryManager.getInstance().getResolvers(file);
-
+
for(ELResolver resolver : resolvers){
if(!(resolver instanceof ELCompletionEngine))
continue;
-
+
SimpleELContext context = new SimpleELContext();
-
+
context.setResource(file);
context.setElResolvers(resolvers);
List<Var> vars = ElVarSearcher.findAllVars(context, offset, resolver);
-
- if(vars == null)
- continue;
-
+
context.setVars(vars);
ELResolution resolution = resolver.resolve(context, operand);
-
- if(resolution == null)
- continue;
-
+
ELSegment segment = resolution.findSegmentByOffset(offset);
-
- if(segment == null)
- continue;
- if(segment instanceof JavaMemberELSegment){
+ if(segment != null && segment instanceof JavaMemberELSegment &&
segment.isResolved()) {
JavaMemberELSegment javaSegment = (JavaMemberELSegment)segment;
- if(javaSegment.isResolved()){
- IJavaElement segmentJavaElement = javaSegment.getJavaElement();
- if(segmentJavaElement.equals(javaElement))
- match(file, offset, length);
- }
+ IJavaElement segmentJavaElement = javaSegment.getJavaElement();
+ if(javaElement.equals(segmentJavaElement))
+ match(file, offset, length);
}
}
}