Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Call Arrange All (Arrange Selection) when creating an edge
Call Arrange All (Arrange Selection) when creating an edge [message #1775003] Mon, 23 October 2017 12:03
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 121
Registered: January 2016
Senior Member
Hi,

I have a query to call Arrange All (Arrange Selection) when creating an edge. I need to call Arrange All (Arrange Selection) when creating an edge between nodes.

I tried two ways:

1. Register NodeListener to DiagramEditPart

// node listener
getDiagramEditPart().addNodeListener(new NodeListener() {

  @Override
    public void targetConnectionAdded(ConnectionEditPart arg0, int arg1) {
      // call Arrange Selection
    }	
    ...
});


but for some reason the targetConnectionAdded method does not call at all when creating an edge.

2. Add External Java Action to Create Edge in VSM (odesign), see picture.

And the implementation of IExternalJavaAction that calls Arrange All.

public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
	if (selections == null || selections.isEmpty()) {
		return;
	}

	IEditorPart editor = EclipseUIUtil.getActiveEditor();

	if (editor instanceof DiagramEditor) {
		DiagramEditor diagramEditor = (DiagramEditor) editor;
		DiagramEditPart diagramEditPart = diagramEditor.getDiagramEditPart();
			
		ArrangeRequest arrangeRequest = new ArrangeRequest(ActionIds.ACTION_ARRANGE_ALL);
		List<Object> partsToArrange = new ArrayList<>(1);
		partsToArrange.add(diagramEditPart);
		arrangeRequest.setPartsToArrange(partsToArrange);
		diagramEditPart.performRequest(arrangeRequest);

		Command command = diagramEditPart.getCommand(arrangeRequest);
		if (command != null) {
			command.execute();
		}
	}
}


This works, but only for already created edges (existing in the diagram), not for the edge that is being created in the diagram.

But I need Arrange Selection to get on the edge that is being created.

I would say the problem is that GMF (Sirius) does not yet have an updated context on the new edge "does not know" when creating an edge.

Is there an option to call Arrange Selection on the edge that is being created?

Thanks for every advice.

Martin
  • Attachment: odesign.png
    (Size: 47.77KB, Downloaded 70 times)

[Updated on: Mon, 23 October 2017 12:06]

Report message to a moderator

Previous Topic:Tabs names in the Properties View occupies a large part of the content
Next Topic:Label expression with condition
Goto Forum:
  


Current Time: Sun Mar 29 19:44:13 GMT 2020

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

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

Back to the top