Bug 78475 - Refactor renaming class in source file fails to update source file artifact under class element node
Refactor renaming class in source file fails to update source file artifact u...
Status: CLOSED FIXED
Product: uml
Classification: Unclassified
Component: Synchronization
5.x
PC Windows XP
: P1 (vote)
: 5.x
Assigned To: Craig Conover
issues@uml
:
Depends on:
Blocks: 78483
  Show dependency treegraph
 
Reported: 2006-06-20 10:13 UTC by bugbridge
Modified: 2006-08-31 02:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo