Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 348673

Summary: [diagram] Problem with drop action handler API
Product: z_Archived Reporter: Konstantin Komissarchik <konstantin>
Component: SapphireAssignee: Shenxue Zhou <shenxue.zhou>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 341518    

Description Konstantin Komissarchik CLA 2011-06-07 22:58:11 EDT
I ran into problems trying to implement a sample of drop action handler. It looks like drop action handlers must implement SapphireDiagramDropActionHandler, which has a newModelElement( Object ) -> IModelElement method. 

There are two problems with this:

1. The action handler's execute method isn't called.

2. The newModelElement method assumes that one drop corresponds to one element/node. In my case I am trying to drop a file that has a list of cities. One drop should produce N elements/nodes.

I believe a better approach would be to pass requisite information (what is being dropped and location of the drop) into the handler's execute method via a subclass of SapphireRenderingContext. The action handler should take on the responsibility for creating elements, node parts and positioning them on canvas. 

The problem is similar to the Add action and resolution of these should probably be done concurrently.
Comment 1 Shenxue Zhou CLA 2011-06-16 18:34:16 EDT
The drop action handler has been reworked. There is only one drop action handler per diagram page. It should use DiagramRendingContext passed into run() method to get the object to be dropped and mouse location.
Comment 2 Konstantin Komissarchik CLA 2011-06-17 14:27:02 EDT
Looks good. Closing.