Author: dazarov
Date: 2009-04-23 07:14:08 -0400 (Thu, 23 Apr 2009)
New Revision: 14860
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.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
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-04-23
09:45:10 UTC (rev 14859)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/RenameComponentProcessor.java 2009-04-23
11:14:08 UTC (rev 14860)
@@ -107,23 +107,23 @@
private IFile file=null;
private ISeamComponent component;
private String newName;
- private ISeamProject seamProject;
+ //private ISeamProject seamProject;
/**
* @param component Renamed component
*/
- public RenameComponentProcessor(IFile file) {
+ public RenameComponentProcessor(ISeamComponent component) {
super();
- this.file = file;
- IProject project = file.getProject();
- seamProject = SeamCorePlugin.getSeamProject(project, true);
- if (seamProject != null) {
- Set<ISeamComponent> components =
seamProject.getComponentsByPath(file.getFullPath());
- if (components.size() > 0) {
- // This is a component which we want to rename.
- component = components.iterator().next();
- }
- }
+ this.component = component;
+// IProject project = file.getProject();
+// ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+// if (seamProject != null) {
+// Set<ISeamComponent> components =
seamProject.getComponentsByPath(file.getFullPath());
+// if (components.size() > 0) {
+// // This is a component which we want to rename.
+// component = components.iterator().next();
+// }
+// }
}
public ISeamComponent getComponent() {
@@ -341,7 +341,7 @@
}
private void renameJavaDeclaration(ISeamJavaComponentDeclaration javaDecl) throws
CoreException{
- IFile file = (IFile)javaDecl.getResource();
+ file = (IFile)javaDecl.getResource();
if(file != null){
IAnnotation annotation = getNameAnnotation(file);
if(annotation != null){
@@ -356,7 +356,7 @@
}
private void renameXMLDeclaration(ISeamXmlComponentDeclaration xmlDecl){
- IFile file = (IFile)xmlDecl.getResource();
+ file = (IFile)xmlDecl.getResource();
if(file != null){
ISeamTextSourceReference location =
((SeamComponentDeclaration)xmlDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
@@ -628,7 +628,7 @@
findDeclarations();
- findAnnotations();
+ //findAnnotations();
findELReferences();
@@ -636,18 +636,18 @@
return rootChange;
}
- private void findAnnotations(){
- Set<ISeamContextVariable> variables =
seamProject.getVariablesByName(component.getName());
-
- Iterator<ISeamContextVariable> iter = variables.iterator();
- while(iter.hasNext()){
- ISeamContextVariable var = iter.next();
- System.out.println("var - "+var.getClass());
- if(var instanceof BijectedAttribute){
- System.out.println("Bijected...");
- }
- }
- }
+// private void findAnnotations(){
+// Set<ISeamContextVariable> variables =
seamProject.getVariablesByName(component.getName());
+//
+// Iterator<ISeamContextVariable> iter = variables.iterator();
+// while(iter.hasNext()){
+// ISeamContextVariable var = iter.next();
+// System.out.println("var - "+var.getClass());
+// if(var instanceof BijectedAttribute){
+// System.out.println("Bijected...");
+// }
+// }
+// }
/*
* (non-Javadoc)
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java 2009-04-23
09:45:10 UTC (rev 14859)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/refactoring/SeamComponentRenameHandler.java 2009-04-23
11:14:08 UTC (rev 14860)
@@ -10,16 +10,22 @@
******************************************************************************/
package org.jboss.tools.seam.ui.refactoring;
+import java.util.Set;
+
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
import org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamProject;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.refactoring.RenameComponentProcessor;
import org.jboss.tools.seam.internal.core.refactoring.RenameComponentRefactoring;
import org.jboss.tools.seam.ui.wizard.RenameComponentWizard;
@@ -43,9 +49,20 @@
if (input instanceof IFileEditorInput) {
IFile file = ((IFileEditorInput)input).getFile();
Shell activeShell = HandlerUtil.getActiveShell(event);
- RenameComponentProcessor processor = new RenameComponentProcessor(file);
+
+ IProject project = file.getProject();
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ ISeamComponent component=null;
+ if (seamProject != null) {
+ Set<ISeamComponent> components =
seamProject.getComponentsByPath(file.getFullPath());
+ if (components.size() > 0) {
+ // This is a component which we want to rename.
+ component = components.iterator().next();
+ }
+ }
+ RenameComponentProcessor processor = new RenameComponentProcessor(component);
RenameComponentRefactoring refactoring = new RenameComponentRefactoring(processor);
- RenameComponentWizard wizard = new RenameComponentWizard(refactoring,
processor.getComponent());
+ RenameComponentWizard wizard = new RenameComponentWizard(refactoring, component);
RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
try {
String titleForFailedChecks = "TestTestTest"; //$NON-NLS-1$