From: Reino Ruusu Date: Mon, 2 Mar 2020 12:24:19 +0000 (+0200) Subject: Show an error dialog when attempting to insert a too long component X-Git-Tag: v1.43.0~51 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F60%2F3960%2F1;p=simantics%2F3d.git Show an error dialog when attempting to insert a too long component gitlab #97 Change-Id: I9f6b6b0fb7c0a9fc0a9f1b93b081d4041f5499c9 --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java index 0ee0f6bc..9b3d9083 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java @@ -6,6 +6,7 @@ import java.awt.event.MouseWheelEvent; import java.util.HashSet; import java.util.Set; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.ResourceLocator; import org.eclipse.swt.widgets.Display; import org.simantics.db.Resource; @@ -187,6 +188,11 @@ public class AddComponentAction extends vtkSwtAction { public void doInsert(PositionType position) { try { + if (position == PositionType.SPLIT && length != null && length > component.getControlPoint().getLength()) { + MessageDialog.openError(panel.getComponent().getShell(), "Error", "There is no room for a component of length " + length * lengthFactor + " units"); + return; + } + InsertInstruction inst = new InsertInstruction(); inst.typeUri = toAdd.getUri(); inst.name = name;