[jbosstools-commits] JBoss Tools SVN: r17658 - in trunk/seam/plugins: org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Sep 18 07:59:51 EDT 2009


Author: dazarov
Date: 2009-09-18 07:59:51 -0400 (Fri, 18 Sep 2009)
New Revision: 17658

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.ui/src/org/jboss/tools/seam/ui/search/SeamELReferencesQueryParticipant.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4771 added search scope support

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 10:32:52 UTC (rev 17657)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java	2009-09-18 11:59:51 UTC (rev 17658)
@@ -20,8 +20,10 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
 import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
 import org.eclipse.jdt.ui.text.IJavaPartitions;
 import org.eclipse.jface.text.BadLocationException;
@@ -79,6 +81,7 @@
 	protected IFile baseFile;
 	protected String propertyName;
 	protected IJavaElement javaElement;
+	protected IJavaSearchScope searchScope;
 	
 	public SeamRefactorSearcher(IFile baseFile, String propertyName){
 		this.baseFile = baseFile;
@@ -89,6 +92,10 @@
 		this(baseFile, propertyName);
 		this.javaElement = javaElement;
 	}
+	
+	public void setSearchScope(IJavaSearchScope searchScope){
+		this.searchScope = searchScope;
+	}
 
 	public void findELReferences(){
 		if(baseFile == null)
@@ -100,6 +107,9 @@
 		for (IProject project : projects) {
 			if(project == null) continue;
 			
+			if(!containsInSearchScope(project))
+				continue;
+			
 			IJavaProject javaProject = EclipseResourceUtil.getJavaProject(project);
 			
 			// searching java, xml and property files in source folders
@@ -367,6 +377,17 @@
 		return methodName.startsWith(SET);
 	}
 	
+	private boolean containsInSearchScope(IProject project){
+		if(searchScope == null)
+			return true;
+		IPath[] paths = searchScope.enclosingProjectsAndJars();
+		for(IPath path : paths){
+			if(path.equals(project.getFullPath()))
+				return true;
+		}
+		return false;
+	}
+	
 	private void resolve(IFile file, ELExpression operand, int offset, int length){
 		ELResolver[] resolvers = ELResolverFactoryManager.getInstance().getResolvers(file);
 		

Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamELReferencesQueryParticipant.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamELReferencesQueryParticipant.java	2009-09-18 10:32:52 UTC (rev 17657)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamELReferencesQueryParticipant.java	2009-09-18 11:59:51 UTC (rev 17658)
@@ -51,6 +51,7 @@
 				String name = ELSearcher.getPropertyName(qs.getElement().getElementName());
 				
 				searcher = new ELSearcher(requestor, qs.getElement(), file, name);
+				searcher.setSearchScope(qs.getScope());
 				
 				searcher.findELReferences();
 			}
@@ -68,7 +69,7 @@
 	class ELSearcher extends SeamRefactorSearcher{
 		ISearchRequestor requestor;
 		public ELSearcher(ISearchRequestor requestor, IJavaElement element, IFile file, String name){
-			super(file, name, element);
+			super(file, name/*, element*/);
 			this.requestor = requestor;
 		}
 



More information about the jbosstools-commits mailing list