From: Tuukka Lehtonen Date: Fri, 1 Dec 2017 10:47:31 +0000 (+0200) Subject: Merge changes I24f9af64,I97579b86 X-Git-Tag: v1.31.0~13 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=43b5be1b099b479a20ac36e3bf2c6703242f068d;hp=e28caa5b47179aa0a7e600a1fcecf864175d2cbe Merge changes I24f9af64,I97579b86 * changes: Fixed File SCL module documentation markdown flaws. Simplified diagram connection creation --- diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectTool2.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectTool2.java index b77a28947..7d3a5a400 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectTool2.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/ConnectTool2.java @@ -90,6 +90,7 @@ import org.simantics.scenegraph.g2d.events.KeyEvent.KeyPressedEvent; import org.simantics.scenegraph.g2d.events.MouseEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonPressedEvent; +import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonReleasedEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent; import org.simantics.scenegraph.g2d.events.command.CommandEvent; import org.simantics.scenegraph.g2d.events.command.Commands; @@ -520,6 +521,10 @@ public class ConnectTool2 extends AbstractMode { if (me instanceof MouseButtonPressedEvent) return processMouseButtonPress((MouseButtonPressedEvent) me); + // #7653: Support creating connections between terminals without lifting mouse button in between. + if (me instanceof MouseButtonReleasedEvent) + return processMouseButtonRelease((MouseButtonReleasedEvent) me); + return false; } @@ -662,15 +667,7 @@ public class ConnectTool2 extends AbstractMode { if (snapAdvisor != null) snapAdvisor.snap(mouseCanvasPos); - if (isEndTerminalDefined() && connectionJudgment != null) { - // Clicked on an allowed end terminal. End connection & end mode. - createConnection(); - remove(); - return true; - } else if (lastRouteGraphTarget != null && attachToConnectionJudgement != null) { - lastRouteGraphTarget.getNode().showBranchPoint(null); - attachToConnection(); - remove(); + if (tryEndConnection()) { return true; } else { // Finish connection in thin air only if the @@ -710,6 +707,33 @@ public class ConnectTool2 extends AbstractMode { return false; } + private int mouseLeftReleaseCount = 0; + + protected boolean processMouseButtonRelease(MouseButtonReleasedEvent me) { + if (me.button == MouseEvent.LEFT_BUTTON + && ++mouseLeftReleaseCount == 1) { + return tryEndConnection(); + } + return false; + } + + /** + * @return true if connection was successfully ended + */ + private boolean tryEndConnection() { + if (isEndTerminalDefined() && connectionJudgment != null) { + createConnection(); + remove(); + return true; + } else if (lastRouteGraphTarget != null && attachToConnectionJudgement != null) { + lastRouteGraphTarget.getNode().showBranchPoint(null); + attachToConnection(); + remove(); + return true; + } + return false; + } + private void attachToConnection() { ConnectionJudgement judgment = this.attachToConnectionJudgement; if (judgment == null) { diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/RouteGraphConnectTool.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/RouteGraphConnectTool.java index 4cccea938..8f99207e1 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/RouteGraphConnectTool.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/participant/RouteGraphConnectTool.java @@ -85,6 +85,7 @@ import org.simantics.scenegraph.g2d.events.KeyEvent.KeyPressedEvent; import org.simantics.scenegraph.g2d.events.MouseEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonPressedEvent; +import org.simantics.scenegraph.g2d.events.MouseEvent.MouseButtonReleasedEvent; import org.simantics.scenegraph.g2d.events.MouseEvent.MouseMovedEvent; import org.simantics.scenegraph.g2d.events.command.CommandEvent; import org.simantics.scenegraph.g2d.events.command.Commands; @@ -477,6 +478,10 @@ public class RouteGraphConnectTool extends AbstractMode { if (me instanceof MouseButtonPressedEvent) return processMouseButtonPress((MouseButtonPressedEvent) me); + // #7653: Support creating connections between terminals without lifting mouse button in between. + if (me instanceof MouseButtonReleasedEvent) + return processMouseButtonRelease((MouseButtonReleasedEvent) me); + return false; } @@ -566,10 +571,8 @@ public class RouteGraphConnectTool extends AbstractMode { protected void disconnect(Point2D mouseCanvasPos) { setEndTerminal(mouseCanvasPos.getX(), mouseCanvasPos.getY(), null, 0xf); } - - protected boolean processMouseButtonPress(MouseButtonPressedEvent e) { - MouseButtonEvent me = e; + protected boolean processMouseButtonPress(MouseButtonEvent me) { // Do nothing before the mouse has moved at least a little. // This prevents the user from ending the connection right where // it started. @@ -585,9 +588,7 @@ public class RouteGraphConnectTool extends AbstractMode { snapAdvisor.snap(mouseCanvasPos); // Clicked on an allowed end terminal. End connection & end mode. - if (isEndTerminalDefined()) { - createConnection(); - remove(); + if (tryEndConnection()) { return true; } else { // Finish connection in thin air only if the @@ -617,6 +618,28 @@ public class RouteGraphConnectTool extends AbstractMode { return false; } + private int mouseLeftReleaseCount = 0; + + protected boolean processMouseButtonRelease(MouseButtonReleasedEvent me) { + if (me.button == MouseEvent.LEFT_BUTTON + && ++mouseLeftReleaseCount == 1) { + return tryEndConnection(); + } + return false; + } + + /** + * @return true if connection was successfully ended + */ + private boolean tryEndConnection() { + if (isEndTerminalDefined()) { + createConnection(); + remove(); + return true; + } + return false; + } + protected boolean cancelPreviousBend() { if (!routePointsAllowed()) return false; diff --git a/bundles/org.simantics.scl.runtime/scl/File.md b/bundles/org.simantics.scl.runtime/scl/File.md index 8ac31c5f8..b549ee425 100644 --- a/bundles/org.simantics.scl.runtime/scl/File.md +++ b/bundles/org.simantics.scl.runtime/scl/File.md @@ -1,8 +1,22 @@ # File -::Data[File] +::data[File] ::value[file, fileExists] - -# Undocumented entities - -::undocumented[] \ No newline at end of file +::value[childFile] +::value[copyFile] +::value[createFile] +::value[createTempDirectory] +::value[createTempFile] +::value[cwd] +::value[deleteFile] +::value[deleteFileOnExit] +::value[isDirectory] +::value[isFile] +::value[listFiles] +::value[makeDirs] +::value[moveFile] +::value[parentFile] +::value[pathOfFile] +::value[pwd] +::value[sizeOfFile] +::value[syncFile]