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 97949 - The DataObject has to be accessible from the related node.
Summary: The DataObject has to be accessible from the related node.
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Palette (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords:
Depends on:
Blocks: 97407
  Show dependency tree
 
Reported: 2007-03-15 11:22 UTC by Nikita Krjukov
Modified: 2008-12-22 10:53 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The XSLT project to reptoduce the defect (11.40 KB, application/octet-stream)
2007-03-15 11:25 UTC, Nikita Krjukov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Krjukov 2007-03-15 11:22:09 UTC
Before the DataObject could be got through the cookies:
 
  DataObject do = node.getCookies(DataObject.class);

But now this method doesn't work. It returns null. 
Either this approach has to be repaired or a new one has to be provided. 

The defect can be reproduced in the XSLT project. 
- Open the attached project
- Open the xsl1.xsl file 
- The XSLT editor appears
- DnD any element from the palette (Strndard NetBeans palette) to center region 
of the XSLT editor. 
- The NPE happens as described in the issue #97407
Comment 1 Nikita Krjukov 2007-03-15 11:24:13 UTC
The defect is declared as P1 because of the blocked issue 97407 has the same 
priority. It blocks almost all testing work for the XSLT editor. 
Comment 2 Nikita Krjukov 2007-03-15 11:25:31 UTC
Created attachment 39508 [details]
The XSLT project to reptoduce the defect
Comment 3 Jaroslav Tulach 2007-03-15 14:48:50 UTC
You are right that it is desirable for data object's nodes to return their 
DataObject as a cookie. However this contract is not enforced in general, only 
followed by individual implementation.

I am not sure what the implementation of your node is, however it is not up to 
me, it is up to you to find that out. Unless the node is directly 
org.openide.loaders.DataNode, this issue is invalid for openide/loader. It may 
be valid for some other module, however from the point of the general 
infrastructure I close it as invalid.

Free free to reassign to other module and reopen.
Comment 4 Nikita Krjukov 2007-03-19 18:32:24 UTC
I suppose the Common Palette is the most suitable module. 

Because the palette item node used to return the DataObject from the cookies 
before (5.5.1 branch), I supposed that it was provided by a base class. But 
now, as Jaroslav sad , it is a decision of the specific node implementation.

Actually it doesn't matter for me what way I can get the DataObject. But I'd 
like to get it someway. :-)
Maybe you can put it in cookies directly in the implementation of your 
PaletteItemNode?
Or maybe you can provide another way to get it?

I've analysed the code a bit and have found that objects available from cookies 
are only those which are specified there: 
  org.netbeans.modules.palette.PaletteEnvironmentProvider
  private PaletteItemNode createPaletteItemNode(PaletteItemHandler handler) {
  line: 156

Also I have tried to find usage of the method 
  org.netbeans.spi.palette.PaletteFactory
  public static PaletteController createPalette( 
       String rootFolderName, 
       PaletteActions customActions,
       PaletteFilter filter,
       DragAndDropHandler dndHandler ) 

It seems this method isn't covered by any test.
It only is used by my code and also probably by the 
  org.netbeans.modules.vmd.palette.PaletteKit
   private class DNDHandler extends DragAndDropHandler {
   line 362
  
Comment 5 Stanislav Aubrecht 2007-03-20 11:22:29 UTC
fixed in trunk

/cvs/core/palette/src/org/netbeans/modules/palette/PaletteItemNode.java,v  <-- 
PaletteItemNode.java
new revision: 1.14; previous revision: 1.13