Author: dazarov
Date: 2009-10-09 06:16:59 -0400 (Fri, 09 Oct 2009)
New Revision: 17995
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
Modified:
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-4856,
https://jira.jboss.org/jira/browse/JBIDE-4771
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-09
09:15:53 UTC (rev 17994)
+++
trunk/common/plugins/org.jboss.tools.common.el.ui/src/org/jboss/tools/common/el/ui/refactoring/RenameMethodParticipant.java 2009-10-09
10:16:59 UTC (rev 17995)
@@ -40,7 +40,7 @@
private IMethod method;
private String oldName;
private String newName;
- private SeamRenameMethodSearcher searcher;
+ private RenameMethodSearcher searcher;
private RefactoringStatus status;
private CompositeChange rootChange;
private TextFileChange lastChange;
@@ -93,7 +93,7 @@
oldName = method.getElementName();
newName = getArguments().getNewName();
- searcher = new SeamRenameMethodSearcher((IFile)method.getResource(), oldName);
+ searcher = new RenameMethodSearcher((IFile)method.getResource(), oldName);
added = false;
return true;
}
@@ -130,8 +130,8 @@
}
}
- class SeamRenameMethodSearcher extends RefactorSearcher{
- public SeamRenameMethodSearcher(IFile file, String name){
+ class RenameMethodSearcher extends RefactorSearcher{
+ public RenameMethodSearcher(IFile file, String name){
super(file, name, method);
}
Added:
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
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java 2009-10-09
10:16:59 UTC (rev 17995)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.internal.core.refactoring;
+
+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.refactoring.RefactorSearcher;
+import org.jboss.tools.seam.core.SeamProjectsSet;
+
+public abstract class SeamRefactorSearcher extends RefactorSearcher {
+ SeamProjectsSet projectsSet;
+
+ public SeamRefactorSearcher(IFile file, String name){
+ super(file, name);
+ projectsSet = new SeamProjectsSet(file.getProject());
+ }
+
+ public SeamRefactorSearcher(IFile file, String name, IJavaElement element){
+ this(file, name);
+ javaElement = element;
+ }
+
+ protected IProject[] getProjects(){
+ return projectsSet.getAllProjects();
+ }
+
+ protected IContainer getViewFolder(IProject project){
+ if(project.equals(projectsSet.getWarProject()))
+ return projectsSet.getDefaultViewsFolder();
+ else if(project.equals(projectsSet.getEarProject()))
+ return projectsSet.getDefaultEarViewsFolder();
+
+ return null;
+ }
+
+ @Override
+ protected boolean isFileCorrect(IFile file){
+ if(!file.isSynchronized(IResource.DEPTH_ZERO)){
+ return false;
+ }else if(file.isPhantom()){
+ return false;
+ }else if(file.isReadOnly()){
+ return false;
+ }
+ return true;
+ }
+
+}
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRefactorSearcher.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-09
09:15:53 UTC (rev 17994)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameMethodParticipant.java 2009-10-09
10:16:59 UTC (rev 17995)
@@ -121,7 +121,6 @@
}
private void change(IFile file, int offset, int length, String text){
- //System.out.println("change file - "+file.getFullPath()+" offset -
"+offset+" len - "+length+" text <"+text+">");
String key = file.getFullPath().toString()+" "+offset;
if(!keys.contains(key)){
TextFileChange change = getChange(file);
@@ -131,12 +130,9 @@
}
}
- class SeamRenameMethodSearcher extends RefactorSearcher{
- SeamProjectsSet projectsSet;
-
+ class SeamRenameMethodSearcher extends SeamRefactorSearcher{
public SeamRenameMethodSearcher(IFile file, String name){
super(file, name, method);
- projectsSet = new SeamProjectsSet(file.getProject());
}
@Override
@@ -153,34 +149,6 @@
}
return true;
}
-
- protected IProject[] getProjects(){
- return projectsSet.getAllProjects();
- }
-
- protected IContainer getViewFolder(IProject project){
- if(project.equals(projectsSet.getWarProject()))
- return projectsSet.getDefaultViewsFolder();
- else if(project.equals(projectsSet.getEarProject()))
- return projectsSet.getDefaultEarViewsFolder();
-
- return null;
- }
-
-// protected ELInvocationExpression findComponentReference(ELInvocationExpression
invocationExpression){
-// ELInvocationExpression invExp = invocationExpression;
-// while(invExp != null){
-// if(invExp instanceof ELMethodInvocation || invExp instanceof
ELPropertyInvocation){
-// if(invExp.getMemberName() != null &&
invExp.getMemberName().equals(propertyName))
-// return invExp;
-// else
-// invExp = invExp.getLeft();
-// }else{
-// invExp = invExp.getLeft();
-// }
-// }
-// return null;
-// }
@Override
protected void match(IFile file, int offset, int length) {
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
09:15:53 UTC (rev 17994)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-10-09
10:16:59 UTC (rev 17995)
@@ -442,11 +442,9 @@
}
}
- class SeamSearcher extends RefactorSearcher{
- SeamProjectsSet projectsSet;
+ class SeamSearcher extends SeamRefactorSearcher{
public SeamSearcher(IFile declarationFile, String oldName){
super(declarationFile, oldName);
- projectsSet = new SeamProjectsSet(declarationFile.getProject());
}
@Override
@@ -459,10 +457,6 @@
change(file, offset, length, newName);
}
- protected IProject[] getProjects(){
- return projectsSet.getAllProjects();
- }
-
protected ELInvocationExpression findComponentReference(ELInvocationExpression
invocationExpression){
ELInvocationExpression invExp = invocationExpression;
while(invExp != null){
@@ -479,13 +473,5 @@
return null;
}
- protected IContainer getViewFolder(IProject project){
- if(project.equals(projectsSet.getWarProject()))
- return projectsSet.getDefaultViewsFolder();
- else if(project.equals(projectsSet.getEarProject()))
- return projectsSet.getDefaultEarViewsFolder();
-
- return null;
- }
}
}
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-09
09:15:53 UTC (rev 17994)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/ELSearchQuery.java 2009-10-09
10:16:59 UTC (rev 17995)
@@ -10,9 +10,7 @@
******************************************************************************/
package org.jboss.tools.seam.ui.search;
-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.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -25,8 +23,7 @@
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.common.el.core.refactoring.RefactorSearcher;
-import org.jboss.tools.seam.core.SeamProjectsSet;
+import org.jboss.tools.seam.internal.core.refactoring.SeamRefactorSearcher;
public class ELSearchQuery implements ISearchQuery {
private String propertyName;
@@ -68,39 +65,12 @@
return Status.OK_STATUS;
}
- class ELSearcher extends RefactorSearcher{
- SeamProjectsSet projectsSet;
+ class ELSearcher extends SeamRefactorSearcher{
public ELSearcher(IFile file, String name){
super(file, name);
- projectsSet = new SeamProjectsSet(file.getProject());
}
@Override
- protected boolean isFileCorrect(IFile file){
- if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- return false;
- }else if(file.isPhantom()){
- return false;
- }else if(file.isReadOnly()){
- return false;
- }
- return true;
- }
-
- protected IProject[] getProjects(){
- return projectsSet.getAllProjects();
- }
-
- protected IContainer getViewFolder(IProject project){
- if(project.equals(projectsSet.getWarProject()))
- return projectsSet.getDefaultViewsFolder();
- else if(project.equals(projectsSet.getEarProject()))
- return projectsSet.getDefaultEarViewsFolder();
-
- return null;
- }
-
- @Override
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-09
09:15:53 UTC (rev 17994)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/search/SeamELReferencesQueryParticipant.java 2009-10-09
10:16:59 UTC (rev 17995)
@@ -32,6 +32,7 @@
import org.jboss.tools.common.el.core.model.ELPropertyInvocation;
import org.jboss.tools.common.el.core.refactoring.RefactorSearcher;
import org.jboss.tools.seam.core.SeamProjectsSet;
+import org.jboss.tools.seam.internal.core.refactoring.SeamRefactorSearcher;
public class SeamELReferencesQueryParticipant implements IQueryParticipant,
IMatchPresentation{
private ELSearcher searcher;
@@ -71,40 +72,14 @@
int currentLength, boolean activate) throws PartInitException {
}
- class ELSearcher extends RefactorSearcher{
+ class ELSearcher extends SeamRefactorSearcher{
ISearchRequestor requestor;
- SeamProjectsSet projectsSet;
public ELSearcher(ISearchRequestor requestor, IJavaElement element, IFile file, String
name){
super(file, name, element);
this.requestor = requestor;
- projectsSet = new SeamProjectsSet(file.getProject());
}
- @Override
- protected boolean isFileCorrect(IFile file){
- if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- return false;
- }else if(file.isPhantom()){
- return false;
- }else if(file.isReadOnly()){
- return false;
- }
- return true;
- }
-
- protected IProject[] getProjects(){
- return projectsSet.getAllProjects();
- }
-
- protected IContainer getViewFolder(IProject project){
- if(project.equals(projectsSet.getWarProject()))
- return projectsSet.getDefaultViewsFolder();
- else if(project.equals(projectsSet.getEarProject()))
- return projectsSet.getDefaultEarViewsFolder();
-
- return null;
- }
@Override
protected void match(IFile file, int offset, int length) {
@@ -112,19 +87,5 @@
requestor.reportMatch(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().equals(propertyName))
-// return invExp;
-// else
-// invExp = invExp.getLeft();
-// }else{
-// invExp = invExp.getLeft();
-// }
-// }
-// return null;
-// }
}
}