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.
class org.openide.explorer.view.DragDropUtilities has methods createCustomCursor and createBufferedImage that are used to create custom cursor image for drag'n'drop operations. the source code of these two methods is duplicated in classes org.openide.awt.Toolbar and org.netbeans.core.windows.view.dnd.TopComponentDragSupport. making class DragDropUtilities and its method createCustomCursor public will simplify the code of the other two classes. see the attached diff.
Created attachment 19949 [details] DragDropUtilities
Created attachment 19950 [details] Toolbar
Created attachment 19951 [details] TopComponentDragSupport
sounds good. OTOH createBufferedImage is already a copy from (package private class) o.o.util.IconManager. Shouldn't it be exposed somewhere in utilities?
Maybe rename to DragAndDropUtilities. I agree that this is a poor place for createBufferedImage.
What about new class o.o.awt.Utilities? With these two methods as initiation. Else handy place is o.o.util.Utilities.
We cannot use org.openide.explorer.* as openide/loaders does not yet depend on it and the reason why the diff compiles is due to the fact that openide.jar is not yet split into logical parts. Creating new class in openide/awt, would work, but I prefer yet another method addition to openide/util as there already is createProgressCursor and surprisingly also createCustomCursor, so the whole thing is just to make it public (at last it seems to me so). I've CCed pnejedly as he may know whether we still need createBufferedImage or this was just a hack for older JDKs and we can just do new BufferedImage(...); Btw. may I request some kind of test? At that the cursor has the right size?
to sum this issue up: - make public method createCustomCursor in org.openide.util.Utilities - remove duplicated code from classes: org.openide.explorer.view.DragDropUtilities, org.netbeans.core.windows.view.dnd.TopComponentDragSupport, org.openide.awt.Toolbar btw, how can i check the size of a cursor?
I do not know how to get any info about the cursor beyond the getName(), toString(), getType(). That means you will likely not be able to test for the cursor size. You may test that the WAIT_CURSOR is returned if the system does not support custom cursors instead.
done Checking in src/org/openide/explorer/view/DragDropUtilities.java; /cvs/openide/src/org/openide/explorer/view/DragDropUtilities.java,v <-- DragDropUtilities.java new revision: 1.31; previous revision: 1.30 done Checking in src/org/openide/explorer/view/ExplorerDragSupport.java; /cvs/openide/src/org/openide/explorer/view/ExplorerDragSupport.java,v <-- ExplorerDragSupport.java new revision: 1.14; previous revision: 1.13 done Processing log script arguments... More commits to come... Checking in loaders/src/org/openide/awt/Toolbar.java; /cvs/openide/loaders/src/org/openide/awt/Toolbar.java,v <-- Toolbar.java new revision: 1.24; previous revision: 1.23 done Processing log script arguments... More commits to come... Checking in src/org/openide/util/Utilities.java; /cvs/openide/src/org/openide/util/Utilities.java,v <-- Utilities.java new revision: 1.148; previous revision: 1.147 done Processing log script arguments... More commits to come... Checking in test/unit/src/org/openide/util/UtilitiesTest.java; /cvs/openide/test/unit/src/org/openide/util/UtilitiesTest.java,v <-- UtilitiesTest.java new revision: 1.3; previous revision: 1.2 done Checking in windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java; /cvs/core/windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java,v <-- TopComponentDragSupport.java new revision: 1.18; previous revision: 1.17 done
Verified.