Author: dazarov
Date: 2009-10-08 10:26:28 -0400 (Thu, 08 Oct 2009)
New Revision: 17978
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.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.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/search/ELSearchQuery.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,
https://jira.jboss.org/jira/browse/JBIDE-4856
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-08
13:23:21 UTC (rev 17977)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-10-08
14:26:28 UTC (rev 17978)
@@ -273,6 +273,8 @@
// looking for component references in EL
private void scanString(IFile file, String string, int offset) {
int startEl = string.indexOf("#{"); //$NON-NLS-1$
+ if(startEl<0)
+ startEl = string.indexOf("${"); //$NON-NLS-1$
if(startEl>-1) {
ELParser parser = ELParserUtil.getJbossFactory().createParser();
ELModel model = parser.parse(string);
@@ -280,7 +282,6 @@
for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
ELInvocationExpression expression = findComponentReference(ie);
if(expression != null){
- //ELInvocationExpression left = expression.getLeft();
checkMatch(file, expression, getOffset(expression), offset+getOffset(expression),
getLength(expression));
}
}
@@ -344,7 +345,7 @@
key = false;
if(key && token.startsWith(propertyName)){
- match(file, offset, token.length(), true);
+ match(file, offset, token.length());
}
}
@@ -372,13 +373,13 @@
protected abstract boolean isFileCorrect(IFile file);
- protected abstract void match(IFile file, int offset, int length, boolean resolved);
+ protected abstract void match(IFile file, int offset, int length);
- private void checkMatch(IFile file, ELExpression operand, int leftOffset, int offset,
int length){
+ private void checkMatch(IFile file, ELExpression operand, int localOffset, int offset,
int length){
if(javaElement != null && operand != null)
- resolve(file, operand, leftOffset, offset, length);
+ resolve(file, operand, localOffset, offset, length);
else
- match(file, offset, length, true);
+ match(file, offset, length);
}
public static String getPropertyName(String methodName){
@@ -450,11 +451,10 @@
JavaMemberELSegment javaSegment = (JavaMemberELSegment) segment;
IJavaElement segmentJavaElement = javaSegment.getJavaElement();
if (javaElement.equals(segmentJavaElement)){
- match(file, offset, length, true);
+ match(file, offset, length);
return;
}
}
}
- match(file, offset, length, false);
}
}
\ No newline at end of file
Modified:
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java 2009-10-08
13:23:21 UTC (rev 17977)
+++
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java 2009-10-08
14:26:28 UTC (rev 17978)
@@ -45,7 +45,6 @@
private CompositeChange rootChange;
private TextFileChange lastChange;
private ArrayList<String> keys = new ArrayList<String>();
- private boolean resolved = true;
private static boolean added = false;
@@ -67,8 +66,7 @@
searcher.findELReferences();
// TODO: find good phrase and externalize it
- if(!resolved)
- status.addWarning("Some changes were not resolved.");
+ //status.addWarning("Some cases may not be found.");
return status;
}
@@ -178,10 +176,8 @@
}
@Override
- protected void match(IFile file, int offset, int length, boolean resolved) {
+ protected void match(IFile file, int offset, int length) {
change(file, offset, length, newName);
- if(!resolved)
- RenameMethodParticipant.this.resolved = false;
}
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java 2009-10-08
13:23:21 UTC (rev 17977)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java 2009-10-08
14:26:28 UTC (rev 17978)
@@ -46,7 +46,6 @@
private CompositeChange rootChange;
private TextFileChange lastChange;
private ArrayList<String> keys = new ArrayList<String>();
- private boolean resolved = true;
private static boolean added = false;
@@ -68,8 +67,7 @@
searcher.findELReferences();
// TODO: find good phrase and externalize it
- if(!resolved)
- status.addWarning("Some changes were not resolved.");
+ //status.addWarning("Some changes were not resolved.");
return status;
}
@@ -185,10 +183,8 @@
}
@Override
- protected void match(IFile file, int offset, int length, boolean resolved) {
+ protected void match(IFile file, int offset, int length) {
change(file, offset, length, newName);
- if(!resolved)
- SeamRenameMethodParticipant.this.resolved = false;
}
}
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-08
13:23:21 UTC (rev 17977)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-10-08
14:26:28 UTC (rev 17978)
@@ -453,7 +453,7 @@
}
@Override
- protected void match(IFile file, int offset, int length, boolean resolved) {
+ protected void match(IFile file, int offset, int length) {
change(file, offset, length, newName);
}
Modified:
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-08
13:23:21 UTC (rev 17977)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java 2009-10-08
14:26:28 UTC (rev 17978)
@@ -101,7 +101,7 @@
}
@Override
- protected void match(IFile file, int offset, int length, boolean resolved) {
+ protected void match(IFile file, int offset, int length) {
Match match = new Match(file, offset, length);
result.addMatch(match);
}
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-10-08
13:23:21 UTC (rev 17977)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamELReferencesQueryParticipant.java 2009-10-08
14:26:28 UTC (rev 17978)
@@ -25,15 +25,8 @@
import org.eclipse.jdt.ui.search.ISearchRequestor;
import org.eclipse.jdt.ui.search.QuerySpecification;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.search.internal.ui.util.FileLabelProvider;
-import org.eclipse.search.ui.text.AbstractTextSearchViewPage;
import org.eclipse.search.ui.text.Match;
-import org.eclipse.search2.internal.ui.SearchView;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.Workbench;
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;
@@ -42,7 +35,6 @@
public class SeamELReferencesQueryParticipant implements IQueryParticipant,
IMatchPresentation{
private ELSearcher searcher;
- private ELLabelProvider labelProvider;
JavaSearchResultPage searchPage = null;
public int estimateTicks(QuerySpecification specification) {
@@ -72,84 +64,13 @@
}
public ILabelProvider createLabelProvider() {
- if(labelProvider == null){
- if(searchPage == null){
- IWorkbenchWindow[] windows = Workbench.getInstance().getWorkbenchWindows();
- for(IWorkbenchWindow window : windows){
- IWorkbenchPage[] pages = window.getPages();
- for(IWorkbenchPage page : pages){
- SearchView view =
(SearchView)page.findView("org.eclipse.search.ui.views.SearchView");
- if(view.getActivePage() instanceof JavaSearchResultPage){
- searchPage = (JavaSearchResultPage)view.getActivePage();
- }
- }
- }
- }
- labelProvider = new ELLabelProvider(searchPage);
- }
-
- return labelProvider;
+ return null;
}
public void showMatch(Match match, int currentOffset,
int currentLength, boolean activate) throws PartInitException {
- if(searchPage != null && match.getElement() instanceof FileWrapper){
- FileWrapper wrapper = (FileWrapper)match.getElement();
- Match nMatch = new Match(wrapper.getFile(), match.getOffset(), match.getLength());
- searchPage.showMatch(nMatch, match.getOffset(), match.getLength(), activate);
- }
}
- class FileWrapper{
- IFile file;
- boolean resolved;
- public FileWrapper(IFile file, boolean resolved) {
- this.file = file;
- this.resolved = resolved;
- }
-
- public IFile getFile(){
- return file;
- }
-
- public boolean isResolved(){
- return resolved;
- }
-
- }
-
- class ELLabelProvider extends SeamSearchViewLabelProvider{
-
-
- public ELLabelProvider(AbstractTextSearchViewPage page) {
- super(page, FileLabelProvider.SHOW_PATH_LABEL);
- }
-
- @Override
- public String getText(Object element) {
- if(element instanceof FileWrapper){
- FileWrapper wrapper = (FileWrapper)element;
- IFile file = wrapper.getFile();
- String text = super.getText(file);
- if(!wrapper.isResolved())
- // TODO: find good phrase and externalize it
- text += " (not resolved)";
- return text;
- }
- return super.getText(element);
- }
-
- @Override
- public Image getImage(Object element) {
- if(element instanceof FileWrapper){
- FileWrapper wrapper = (FileWrapper)element;
- IFile file = wrapper.getFile();
- return super.getImage(file);
- }
- return super.getImage(element);
- }
- }
-
class ELSearcher extends RefactorSearcher{
ISearchRequestor requestor;
SeamProjectsSet projectsSet;
@@ -186,14 +107,9 @@
}
@Override
- protected void match(IFile file, int offset, int length, boolean resolved) {
- if(resolved){
- Match match = new Match(file, offset, length);
- requestor.reportMatch(match);
- }else{
- Match match = new Match(new FileWrapper(file, resolved), offset, length);
- requestor.reportMatch(match);
- }
+ protected void match(IFile file, int offset, int length) {
+ Match match = new Match(file, offset, length);
+ requestor.reportMatch(match);
}
protected ELInvocationExpression findComponentReference(ELInvocationExpression
invocationExpression){