[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Drag and drop an EditPart
|
Hi All,
I am trying to drag an object(ServiceEditPart) with the following edit
policy:
------------------------------------------------------------------------------
protected void createEditPolicies() {
installEditPolicy(EditPolicy.COMPONENT_ROLE, new
StandardGUIAppComponentEditPolicy());
------------------------------------------------------------------------------
into a different editor altogether.
Now this particular object sits inside a section(ServiceSectionEditPart)
that has the following editpolicy:
------------------------------------------------------------------------------
protected void createEditPolicies() {
installEditPolicy(EditPolicy.LAYOUT_ROLE, new LayoutEditPolicy(){
protected EditPolicy createChildEditPolicy(EditPart child) {
// TODO Auto-generated method stub
return null;
}
protected Command getCreateCommand(CreateRequest request) {
// TODO Auto-generated method stub
Object newType = request.getNewObjectType();
if(newType == Service.class){
ServiceAddCommand singlePageCommand = new
ServiceAddCommand((Shape)request.getNewObject(),
(ServiceSection)getHost().getModel(), new Rectangle(0, 0, 80, 64));
return singlePageCommand;
}else{
return null;
}
}
protected Command getDeleteDependantCommand(Request request) {
// TODO Auto-generated method stub
return null;
}
protected Command getMoveChildrenCommand(Request request) {
// TODO Auto-generated method stub
return null;
}
});
installEditPolicy(EditPolicy.COMPONENT_ROLE, new
StandardGUIAppComponentEditPolicy());
}
------------------------------------------------------------------------------
I can assume that I require another policy:
------------------------------------------------------------------------------
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new
NonResizableEditPolicy());
------------------------------------------------------------------------------
to allow drag (Plz correct me if I am wrong).
Now I have the following questions:
1. Can I have edit-policies that allow dragging across editors?
2. If yes then which editpolicy do I use for the drag-source and the
drag-target?
Appreciate any help in this regard,
Prashanto Chatterjee