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 87275 - Code is generated for unnamed elements if preferences were changed
Summary: Code is generated for unnamed elements if preferences were changed
Status: VERIFIED FIXED
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Craig Conover
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-17 10:18 UTC by Alexandr Scherbatiy
Modified: 2007-10-19 21:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
ClassCastException in IDE log file (18.04 KB, text/plain)
2006-10-17 10:19 UTC, Alexandr Scherbatiy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Scherbatiy 2006-10-17 10:18:09 UTC
Java code is not generated for 'Unnamed' elements.
(see issue 87140)
Nevertheless the java code is generated for unnamed
elements when I change the default element name.
 

Steps to reproduce:

- Create a Java-Platform Model UML project
- Create a Class diagram
- Put a Class element on the diagram
  The element has 'Unnamed' name
- Generate code for the project
  Java code is not generated for the  'Unnamed' element

- Go to 'Tools|Options|Advanced Options|UML|New Project'
  Change the 'Default Element Name' from 'Unnamed' to 'NewElement'
- Put a Class element on the diagram
  The element has 'NewClass' name
- Generate code for the project
  
  Issue: Java code is generated for element with default name 'NewClass'

------------------------------------------------------------
Code Generation selected options:
  UMLProject1Sources\src

Processing element 1 of 2: Skipping element with default element name:Unnamed
Processing element 2 of 2: Class NewClass

================================
Task Successful (total time: 1 seconds)
------------------------------------------------------------


- Put a Class element on the diagram
  The element has 'NewClass' name


  The exception pops up:

ClassCastException: uml.ui.controls.drawingarea.UIStructuralDiagram 
  cannot be cast to uml.core.metamodel.core.foundation.NamedElement

 See attached IDE log file.
Comment 1 Alexandr Scherbatiy 2006-10-17 10:19:14 UTC
Created attachment 35271 [details]
ClassCastException in IDE log file
Comment 2 Alexandr Scherbatiy 2006-10-17 11:04:40 UTC
I have created a separate issue 87285 for the exception:
[Issue 87285]  Right-click on diagram throws ClassCastException
Comment 3 Craig Conover 2006-10-17 19:22:10 UTC
I've made some changes to make this more dynamic to reflect the latest
preference setting without restarting the IDE. I was reading the pref value once
and caching for the entire NB session (as is done for many prefs) but now the
Default Element Name pref is fetched everytime so it will pick up changes made
immediately.

This is both good and bad. If you create an element and don't rename it and
leave it as "Unnamed", then you will not be able to Gen Code for it. If you
change the pref to "NewElement" or anything else, then any element that is still
named "Unnamed" will now get code generated for it because "Unnamed" is no
longer the Default Element Name. We can't keep a list of default element names
so this is how it will work.

If you change the preference, then you are responsible for renaming any
"unnamed" elements to use the new default element name, if you wish them to
remain in "stealth" mode.

ClassCastException is fixed as well.
Comment 4 Alexandr Scherbatiy 2006-10-18 12:36:10 UTC
verified