Refresh Connections after command execution [message #734743] |
Sun, 09 October 2011 13:44  |
Eclipse User |
|
|
|
is there a way to repaint the connections of an editpart after a command has been executed?
i want to drag a connection between two nodes, but the source end of the connection should be delegated to a child. it's already working except that the connection source is attached to the parent and not the child until i drag some another node onto the diagram. then, the connections are showed properly. i want to repaint the connections automatically. how can i achieve this?
my custom editpolicy:
public class GoalItemSemanticEditPolicyOverride extends
GoalItemSemanticEditPolicy {
protected Command getCompleteCreateRelationshipCommand(
CreateRelationshipRequest req) {
super.getCompleteCreateRelationshipCommand(req);
if (XkaosElementTypes.GoalRefinementGoals_4013 == req.getElementType()) {
return getGEFWrapper(new GoalRefinementsCreateCommandOverride(req,
req.getSource(), req.getTarget()));
}
return null;
}
my custom command:
public class GoalRefinementsCreateCommandOverride extends
GoalRefinementGoalsCreateCommand {
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
if (!canExecute()) {
throw new ExecutionException(
"Invalid arguments in create link command"); //$NON-NLS-1$
}
if (getUncastedSource() != null && getUncastedTarget() != null) {
}
if(getUncastedSource() instanceof Goal && getUncastedTarget() instanceof Goal){
GoalRefinement gr = XkaosFactory.eINSTANCE.createGoalRefinement();
((Goal )getUncastedSource()).getRefinements().add(gr);
gr.getGoals().add((Goal) getUncastedTarget());
//TODO repaint root
}
if(getUncastedSource() instanceof Goal && getUncastedTarget() instanceof DomProperty){
GoalRefinement gr = XkaosFactory.eINSTANCE.createGoalRefinement();
((Goal )getUncastedSource()).getRefinements().add(gr);
gr.getDomproperties().add((DomProperty) getUncastedTarget());
}
}
return CommandResult.newOKCommandResult();
}
|
|
|
|
Re: Refresh Connections after command execution [message #983267 is a reply to message #735409] |
Tue, 13 November 2012 15:21  |
Eclipse User |
|
|
|
Goood Guy wrote on Tue, 11 October 2011 19:26thats how it works:
((KaosSpecificationCanonicalEditPolicy)(editpart.getParent().getEditPolicy(EditPolicyRoles.CANONICAL_ROLE))).refresh();
If I put this instruction in my code, eclipse say to me that editpart cannot be resolved... it's no visible in my code.
[Updated on: Tue, 13 November 2012 15:44] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03512 seconds