[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] CompartmentChildCreateCommand & RepositionEObjectCommand

Hello,

i have a new CompartmentChildCreateCommand to create child in a compartment whereever i want. In the gmf diagram its all right, but the underlying model has another order than the view. So i want to execute a RepositionEObjectCommand after the CompartmentChildCreateCommand, but i didn't get the right elements to call new ICommandProxy(new RepositionEObjectCommand(editingDomain, label, elements, element, index)).execute(); , especially i cant get the elements and element values. Can somebody help me?

Here is the code for the CompartmentChildCreateCommand:

public class CompartmentChildCreateCommand extends CreateCommand {

int index;
TransactionalEditingDomain editingDomain;

public CompartmentChildCreateCommand (TransactionalEditingDomain editingDomain, ViewDescriptor viewDescriptor,
View containerView, int index) {
super(editingDomain, viewDescriptor, containerView);
System.out.println(index);
this.index = index;
this.editingDomain = editingDomain;
}

@SuppressWarnings("deprecation")
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {


View view =
ViewService.getInstance().createView(
viewDescriptor.getViewKind(),
viewDescriptor.getElementAdapter(),
containerView,
viewDescriptor.getSemanticHint(),
index,
viewDescriptor.isPersisted(),
viewDescriptor.getPreferencesHint());
Assert.isNotNull(view, "failed to create a view"); //$NON-NLS-1$
viewDescriptor.setView(view);

//Here should the positioning command be called, i think
//new ICommandProxy(new RepositionEObjectCommand(editingDomain, label, null, view, index)).execute();


    return CommandResult.newOKCommandResult(viewDescriptor);
}
	
}


Can somebody help me?

Thanks in advance
Jörg