Author: dazarov
Date: 2009-10-09 10:50:27 -0400 (Fri, 09 Oct 2009)
New Revision: 18010
Removed:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindUsagesInELAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchResult.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java
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/SeamRenameProcessor.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4856,
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/refactoring/RefactorSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -288,7 +288,7 @@
}
}
- private int getOffset(ELInvocationExpression expression){
+ protected int getOffset(ELInvocationExpression expression){
if(expression instanceof ELPropertyInvocation){
ELPropertyInvocation pi = (ELPropertyInvocation)expression;
@@ -361,7 +361,7 @@
protected abstract void match(IFile file, int offset, int length);
- private void checkMatch(IFile file, ELExpression operand, int offset, int length){
+ protected void checkMatch(IFile file, ELExpression operand, int offset, int length){
if(javaElement != null && operand != null)
resolve(file, operand, offset-getOffset((ELInvocationExpression)operand));
else
@@ -395,7 +395,7 @@
return false;
}
- private void resolve(IFile file, ELExpression operand, int offset) {
+ protected void resolve(IFile file, ELExpression operand, int offset) {
ELResolver[] resolvers = ELResolverFactoryManager.getInstance()
.getResolvers(file);
@@ -420,16 +420,6 @@
for(ELSegment segment : segments){
match(file, offset+segment.getSourceReference().getStartPosition(),
segment.getSourceReference().getLength());
}
-
-// if (segment != null && segment instanceof JavaMemberELSegment
-// && segment.isResolved()) {
-// JavaMemberELSegment javaSegment = (JavaMemberELSegment) segment;
-// IJavaElement segmentJavaElement = javaSegment.getJavaElement();
-// if (javaElement.equals(segmentJavaElement)){
-// match(file, offset, length);
-// return;
-// }
-// }
}
}
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolution.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -37,6 +37,13 @@
ELContext getContext();
/**
+ * Finds the segments which are resolved to given variable.
+ * @param element
+ * @return
+ */
+ List<ELSegment> findSegmentsByVariable(IVariable variable);
+
+ /**
* Finds the segments which are resolved to given java element.
* @param element
* @return
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolutionImpl.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -31,7 +31,23 @@
protected Set<TextProposal> proposals = new HashSet<TextProposal>();
protected ELInvocationExpression lastResolvedToken;
protected boolean mapOrCollectionOrBundleAmoungTheTokens;
+
+ /* (non-Javadoc)
+ * @see
org.jboss.tools.common.el.core.resolver.ELResolution#findSegmentsByJavaElement(org.eclipse.jdt.core.IJavaElement)
+ */
+ public List<ELSegment> findSegmentsByVariable(IVariable variable) {
+ ArrayList<ELSegment> list = new ArrayList<ELSegment>();
+ for(ELSegment segment : segments){
+ for(IVariable var : segment.getVariables()){
+ if(var.getName().equals(variable.getName())){
+ list.add(segment);
+ }
+ }
+ }
+ return list;
+ }
+
/* (non-Javadoc)
* @see
org.jboss.tools.common.el.core.resolver.ELResolution#findSegmentsByJavaElement(org.eclipse.jdt.core.IJavaElement)
*/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -26,8 +26,6 @@
* @author Alexey Kazakov, Daniel Azarov
*/
public class RenameComponentProcessor extends SeamRenameProcessor {
- private ISeamComponent component;
-
/**
* @param component Renamed component
@@ -89,7 +87,6 @@
public Change createChange(IProgressMonitor pm) throws CoreException,
OperationCanceledException {
-
return rootChange;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameSeamContextVariableProcessor.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -41,7 +41,7 @@
*/
public class RenameSeamContextVariableProcessor extends SeamRenameProcessor {
IFile file;
- private ISeamComponent component;
+
/**
* @param file where refactor was called
*/
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-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -10,16 +10,30 @@
******************************************************************************/
package org.jboss.tools.seam.internal.core.refactoring;
+import java.util.List;
+
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.IJavaElement;
+import org.jboss.tools.common.el.core.model.ELExpression;
+import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
+import org.jboss.tools.common.el.core.resolver.ELCompletionEngine;
+import org.jboss.tools.common.el.core.resolver.ELResolution;
+import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.el.core.resolver.ELSegment;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.SimpleELContext;
+import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.SeamProjectsSet;
public abstract class SeamRefactorSearcher extends RefactorSearcher {
- SeamProjectsSet projectsSet;
+ private SeamProjectsSet projectsSet;
+ private ISeamComponent component;
public SeamRefactorSearcher(IFile file, String name){
super(file, name);
@@ -31,6 +45,11 @@
javaElement = element;
}
+ public SeamRefactorSearcher(IFile file, String name, ISeamComponent component){
+ this(file, name);
+ this.component = component;
+ }
+
protected IProject[] getProjects(){
return projectsSet.getAllProjects();
}
@@ -55,5 +74,43 @@
}
return true;
}
+
+ protected void checkMatch(IFile file, ELExpression operand, int offset, int length){
+ if(javaElement != null && operand != null)
+ resolve(file, operand, offset-getOffset((ELInvocationExpression)operand));
+ else if(component != null && operand != null)
+ resolveComponentsReferences(file, operand,
offset-getOffset((ELInvocationExpression)operand));
+ else
+ match(file, offset, length);
+ }
+
+ private void resolveComponentsReferences(IFile file, ELExpression operand, int offset)
{
+ 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);
+
+ context.setVars(vars);
+
+ ELResolution resolution = resolver.resolve(context, operand);
+
+ List<ELSegment> segments = resolution.findSegmentsByVariable(component);
+
+ for(ELSegment segment : segments){
+ match(file, offset+segment.getSourceReference().getStartPosition(),
segment.getSourceReference().getLength());
+ }
+ }
+ }
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -11,10 +11,8 @@
package org.jboss.tools.seam.internal.core.refactoring;
import java.util.ArrayList;
-import java.util.List;
import java.util.Set;
-import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -32,7 +30,6 @@
import org.eclipse.text.edits.TextEdit;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
import org.jboss.tools.common.model.project.ext.ITextSourceReference;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.seam.core.BijectedAttributeType;
@@ -77,6 +74,8 @@
private SeamSearcher searcher = null;
+ protected ISeamComponent component;
+
protected SeamSearcher getSearcher(){
if(searcher == null){
searcher = new SeamSearcher(declarationFile, getOldName());
@@ -444,7 +443,7 @@
class SeamSearcher extends SeamRefactorSearcher{
public SeamSearcher(IFile declarationFile, String oldName){
- super(declarationFile, oldName);
+ super(declarationFile, oldName, component);
}
@Override
@@ -458,6 +457,9 @@
}
protected ELInvocationExpression findComponentReference(ELInvocationExpression
invocationExpression){
+ if(component != null)
+ return invocationExpression;
+
ELInvocationExpression invExp = invocationExpression;
while(invExp != null){
if(invExp instanceof ELPropertyInvocation){
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindUsagesInELAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindUsagesInELAction.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/FindUsagesInELAction.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.search.SearchMessages;
-import org.eclipse.jdt.internal.ui.search.SearchUtil;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressService;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
-import org.jboss.tools.seam.ui.SeamUIMessages;
-import org.jboss.tools.seam.ui.search.ELSearchQuery;
-
-public class FindUsagesInELAction extends Action implements
IWorkbenchWindowActionDelegate, IActionDelegate2 {
- private IFile javaFile;
- private IType type;
- private IMethod method;
- private String propertyName;
-
- public FindUsagesInELAction(IFile file, IType type, IMethod method, String
propertyName){
- super(SeamUIMessages.FIND_USAGES_IN_EL);
- this.javaFile = file;
- this.type = type;
- this.method = method;
- this.propertyName = propertyName;
- }
-
- public void dispose() {
- }
-
- public void init(IWorkbenchWindow window) {
- }
-
- public void run() {
- try {
- performNewSearch();
- } catch (JavaModelException jme) {
- SeamGuiPlugin.getPluginLog().logError(jme);
- } catch (InterruptedException ie) {
- SeamGuiPlugin.getPluginLog().logError(ie);
- }
- }
-
- private void performNewSearch() throws JavaModelException, InterruptedException {
- ELSearchQuery query= createQuery();
- if (query.canRunInBackground()) {
- SearchUtil.runQueryInBackground(query);
- } else {
- IProgressService progressService= PlatformUI.getWorkbench().getProgressService();
- IStatus status= SearchUtil.runQueryInForeground(progressService, query);
- if (status.matches(IStatus.ERROR | IStatus.INFO | IStatus.WARNING)) {
- ErrorDialog.openError(getShell(), SearchMessages.Search_Error_search_title,
SearchMessages.Search_Error_search_message, status);
- }
- }
- }
-
- private ELSearchQuery createQuery() throws JavaModelException, InterruptedException {
- return new ELSearchQuery(javaFile, type, propertyName);
- }
-
- private Shell getShell() {
- return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- }
-
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
- public void init(IAction action) {
- }
-
- public void runWithEvent(IAction action, Event event) {
- }
-
- public void run(IAction action) {
- run();
- }
-
-
-}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamRefactorContributionFactory.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -25,10 +25,8 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.ui.text.FastJavaPartitionScanner;
import org.eclipse.jdt.ui.text.IJavaPartitions;
import org.eclipse.jface.action.Action;
@@ -80,7 +78,6 @@
import
org.jboss.tools.seam.internal.core.refactoring.RenameSeamContextVariableProcessor;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
-import org.jboss.tools.seam.ui.actions.FindUsagesInELAction;
import org.jboss.tools.seam.ui.wizard.RenameComponentWizard;
import org.jboss.tools.seam.ui.wizard.RenameSeamContextVariableWizard;
import org.w3c.dom.Node;
@@ -213,42 +210,6 @@
}
}
- private void checkPropertyName(TextSelection selection, MenuManager mm,
IContributionRoot additions){
- try{
- ICompilationUnit comUnit = getCompilationUnit(editorFile);
- if(comUnit != null){
- IJavaElement element = comUnit.getElementAt(selection.getOffset());
- if(element != null){
- //System.out.println("element - "+element.getClass());
- if(element instanceof IMethod){
- IMethod method = (IMethod) element;
- IType type = method.getDeclaringType();
- String propertyName = getPropertyName(method);
-
- mm.add(new FindUsagesInELAction(editorFile, type, method, propertyName));
- additions.addContributionItem(mm, null);
- }
- }
- }
- }catch(CoreException ex){
- SeamGuiPlugin.getPluginLog().logError(ex);
- }
- }
-
- private boolean checkNameAnnotation(TextSelection selection){
- IAnnotation nameAnnotation = getNameAnnotation(editorFile);
- if(nameAnnotation != null){
- try{
- ISourceRange range = nameAnnotation.getSourceRange();
- if(selection.getOffset() >= range.getOffset() &&
selection.getOffset()+selection.getLength() <= range.getOffset()+range.getLength())
- return true;
- }catch(JavaModelException ex){
- SeamCorePlugin.getPluginLog().logError(ex);
- }
- }
- return false;
- }
-
private boolean checkContextVariableInJava(IFile file, String content, TextSelection
selection){
try {
FastJavaPartitionScanner scaner = new FastJavaPartitionScanner();
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.search;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.ISearchResult;
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.common.el.core.model.ELInvocationExpression;
-import org.jboss.tools.common.el.core.model.ELMethodInvocation;
-import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
-import org.jboss.tools.seam.internal.core.refactoring.SeamRefactorSearcher;
-
-public class ELSearchQuery implements ISearchQuery {
- private String propertyName;
- private ELSearcher searcher;
-
- private ELSearchResult result;
-
- public ELSearchQuery(IFile file, IType type, String propertyName){
- this.propertyName = propertyName;
- searcher = new ELSearcher(file, propertyName);
-
- result = new ELSearchResult(this);
- }
-
- public String getPropertyName(){
- return propertyName;
- }
-
- public boolean canRerun() {
- return false;
- }
-
- public boolean canRunInBackground() {
- return true;
- }
-
- public String getLabel() {
- return "Seach for property references in Expression Language";
- }
-
- public ISearchResult getSearchResult() {
- return result;
- }
-
- public IStatus run(IProgressMonitor monitor)
- throws OperationCanceledException {
- searcher.findELReferences();
-
- return Status.OK_STATUS;
- }
-
- class ELSearcher extends SeamRefactorSearcher{
- public ELSearcher(IFile file, String name){
- super(file, name);
- }
-
- @Override
- protected void match(IFile file, int offset, int length) {
- Match match = new Match(file, offset, length);
- result.addMatch(match);
- }
-
- protected ELInvocationExpression findComponentReference(ELInvocationExpression
invocationExpression){
- ELInvocationExpression invExp = invocationExpression;
- while(invExp != null){
- if(invExp instanceof ELMethodInvocation || invExp instanceof ELPropertyInvocation){
- if(invExp.getMemberName() != null &&
invExp.getMemberName().equalsIgnoreCase(propertyName))
- return invExp;
- else
- invExp = invExp.getLeft();
- }else{
- invExp = invExp.getLeft();
- }
- }
- return null;
- }
- }
-}
Deleted:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchResult.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchResult.java 2009-10-09
13:47:29 UTC (rev 18009)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchResult.java 2009-10-09
14:50:27 UTC (rev 18010)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.seam.ui.search;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.search.internal.ui.SearchPluginImages;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.text.AbstractTextSearchResult;
-import org.eclipse.search.ui.text.IEditorMatchAdapter;
-import org.eclipse.search.ui.text.IFileMatchAdapter;
-import org.eclipse.search.ui.text.Match;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-
-public class ELSearchResult extends AbstractTextSearchResult implements
IEditorMatchAdapter, IFileMatchAdapter {
- private ELSearchQuery query;
- private final Match[] EMPTY_ARR= new Match[0];
-
- public ELSearchResult(ELSearchQuery query){
- super();
- this.query = query;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return SearchPluginImages.DESC_OBJ_TSEARCH_DPDN;
- }
-
- public String getLabel() {
- return "'"+query.getPropertyName()+"' property references in
Expression Language - "+getMatchCount()+" matches found";
- }
-
- public ISearchQuery getQuery() {
- return query;
- }
-
- public String getTooltip() {
- return getLabel();
- }
-
- @Override
- public IEditorMatchAdapter getEditorMatchAdapter() {
- return this;
- }
-
- @Override
- public IFileMatchAdapter getFileMatchAdapter() {
- return this;
- }
-
- public Match[] computeContainedMatches(AbstractTextSearchResult result,
- IEditorPart editor) {
- IEditorInput ei= editor.getEditorInput();
- if (ei instanceof IFileEditorInput) {
- IFileEditorInput fi= (IFileEditorInput) ei;
- return getMatches(fi.getFile());
- }
- return EMPTY_ARR;
- }
-
- public boolean isShownInEditor(Match match, IEditorPart editor) {
- IEditorInput ei= editor.getEditorInput();
- if (ei instanceof IFileEditorInput) {
- IFileEditorInput fi= (IFileEditorInput) ei;
- return match.getElement().equals(fi.getFile());
- }
- return false;
- }
-
- public Match[] computeContainedMatches(AbstractTextSearchResult result,
- IFile file) {
- return getMatches(file);
- }
-
- public IFile getFile(Object element) {
- if (element instanceof IFile)
- return (IFile)element;
- return null;
- }
-
-}