GEF EditingDomain versus EMF.Edit EditDomain [message #203975] |
Tue, 29 November 2005 14:46 |
Eclipse User |
|
|
|
Originally posted by: lynchjack.hotmail.com
Hi,
I posted the message below on EMF, got redirected here :-) Any ideas
welcome..
Thanks,
Jack
Within an GEF EditPolicy implementation one must return a
org.eclipse.gef.commands.Command object for the various commands. At
present I'm having to adapt EMF commands created using an
AdapterFactoryEditingDomain using something like the following
protected Command getCreateCommand(CreateRequest request) {
SOANetwork network = (SOANetwork)getHost().getModel();
Service service = (Service)request.getNewObject();
final EditingDomain domain =
AdapterFactoryEditingDomain.getEditingDomainFor(network);
final org.eclipse.emf.common.command.Command c = AddCommand.create(
domain, network,
SOA_NetworkPackage.eINSTANCE.getSOANetwork_Participants(),
Collections.singleton(service)
);
return new Command() {
public void execute() {
domain.getCommandStack().execute(c);
}
};
}
Firstl, I get the feeling that I'm doing the wrong thing here (executing emf
command within GEF one) as until now using both frameworks has felt more
intuitive. Am I misssing something (a provided adapter somewhere)?
Secondly when providing support for undo, redo etc.. there are 2 possible
command stacks to use, GraphicalEditorWithFlyoutPalette takes a
DefaultEditingDomain, EMF has one in its EditDomain. Is is standard
practice to share them, i.e. supply the EMF stack to the constructotr of
DefaultEditingDomain?
|
|
|
Powered by
FUDForum. Page generated in 0.03107 seconds