From 2e2417363b7432a50c7047f197f6c3d4dcb6b8f4 Mon Sep 17 00:00:00 2001
From: izabel <izabel>
Date: Wed, 1 Dec 2010 16:39:31 +0000
Subject: [PATCH] [LMS-1903] remove duplicated code

SVN: 18981
---
 .../ui/script/ScriptExecutionFramework.java   | 21 +++++--------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/script/ScriptExecutionFramework.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/script/ScriptExecutionFramework.java
index 539c8f52b52..69a3b1331c9 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/script/ScriptExecutionFramework.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/script/ScriptExecutionFramework.java
@@ -308,23 +308,12 @@ public class ScriptExecutionFramework
 
     private void evaluate()
     {
-        if (StringUtils.isBlank(sampleChooser.getValue()) == false)
-        {
-            evaluate(EntityKind.SAMPLE, sampleChooser.getValue(), state.getScript());
-        }
-        if (experimentChooser.tryToGetValue() != null
-                && StringUtils.isBlank(experimentChooser.tryToGetValue().getIdentifier()) == false)
-        {
-            evaluate(EntityKind.EXPERIMENT, experimentChooser.tryToGetValue().getIdentifier(),
-                    state.getScript());
-        }
-        if (StringUtils.isBlank(materialChooser.getValue()) == false)
-        {
-            evaluate(EntityKind.MATERIAL, materialChooser.getValue(), state.getScript());
-        }
-        if (StringUtils.isBlank(datasetChooser.getValue()) == false)
+
+        BasicEntityDescription selectedEntityOrNull = tryGetSelectedEntity();
+        if (selectedEntityOrNull != null)
         {
-            evaluate(EntityKind.DATA_SET, datasetChooser.getValue(), state.getScript());
+            evaluate(selectedEntityOrNull.getEntityKind(),
+                    selectedEntityOrNull.getEntityIdentifier(), state.getScript());
         }
     }
 
-- 
GitLab