This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 78475

Summary: Refactor renaming class in source file fails to update source file artifact under class element node
Product: uml Reporter: bugbridge <bugbridge>
Component: SynchronizationAssignee: Craig Conover <conover>
Status: CLOSED FIXED    
Severity: blocker CC: conover
Priority: P1    
Version: 5.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 78483    

Description bugbridge 2006-06-20 10:13:25 UTC
Description:
Reproduction Steps:
1) Create Java project and UML project by reverse engineering Java project
2) Create a Java class named Foo in the Java project
3) Open Foo class in editor
4) Fully expand the Foo class element in the UML project
5) In Foo Java source file, right click the class name (in source code) and
select Refactor->Rename action
6) Change name from Foo to Bar
7) Follow through with refactoring (yes to all dialogs)

Result: The Java source class for Foo is renamed to Bar and all refactoring
tasks succeed as expected. Class element node is refreshed and therefore, node
structure is collapsed. Expand fully to inspect the Source File Artifact node.
Notice that is is still pointing to Foo.java and not the new Bar.java.
Comment 1 Craig Conover 2006-06-21 19:09:02 UTC
A fix has been found. More testing before integration and the details will be
posted here on what was wrong, assuming additional testing will succeed.
Comment 2 Craig Conover 2006-06-21 21:19:32 UTC
In MetaDataRChangeListener's method handleNameChange(AttributeEvent)
(in org.netbeans.modules.uml.integration.netbeans.listeners), a call to
JavaClassUtils.findElement(String) is only passing in the "simple" name of the
element (IElement) that is needed. Even when it is found, there is a follow up
comparison of the found IElement's fully qualified name with this simple name
and so it never matches (except for default package case, perhaps) and the
return is always null. So the solution is to pass in the fully qualified name of
the element with dot delimiters. The ".java" extension must be stripped off the
end of it as well.

And now that the element is being found properly, the new class file can be
found for this class in the Java project, and set as the new source file
artifact for this element.


Files affected:

Comment 3 Craig Conover 2006-06-21 21:39:07 UTC
Files affected:
   
uml/ideintegration/src/org/netbeans/modules/uml/integration/netbeans/listeners/MetaDataRChangeListener.java
Comment 4 Alexandr Scherbatiy 2006-07-18 11:25:10 UTC
Verified in Netbeans 5.5 Dev (build 2006.07.17)