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.
Hi, im using openide 3.5 dev and ide 3.5 dev build 030410 platform windows 2000. VM 1.4.0_01. I load in memory a structure a hierarchical structure of objects (loaded from XML using jaxb) and i try to create nodes from these objects, and display then in an ExplorerPanel. Some of the nodes created can be deleted. Here a strange thing happened. First, when i try to delete a node that is originally loaded from the xml persistance the delete confirmation dialog is shown that means DeleteActionPerformer in ExplorerActions is invoked but the node is not deleted, even that the node can be destroyed and the destroy method do a proper clean of the internal structure and call the super destroy. I remarked that the object presented by this node in the internal structure is deleted but not the node itself. The strangest thing is that when i create a new node inside the hierarchy, and when i invoke the delete action, the node is deleted. It seems that delete work only with the new nodes that i create in the explorer but not the loaded ones. But the most strangest thing is that when i create a new node inside a parent and i delete the new node created, its deleted from the tree, but when i copy the parent inside another one the child node created appear again.
Hm, I can't judge from this very much. But if the destroy method on the node is called, the action is fine. The rest job is not up to the action itself. Please let me know whether the destroy method is called. And if you are able to provide the case here? Thanks
I putted some debug log messages in the destroy method and it seems that its called.
Adel, please post your code snippet, preferrably a working mini module. Otherwise it's really hard to understand what's going on here
If that method is called, then the action performer does its job fine. Problem should be at another place Did you mention you somehow overwrite that method? It could happen, if it's your node impl, you could make some mistake which results to this behaviour. I don't know, just guessing. Passing to nodes component, maybe they could point out some problems when subclassing nodes.
Created attachment 10277 [details] Ok here is the complete class node
The only difference that i see between the nodes loaded from persistance and the nodes newly created in the explorer is that the first are added using Children#setKey and the seconds are added using Children.Array#add. For the attachement sorry Trung it cant run it needs the complete objects (especially Assembly and parts objects ) to run. But i posted mostly the complete class code.
The problem is you are mixing two kind of functionality in your AssemblyChildren class. (For historical reasons the Children.Keys extend the Children.Array) Nodes you add within the explorer can be deleted because they are added using Children.Array add method. Loaded nodes can't because the setKeys() method of Children.Keys is not called with the new internal data. You have two possibilities how to implement it. 1) Let your AssemblyChildren extend the Children.Array and add all nodes using the add method or the Children.Array constructor. 2) (Recommended) Leave AsseblyChildren to be subclass of Children.Keys. Add a method refresh into it. Which would be implemented like; refresh() { keys = new ArrayList(); keys.addAll(parentAssembly.getChildAssemliesList()); keys.addAll(parentAssembly.getChildPartsList()); setKeys (keys); } when adding or removing parts and assemblies. Just rearange internal structures (i.e. remove the line crating and adding new node from addPart and addAssembly methods) and then call the refresh() method on proper children. Hope this helps.
Thanks for help Petr, the first possibility works fine, but i tried also the second (recommended one) and it seems to not yet working with objects loaded from persistance. I think the delete action doesn't work if we add a node using setKeys. I'm not sure if i can post it as a bug!
Are you sure you call setKeys after deleting the object from the internal structures? (on parent of course) I really doubt this is a bug. There are pretty many Children.Keys subclasses in the whoile NetBeans depending on this feature.
I know .. especially the fact that there are a lot of subclasses of this one .. ill try to check if its really a bug.
Hi Petr, I tested it and it seems really not working here is the modified code with added refresh method Note : i called it refresh0 since refresh exists already in Children and is final.
Created attachment 10281 [details] The modified code
Your attachement only shows implementation of Children. Are you sure you call the reresh0 after delting the object. I.e. in the node.destroy() method?
Sorry, i forget to put the method refresh0 in the destroy method. Its working fine now. Thanks
x
There was no resolution. 'INVALID' OK?
Invalid