From 5d50d40c59a20738a290331f3da13dadf7e16b7c Mon Sep 17 00:00:00 2001 From: lempinen Date: Thu, 7 Oct 2010 07:28:05 +0000 Subject: [PATCH] Used IDoubleclickableNode for nodes that do not have default action when doubleclicked git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@18289 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../simantics/sysdyn/ui/browser/nodes/ModelNode.java | 8 +++++++- .../sysdyn/ui/browser/nodes/ModuleNode.java | 8 +++++++- .../ui/browser/nodes/SimulationResultNode.java | 12 +++++++++++- .../sysdyn/ui/handlers/ToggleResultActivation.java | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java index 49962dc9..e850011c 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModelNode.java @@ -3,6 +3,7 @@ package org.simantics.sysdyn.ui.browser.nodes; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.common.node.DeleteException; import org.simantics.browsing.ui.common.node.IDeletableNode; +import org.simantics.browsing.ui.common.node.IDoubleClickableNode; import org.simantics.browsing.ui.common.node.IModifiableNode; import org.simantics.browsing.ui.content.Labeler.Modifier; import org.simantics.browsing.ui.graph.impl.LabelModifier; @@ -20,7 +21,7 @@ import org.simantics.sysdyn.SysdynResource; import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; -public class ModelNode extends AbstractNode implements IDeletableNode, IModifiableNode { +public class ModelNode extends AbstractNode implements IDoubleClickableNode, IDeletableNode, IModifiableNode { Listener configurationNameSynchronizer; private boolean disposed = false; @@ -103,4 +104,9 @@ public class ModelNode extends AbstractNode implements IDeletableNode, } + @Override + public boolean handleDoubleClick() { + return true; + } + } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleNode.java index 00117ddc..db67c36b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/ModuleNode.java @@ -1,10 +1,16 @@ package org.simantics.sysdyn.ui.browser.nodes; +import org.simantics.browsing.ui.common.node.IDoubleClickableNode; import org.simantics.db.Resource; -public class ModuleNode extends ConfigurationNode { +public class ModuleNode extends ConfigurationNode implements IDoubleClickableNode { public ModuleNode(Resource resource) { super(resource); } + + @Override + public boolean handleDoubleClick() { + return true; + } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java index 316f12d8..21fcf75b 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/browser/nodes/SimulationResultNode.java @@ -5,6 +5,7 @@ import java.io.File; import org.simantics.browsing.ui.common.node.AbstractNode; import org.simantics.browsing.ui.common.node.DeleteException; import org.simantics.browsing.ui.common.node.IDeletableNode; +import org.simantics.browsing.ui.common.node.IDoubleClickableNode; import org.simantics.browsing.ui.common.node.IModifiableNode; import org.simantics.browsing.ui.content.Labeler.Modifier; import org.simantics.browsing.ui.graph.impl.LabelModifier; @@ -15,10 +16,11 @@ import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.CancelTransactionException; import org.simantics.db.exception.DatabaseException; import org.simantics.sysdyn.SysdynResource; +import org.simantics.sysdyn.ui.handlers.ToggleResultActivation; import org.simantics.ui.SimanticsUI; import org.simantics.utils.ui.ExceptionUtils; -public class SimulationResultNode extends AbstractNode implements IDeletableNode, IModifiableNode { +public class SimulationResultNode extends AbstractNode implements IDoubleClickableNode, IDeletableNode, IModifiableNode { public SimulationResultNode(Resource resource) { super(resource); @@ -74,4 +76,12 @@ public class SimulationResultNode extends AbstractNode implements IDe parent.delete(); } } + + + @Override + public boolean handleDoubleClick() { + Resource[] resources = {data}; + ToggleResultActivation.toggleActivation(resources); + return true; + } } diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java index fdf56c52..c6a854d0 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/ToggleResultActivation.java @@ -28,7 +28,7 @@ public class ToggleResultActivation extends AbstractHandler { return null; } - private void toggleActivation(final Resource[] resources) { + public static void toggleActivation(final Resource[] resources) { try { SimanticsUI.getSession().syncRequest(new WriteRequest() { -- 2.47.1