Commit 51e38977 authored by Eyrak Paen-Rochlitz's avatar Eyrak Paen-Rochlitz
Browse files

[ui.structure] Fix positions for inherited items

The following are restricted if inherited:
- Update/resize of ActorContainerRefs
- Move of InterfaceItems on actor refs
- InterfaceItem text label positions
parent 9a221a2a
......@@ -886,8 +886,7 @@ public class ActorContainerRefSupport {
if(context instanceof PositionUpdateContext)
setPosition(acr, containerShape, (PositionUpdateContext) context);
EObject parent = (EObject) getBusinessObjectForPictogramElement(containerShape.getContainer());
updateRefFigure(acr, containerShape, isInherited(acr, parent), getDiagram());
layoutPictogramElement(containerShape);
GraphicsAlgorithm mainBorder = new ActorRefGraphicsAccess(containerShape, getDiagram()).getMainBorder();
IPositionProvider positionProvider = null;
......@@ -1023,6 +1022,18 @@ public class ActorContainerRefSupport {
public boolean canResizeShape(IResizeShapeContext context) {
if (!super.canResizeShape(context))
return false;
if (!(context.getPictogramElement() instanceof ContainerShape))
return false;
Object bo = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(context.getPictogramElement());
if (!(bo instanceof ActorContainerRef))
return false;
// If inherited, do not allow resize
StructureClass sc = SupportUtil.getInstance().getParent((ContainerShape)context.getPictogramElement(), getFeatureProvider());
if (isInherited((ActorContainerRef)bo, sc))
return false;
int width = context.getWidth()-MARGIN;
int height = context.getHeight()-MARGIN;
......
......@@ -23,6 +23,7 @@ import org.eclipse.etrice.core.room.ActorRef;
import org.eclipse.etrice.core.room.InterfaceItem;
import org.eclipse.etrice.core.room.Port;
import org.eclipse.etrice.core.room.ProtocolClass;
import org.eclipse.etrice.core.room.RoomPackage;
import org.eclipse.etrice.core.room.SPP;
import org.eclipse.etrice.core.room.SubSystemRef;
import org.eclipse.etrice.ui.commands.RoomOpeningHelper;
......@@ -234,13 +235,13 @@ public class InterfaceItemSupport {
ContainerShape acShape = context.getTargetContainer();
Object parentBO = getBusinessObjectForPictogramElement(acShape);
if (isInherited(item, parentBO, acShape))
return false;
boolean refport = (parentBO instanceof ActorContainerRef);
if (refport)
return true;
if (isInherited(item, parentBO, acShape))
return false;
int margin = refport?ActorContainerRefSupport.MARGIN:StructureClassSupport.MARGIN;
return isValidPosition(context, context, isInternal(item), margin);
}
......@@ -379,6 +380,14 @@ public class InterfaceItemSupport {
if(context instanceof PositionUpdateContext)
setPosition(port, containerShape, (PositionUpdateContext) context);
GraphicsAlgorithm invGa = containerShape.getGraphicsAlgorithm();
GraphicsAlgorithm textGa = containerShape.getChildren().get(0).getGraphicsAlgorithm();
boolean refport = RoomPackage.eINSTANCE.getActorContainerRef().isInstance(parentShapeBo);
int margin = refport?MARGIN_SMALL:MARGIN;
int size = refport?ITEM_SIZE_SMALL:ITEM_SIZE;
if (textGa instanceof Text)
adjustLabel((Text)textGa, invGa.getX(), invGa.getY(), containerShape.getContainer().getGraphicsAlgorithm().getWidth(), margin, size);
return true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment