Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » safeProvides always return false when droping elements from tree
safeProvides always return false when droping elements from tree [message #44872] Mon, 11 September 2006 09:43
Eclipse UserFriend
Originally posted by: dzhpingbo.sohu.com

I want to enable tree drag and drop, I follow the instruction suggest by
Ayesha:

I think all you need to do is implement a DiagramDropTargetListener. The
getObjectsBeingDropped() method needs to return get the thing you are
dropping onto the editor. If you return EObjects in this list, for which
your graphical editor already knows how to create views for, then the
DiagramDragDropEditPolicy should work as is. Otherwise, you will have to
subclass this editpolicy as well.

You need to register your DiagramDropTargetListener in your editor class.
e.g.

protected void initializeGraphicalViewer() {
super.initializeGraphicalViewer();

/* Add a drop target listener for my drop events */

getDiagramGraphicalViewer().addDropTargetListener(myDiagramD ropTargetListene
r);
}

I also refers to logic example.
first, I register DiagramDropTargetListener in my editor class,
second, I implement a DiagramDropTargetListener. overwrite
getObjectsBeingDropped() just as logic example did,
third, I install DiagramDragDropEditPolicy in myDiagramEditPart,
but I can't drop my tree element to the editor.
I debug through the code, and found that the dropObjects request were
created, and the command was correctly returned ,but when it come to
the safeProvides method in service.class, it always returns false.
/**
* Safely calls a provider's provides() method.
*
* The provider must not be null.
*
* Returns true if there were no exceptions thrown and the provides()
method
* returns true. Returns false if an exception was thrown or the
provides()
* method returns false.
*
* An entry is added to the log if the provider threw an exception.
*
* @param provider to safely execute the provides() method
* @param operation passed into the provider's provides() method
* @return true if there were no exceptions thrown and the provides()
method
* returns true. Returns false if an exception was thrown or the
provides()
* method returns false.
*/
private static boolean safeProvides(IProvider provider, IOperation
operation) {...}

I have ActivityItemProvider, DataItemProvider,
FlowItemProvider,ProcessDiagramItemProvider,ProcessItemProvi derAdapterFactory,
but none of them works..
The provider always return true in logic example, but in my providers which
is all generated by gmf( I never change the provider code), it always return
false, what is the mostly problem? what can I do ?
Previous Topic:Plate figure of an editpart
Next Topic:Why I can't select node in my compartment to move
Goto Forum:
  


Current Time: Sun Apr 27 00:29:46 EDT 2025

Powered by FUDForum. Page generated in 0.03098 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top