Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR to Fix 396 wrong border node creation location #455

Open
wants to merge 5 commits into
base: lre/enh/426-GMFHelper
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2021 THALES GLOBAL SERVICES and others.
* Copyright (c) 2010, 2024 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -101,7 +101,7 @@ protected Command getCreateNodeOnDiagramCommand(CreateRequest request, NodeCreat
finishingEndEndPredecessor = SequenceGraphicalHelper.getEndBefore(diag, location.y + size.height);
}

CreationUtil creationUtil = new CreationUtil(request, getDiagramCommandFactory(startingEndPredecessor, finishingEndEndPredecessor, location), getRealLocation(request), request.getSize(),
CreationUtil creationUtil = new CreationUtil(getDiagramCommandFactory(startingEndPredecessor, finishingEndEndPredecessor, location), getRealLocation(request), request.getSize(),
getHost());
result = creationUtil.getNodeCreationCommand(diagram, tool);
} else if (tool instanceof InstanceRoleCreationTool && diagram instanceof SequenceDDiagram) {
Expand All @@ -110,7 +110,7 @@ protected Command getCreateNodeOnDiagramCommand(CreateRequest request, NodeCreat
GraphicalHelper.screen2logical(location, (IGraphicalEditPart) getHost());

EObject predecessor = SequenceGraphicalHelper.getInstanceRoleBefore(diag, location.x);
CreationUtil creationUtil = new CreationUtil(request, getDiagramCommandFactory(predecessor, location), getRealLocation(request), request.getSize(), getHost());
CreationUtil creationUtil = new CreationUtil(getDiagramCommandFactory(predecessor, location), getRealLocation(request), request.getSize(), getHost());
result = creationUtil.getNodeCreationCommand(diagram, tool);
} else {
result = super.getCreateNodeOnDiagramCommand(request, tool, diagram);
Expand Down Expand Up @@ -140,7 +140,7 @@ protected Command getCreateContainerOnDiagramCommand(CreateRequest request, Cont
List<EObject> coverage = creationValidator.getCoverage();
Range expansionZone = creationValidator.getExpansionZone();

CreationUtil creationUtil = new CreationUtil(request, getDiagramCommandFactory(startingEndPredecessor, finishingEndPredecessor, coverage, getCreationRange(request)),
CreationUtil creationUtil = new CreationUtil(getDiagramCommandFactory(startingEndPredecessor, finishingEndPredecessor, coverage, getCreationRange(request)),
getRealLocation(request), getRealSize(ccdTool, request), getHost());
result = creationUtil.getContainerCreationDescription(diagram, ccdTool);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2013 THALES GLOBAL SERVICES.
* Copyright (c) 2010, 2024 THALES GLOBAL SERVICES.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -148,7 +148,7 @@ public void eraseTargetFeedback(Request request) {
* {@inheritDoc}
*/
@Override
protected Command getCreateNodeOnNodeCommand(CreateRequest request, NodeCreationDescription tool, DNode viewnode) {
protected Command getCreateNodeOnNodeCommand(CreateRequest request, NodeCreationDescription tool, DNode viewnode, EditPart parentEditPartToUse) {
if (tool instanceof ExecutionCreationTool || tool instanceof StateCreationTool || tool instanceof ObservationPointCreationTool) {
SequenceDiagram sequenceDiagram = EditPartsHelper.getSequenceDiagram(getHost());
SequenceDDiagram diagram = sequenceDiagram.getSequenceDDiagram();
Expand All @@ -163,11 +163,11 @@ protected Command getCreateNodeOnNodeCommand(CreateRequest request, NodeCreation
GraphicalHelper.logical2screen(bottomRight, (IGraphicalEditPart) getHost());
request.setSize(new Dimension(LayoutConstants.DEFAULT_EXECUTION_WIDTH, LayoutConstants.DEFAULT_EXECUTION_HEIGHT));
}
CreationUtil creationUtil = new CreationUtil(request, getDiagramCommandFactory(startingEndPredecessor, startingEndPredecessor, location), getRealLocation(request), request.getSize(),
getHost());
CreationUtil creationUtil = new CreationUtil(getDiagramCommandFactory(startingEndPredecessor, startingEndPredecessor, location), getRealLocation(request, parentEditPartToUse),
request.getSize(), getHost());
return creationUtil.getNodeCreationCommand(viewnode, tool);
} else {
return super.getCreateNodeOnNodeCommand(request, tool, viewnode);
return super.getCreateNodeOnNodeCommand(request, tool, viewnode, parentEditPartToUse);
}
}

Expand All @@ -190,7 +190,8 @@ protected Command getCreateContainerInContainerCommand(CreateRequest request, Co
Point location = request.getLocation().getCopy();
GraphicalHelper.screen2logical(location, (IGraphicalEditPart) getHost());

CreationUtil creationUtil = new CreationUtil(request, getDiagramCommandFactory(startingEndPredecessor, startingEndPredecessor, location), getRealLocation(request), getHost());
CreationUtil creationUtil = new CreationUtil(request, getDiagramCommandFactory(startingEndPredecessor, startingEndPredecessor, location), getRealLocation(request, getHost()),
getHost());
result = creationUtil.getContainerCreationDescription((DDiagramElementContainer) viewNodeContainer.eContainer(), tool);
} else {
result = UnexecutableCommand.INSTANCE;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2021 THALES GLOBAL SERVICES and others.
* Copyright (c) 2009, 2024 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -215,7 +215,7 @@ public List<LayoutData> getChildren() {
}

/**
* Search recursively in in all the LayoutData is there is one which have
* Search recursively in in all the LayoutData if there is one which have
* the element for target.
*
* @param node
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2009, 2021 THALES GLOBAL SERVICES and others.
* Copyright (c) 2009, 2024 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -57,16 +57,7 @@ public class RootLayoutData extends LayoutData {
* the future size
*/
public RootLayoutData(final EditPart editPart, final Point location, final Dimension size) {
final Object adaptObject = EditPartTools.getParentOfType(editPart, IGraphicalEditPart.class).resolveSemanticElement();
if (adaptObject instanceof AbstractDNode) {
init((AbstractDNode) adaptObject, location, size);
} else if (adaptObject instanceof DDiagram) {
init((DDiagram) adaptObject, location, size);
} else if (adaptObject instanceof DEdge) {
init((DEdge) adaptObject, location, size);
} else {
AbstractSiriusFormatDataManager.logUnhandledDiagramElementKindMessage(adaptObject);
}
this(EditPartTools.getParentOfType(editPart, IGraphicalEditPart.class).resolveSemanticElement(), location, size);
}

/**
Expand Down Expand Up @@ -107,12 +98,10 @@ public RootLayoutData(final AbstractDNode target, final ShapeEditPart editPart,
*/
public RootLayoutData(final Object adaptObject, final Point location, final Dimension size) {
super();
if (adaptObject instanceof AbstractDNode) {
init((AbstractDNode) adaptObject, location, size);
} else if (adaptObject instanceof DDiagram) {
init((DDiagram) adaptObject, location, size);
} else if (adaptObject instanceof DEdge) {
init((DEdge) adaptObject, location, size);
if (adaptObject instanceof DDiagram // for root
|| adaptObject instanceof AbstractDNode // container or simple node
|| adaptObject instanceof DEdge) {
init((EObject) adaptObject, location, size);
} else {
AbstractSiriusFormatDataManager.logUnhandledDiagramElementKindMessage(adaptObject);
}
Expand Down Expand Up @@ -170,8 +159,10 @@ public RootLayoutData getRoot() {
}

/**
* Search recursively in in all the DiagramLayoutData is there is one which
* have the diagram for target.
* Search if there is data which have the diagram for target.
* <p>
* Default implementation does not perform a recursive search.
* </p>
*
* @param diagram
* The search diagram
Expand Down
Loading