Author: dazarov
Date: 2009-06-30 06:05:39 -0400 (Tue, 30 Jun 2009)
New Revision: 16278
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1077
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java 2009-06-30
09:41:11 UTC (rev 16277)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreMessages.java 2009-06-30
10:05:39 UTC (rev 16278)
@@ -49,4 +49,6 @@
public static String SEAM_RENAME_PROCESSOR_OUT_OF_SYNC_FILE;
public static String SEAM_RENAME_PROCESSOR_ERROR_PHANTOM_FILE;
public static String SEAM_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE;
+ public static String SEAM_RENAME_PROCESSOR_LOCATION_NOT_FOUND;
+ public static String SEAM_RENAME_PROCESSOR_DECLARATION_NOT_FOUND;
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties 2009-06-30
09:41:11 UTC (rev 16277)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/messages.properties 2009-06-30
10:05:39 UTC (rev 16278)
@@ -34,7 +34,9 @@
RENAME_SEAM_CONTEXT_VARIABLE_PROCESSOR_TITLE=Rename Seam Context Variable
RENAME_SEAM_CONTEXT_VARIABLE_PROCESSOR_CAN_NOT_FIND_CONTEXT_VARIABLE=Can not find Seam
Context Variable: ''{0}''.
SEAM_RENAME_PROCESSOR_COMPONENT_HAS_DECLARATION_FROM_JAR=Component
''{0}'' has a declaration which is located in jar file:
''{1}''. Press next to force rename.
-SEAM_RENAME_PROCESSOR_OUT_OF_SYNC_FILE=File ''{0}'' is not in sync. Press
next to force rename.
+SEAM_RENAME_PROCESSOR_OUT_OF_SYNC_FILE=Cannot change file. File ''{0}''
is not in sync.
+SEAM_RENAME_PROCESSOR_LOCATION_NOT_FOUND=Location for declaration or annotation not found
in file: ''{0}''
+SEAM_RENAME_PROCESSOR_DECLARATION_NOT_FOUND=Component: ''{0}'' does not
have any declarations
SEAM_RENAME_PROCESSOR_ERROR_PHANTOM_FILE=Cannot change phantom file:
''{0}''.
SEAM_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE=Cannot change read-only file:
''{0}''.
SEAM_INSTALL_WIZARD_PROJECT_NAME_WITH_UPPERCASE=Project names which start with a capital
letter may break Seam/JSF applications; use lower case.
\ No newline at end of file
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-06-30
09:41:11 UTC (rev 16277)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/SeamRenameProcessor.java 2009-06-30
10:05:39 UTC (rev 16278)
@@ -154,8 +154,10 @@
}
protected void findAnnotations(){
- if(declarationFile == null)
+ if(declarationFile == null){
+ status.addFatalError(Messages.format(SeamCoreMessages.SEAM_RENAME_PROCESSOR_DECLARATION_NOT_FOUND,
getOldName()));
return;
+ }
ISeamProject seamProject = SeamCorePlugin.getSeamProject(declarationFile.getProject(),
true);
@@ -217,12 +219,15 @@
}
}
- private boolean isBadLocation(ITextSourceReference location){
- return location.getStartPosition() == 0 && location.getLength() == 0;
+ private boolean isBadLocation(ITextSourceReference location, IFile file){
+ boolean flag = location.getStartPosition() == 0 && location.getLength() == 0;
+ if(flag)
+ status.addFatalError(Messages.format(SeamCoreMessages.SEAM_RENAME_PROCESSOR_LOCATION_NOT_FOUND,
file.getFullPath().toString()));
+ return flag;
}
private void changeXMLNode(ITextSourceReference location, IFile file){
- if(isBadLocation(location))
+ if(isBadLocation(location, file))
return;
if(!isFileCorrect(file))
@@ -249,7 +254,7 @@
}
private void changeAnnotation(ITextSourceReference location, IFile file){
- if(isBadLocation(location))
+ if(isBadLocation(location, file))
return;
if(!isFileCorrect(file))
@@ -336,7 +341,7 @@
if(file != null && !coreHelper.isJar(javaDecl)){
ITextSourceReference location =
((SeamComponentDeclaration)javaDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
- if(location != null && !isBadLocation(location))
+ if(location != null && !isBadLocation(location, file))
change(file, location.getStartPosition(), location.getLength(),
"\""+getNewName()+"\""); //$NON-NLS-1$ //$NON-NLS-2$
}
declarationFile = file;
@@ -347,7 +352,7 @@
if(file != null && !coreHelper.isJar(xmlDecl)){
ITextSourceReference location =
((SeamComponentDeclaration)xmlDecl).getLocationFor(ISeamXmlComponentDeclaration.NAME);
- if(location != null && !isBadLocation(location))
+ if(location != null && !isBadLocation(location, file))
changeXMLNode(location, file);
}
if(declarationFile == null)