Added get-combo-items command
+ xml commands: fixed typo
+ excel commands: added a check for empty parameter value
Signed-off-by: Viktoria Dlugopolskaya <viksnsk@gmail.com>
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/GetComboItems.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/GetComboItems.java
new file mode 100644
index 0000000..89a1598
--- /dev/null
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/GetComboItems.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2017 Xored Software Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xored Software Inc - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.rcptt.tesla.ecl.model;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Get Combo Items</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.rcptt.tesla.ecl.model.TeslaPackage#getGetComboItems()
+ * @model annotation="http://www.eclipse.org/ecl/docs description='Gets combo box items and returns them as <code>EclList</code> EMF object' returns='combo box items' recorded='false' example='get-combo | get-combo-items | each [val item] {\n\tlog $item\n}'"
+ * @generated
+ */
+public interface GetComboItems extends ControlCommand {
+} // GetComboItems
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaFactory.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaFactory.java
index d9d09f0..c6d1b42 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaFactory.java
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaFactory.java
@@ -1326,6 +1326,15 @@
GetTestCaseName createGetTestCaseName();
/**
+ * Returns a new object of class '<em>Get Combo Items</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Get Combo Items</em>'.
+ * @generated
+ */
+ GetComboItems createGetComboItems();
+
+ /**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaPackage.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaPackage.java
index b42b809..0bf6538 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaPackage.java
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/TeslaPackage.java
@@ -10162,6 +10162,52 @@
int GET_TEST_CASE_NAME_FEATURE_COUNT = CorePackage.COMMAND_FEATURE_COUNT + 0;
/**
+ * The meta object id for the '{@link org.eclipse.rcptt.tesla.ecl.model.impl.GetComboItemsImpl <em>Get Combo Items</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rcptt.tesla.ecl.model.impl.GetComboItemsImpl
+ * @see org.eclipse.rcptt.tesla.ecl.model.impl.TeslaPackageImpl#getGetComboItems()
+ * @generated
+ */
+ int GET_COMBO_ITEMS = 149;
+
+ /**
+ * The feature id for the '<em><b>Host</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GET_COMBO_ITEMS__HOST = CONTROL_COMMAND__HOST;
+
+ /**
+ * The feature id for the '<em><b>Bindings</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GET_COMBO_ITEMS__BINDINGS = CONTROL_COMMAND__BINDINGS;
+
+ /**
+ * The feature id for the '<em><b>Control</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GET_COMBO_ITEMS__CONTROL = CONTROL_COMMAND__CONTROL;
+
+ /**
+ * The number of structural features of the '<em>Get Combo Items</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GET_COMBO_ITEMS_FEATURE_COUNT = CONTROL_COMMAND_FEATURE_COUNT + 0;
+
+ /**
* The meta object id for the '{@link org.eclipse.rcptt.tesla.ecl.model.Button <em>Button</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -10169,7 +10215,7 @@
* @see org.eclipse.rcptt.tesla.ecl.model.impl.TeslaPackageImpl#getButton()
* @generated
*/
- int BUTTON = 149;
+ int BUTTON = 150;
/**
* The meta object id for the '{@link org.eclipse.rcptt.tesla.ecl.model.ActivationEventType <em>Activation Event Type</em>}' enum.
@@ -10179,7 +10225,7 @@
* @see org.eclipse.rcptt.tesla.ecl.model.impl.TeslaPackageImpl#getActivationEventType()
* @generated
*/
- int ACTIVATION_EVENT_TYPE = 150;
+ int ACTIVATION_EVENT_TYPE = 151;
/**
* The meta object id for the '<em>Element Kind</em>' data type.
@@ -10189,7 +10235,7 @@
* @see org.eclipse.rcptt.tesla.ecl.model.impl.TeslaPackageImpl#getElementKind()
* @generated
*/
- int ELEMENT_KIND = 151;
+ int ELEMENT_KIND = 152;
/**
@@ -13949,6 +13995,16 @@
EClass getGetTestCaseName();
/**
+ * Returns the meta object for class '{@link org.eclipse.rcptt.tesla.ecl.model.GetComboItems <em>Get Combo Items</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Get Combo Items</em>'.
+ * @see org.eclipse.rcptt.tesla.ecl.model.GetComboItems
+ * @generated
+ */
+ EClass getGetComboItems();
+
+ /**
* Returns the meta object for enum '{@link org.eclipse.rcptt.tesla.ecl.model.Button <em>Button</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -17140,6 +17196,16 @@
EClass GET_TEST_CASE_NAME = eINSTANCE.getGetTestCaseName();
/**
+ * The meta object literal for the '{@link org.eclipse.rcptt.tesla.ecl.model.impl.GetComboItemsImpl <em>Get Combo Items</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.rcptt.tesla.ecl.model.impl.GetComboItemsImpl
+ * @see org.eclipse.rcptt.tesla.ecl.model.impl.TeslaPackageImpl#getGetComboItems()
+ * @generated
+ */
+ EClass GET_COMBO_ITEMS = eINSTANCE.getGetComboItems();
+
+ /**
* The meta object literal for the '{@link org.eclipse.rcptt.tesla.ecl.model.Button <em>Button</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/GetComboItemsImpl.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/GetComboItemsImpl.java
new file mode 100644
index 0000000..1b062d1
--- /dev/null
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/GetComboItemsImpl.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2017 Xored Software Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xored Software Inc - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.rcptt.tesla.ecl.model.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.rcptt.tesla.ecl.model.GetComboItems;
+import org.eclipse.rcptt.tesla.ecl.model.TeslaPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Get Combo Items</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class GetComboItemsImpl extends ControlCommandImpl implements GetComboItems {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected GetComboItemsImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return TeslaPackage.Literals.GET_COMBO_ITEMS;
+ }
+
+} //GetComboItemsImpl
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaFactoryImpl.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaFactoryImpl.java
index 2a34b11..d15f493 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaFactoryImpl.java
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaFactoryImpl.java
@@ -69,6 +69,7 @@
import org.eclipse.rcptt.tesla.ecl.model.GetColorSelector;
import org.eclipse.rcptt.tesla.ecl.model.GetColumnHeader;
import org.eclipse.rcptt.tesla.ecl.model.GetCombo;
+import org.eclipse.rcptt.tesla.ecl.model.GetComboItems;
import org.eclipse.rcptt.tesla.ecl.model.GetControl;
import org.eclipse.rcptt.tesla.ecl.model.GetCoolbar;
import org.eclipse.rcptt.tesla.ecl.model.GetDateTime;
@@ -352,6 +353,7 @@
case TeslaPackage.CHECK_DOWNLOAD_RESULT: return createCheckDownloadResult();
case TeslaPackage.GET_RUNTIME_TARGET: return createGetRuntimeTarget();
case TeslaPackage.GET_TEST_CASE_NAME: return createGetTestCaseName();
+ case TeslaPackage.GET_COMBO_ITEMS: return createGetComboItems();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
@@ -1703,6 +1705,16 @@
}
/**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GetComboItems createGetComboItems() {
+ GetComboItemsImpl getComboItems = new GetComboItemsImpl();
+ return getComboItems;
+ }
+
+ /**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaPackageImpl.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaPackageImpl.java
index c6dd310..e4ed41c 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaPackageImpl.java
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/impl/TeslaPackageImpl.java
@@ -77,6 +77,7 @@
import org.eclipse.rcptt.tesla.ecl.model.GetColorSelector;
import org.eclipse.rcptt.tesla.ecl.model.GetColumnHeader;
import org.eclipse.rcptt.tesla.ecl.model.GetCombo;
+import org.eclipse.rcptt.tesla.ecl.model.GetComboItems;
import org.eclipse.rcptt.tesla.ecl.model.GetControl;
import org.eclipse.rcptt.tesla.ecl.model.GetCoolbar;
import org.eclipse.rcptt.tesla.ecl.model.GetDateTime;
@@ -1234,6 +1235,13 @@
* <!-- end-user-doc -->
* @generated
*/
+ private EClass getComboItemsEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EEnum buttonEEnum = null;
/**
@@ -4520,6 +4528,15 @@
* <!-- end-user-doc -->
* @generated
*/
+ public EClass getGetComboItems() {
+ return getComboItemsEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public EEnum getButton() {
return buttonEEnum;
}
@@ -5074,6 +5091,8 @@
getTestCaseNameEClass = createEClass(GET_TEST_CASE_NAME);
+ getComboItemsEClass = createEClass(GET_COMBO_ITEMS);
+
// Create enums
buttonEEnum = createEEnum(BUTTON);
activationEventTypeEEnum = createEEnum(ACTIVATION_EVENT_TYPE);
@@ -5265,6 +5284,7 @@
checkDownloadResultEClass.getESuperTypes().add(theCorePackage.getCommand());
getRuntimeTargetEClass.getESuperTypes().add(theCorePackage.getCommand());
getTestCaseNameEClass.getESuperTypes().add(theCorePackage.getCommand());
+ getComboItemsEClass.getESuperTypes().add(this.getControlCommand());
// Initialize classes and features; add operations and parameters
initEClass(waitEClass, Wait.class, "Wait", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@@ -5771,6 +5791,8 @@
initEClass(getTestCaseNameEClass, GetTestCaseName.class, "GetTestCaseName", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEClass(getComboItemsEClass, GetComboItems.class, "GetComboItems", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
// Initialize enums and add enum literals
initEEnum(buttonEEnum, Button.class, "Button");
addEEnumLiteral(buttonEEnum, Button.NONE);
@@ -7489,6 +7511,15 @@
"description", "Returns current test case name",
"returns", "Current test case name",
"example", "get-test-case-name | log"
+ });
+ addAnnotation
+ (getComboItemsEClass,
+ source,
+ new String[] {
+ "description", "Gets combo box items and returns them as <code>EclList</code> EMF object",
+ "returns", "combo box items",
+ "recorded", "false",
+ "example", "get-combo | get-combo-items | each [val item] {\n\tlog $item\n}"
});
}
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaAdapterFactory.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaAdapterFactory.java
index 74e23d0..a3f5265 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaAdapterFactory.java
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaAdapterFactory.java
@@ -68,6 +68,7 @@
import org.eclipse.rcptt.tesla.ecl.model.GetColorSelector;
import org.eclipse.rcptt.tesla.ecl.model.GetColumnHeader;
import org.eclipse.rcptt.tesla.ecl.model.GetCombo;
+import org.eclipse.rcptt.tesla.ecl.model.GetComboItems;
import org.eclipse.rcptt.tesla.ecl.model.GetControl;
import org.eclipse.rcptt.tesla.ecl.model.GetCoolbar;
import org.eclipse.rcptt.tesla.ecl.model.GetDateTime;
@@ -820,6 +821,10 @@
return createGetTestCaseNameAdapter();
}
@Override
+ public Adapter caseGetComboItems(GetComboItems object) {
+ return createGetComboItemsAdapter();
+ }
+ @Override
public Adapter caseCommand(Command object) {
return createCommandAdapter();
}
@@ -2934,6 +2939,20 @@
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.rcptt.tesla.ecl.model.GetComboItems <em>Get Combo Items</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.rcptt.tesla.ecl.model.GetComboItems
+ * @generated
+ */
+ public Adapter createGetComboItemsAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.rcptt.ecl.core.Command <em>Command</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaSwitch.java b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaSwitch.java
index 4778eb9..248e32b 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaSwitch.java
+++ b/core/org.eclipse.rcptt.tesla.ecl/gen-src/org/eclipse/rcptt/tesla/ecl/model/util/TeslaSwitch.java
@@ -68,6 +68,7 @@
import org.eclipse.rcptt.tesla.ecl.model.GetColorSelector;
import org.eclipse.rcptt.tesla.ecl.model.GetColumnHeader;
import org.eclipse.rcptt.tesla.ecl.model.GetCombo;
+import org.eclipse.rcptt.tesla.ecl.model.GetComboItems;
import org.eclipse.rcptt.tesla.ecl.model.GetControl;
import org.eclipse.rcptt.tesla.ecl.model.GetCoolbar;
import org.eclipse.rcptt.tesla.ecl.model.GetDateTime;
@@ -1363,6 +1364,14 @@
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case TeslaPackage.GET_COMBO_ITEMS: {
+ GetComboItems getComboItems = (GetComboItems)theEObject;
+ T result = caseGetComboItems(getComboItems);
+ if (result == null) result = caseControlCommand(getComboItems);
+ if (result == null) result = caseCommand(getComboItems);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -3603,6 +3612,21 @@
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Get Combo Items</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Get Combo Items</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseGetComboItems(GetComboItems object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Command</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/core/org.eclipse.rcptt.tesla.ecl/model/tesla.ecore b/core/org.eclipse.rcptt.tesla.ecl/model/tesla.ecore
index f411e50..d31b5a9 100644
--- a/core/org.eclipse.rcptt.tesla.ecl/model/tesla.ecore
+++ b/core/org.eclipse.rcptt.tesla.ecl/model/tesla.ecore
@@ -1774,6 +1774,14 @@
<eLiterals name="MouseDoubleClickSelection" value="3"/>
<eLiterals name="Traversal" value="5"/>
</eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="GetComboItems" eSuperTypes="#//ControlCommand">
+ <eAnnotations source="http://www.eclipse.org/ecl/docs">
+ <details key="description" value="Gets combo box items and returns them as <code>EclList</code> EMF object"/>
+ <details key="returns" value="combo box items"/>
+ <details key="recorded" value="false"/>
+ <details key="example" value="get-combo | get-combo-items | each [val item] {
	log $item
}"/>
+ </eAnnotations>
+ </eClassifiers>
<eSubpackages name="diagram" nsURI="http://eclipse.org/rcptt/tesla/ecl/diagram"
nsPrefix="org.eclipse.rcptt.ecl.tesla.diagram">
<eClassifiers xsi:type="ecore:EClass" name="GetDiagram" eSuperTypes="#//Selector">
diff --git a/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/plugin.xml b/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/plugin.xml
index c521b86..cf0bc55 100644
--- a/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/plugin.xml
+++ b/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/plugin.xml
@@ -786,6 +786,11 @@
name="GetTestCaseName"
namespace="http://eclipse.org/rcptt/tesla/ecl">
</scriptlet>
+ <scriptlet
+ class="org.eclipse.rcptt.tesla.ecl.internal.impl.commands.GetComboItemsService"
+ name="GetComboItems"
+ namespace="http://eclipse.org/rcptt/tesla/ecl">
+ </scriptlet>
</extension>
<extension
point="org.eclipse.rcptt.tesla.swt.jobCollector">
diff --git a/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/src/org/eclipse/rcptt/tesla/ecl/internal/impl/commands/GetComboItemsService.java b/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/src/org/eclipse/rcptt/tesla/ecl/internal/impl/commands/GetComboItemsService.java
new file mode 100644
index 0000000..e3277e7
--- /dev/null
+++ b/runtime/ecl/org.eclipse.rcptt.tesla.ecl.impl/src/org/eclipse/rcptt/tesla/ecl/internal/impl/commands/GetComboItemsService.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2017 Xored Software Inc and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xored Software Inc - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.rcptt.tesla.ecl.internal.impl.commands;
+
+import static org.eclipse.rcptt.tesla.ecl.internal.impl.TeslaImplPlugin.err;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.rcptt.ecl.core.Command;
+import org.eclipse.rcptt.ecl.core.CoreFactory;
+import org.eclipse.rcptt.ecl.core.EclList;
+import org.eclipse.rcptt.ecl.core.EclString;
+import org.eclipse.rcptt.tesla.core.protocol.raw.Element;
+import org.eclipse.rcptt.tesla.ecl.impl.AbstractActionService;
+import org.eclipse.rcptt.tesla.ecl.impl.TeslaBridge;
+import org.eclipse.rcptt.tesla.ecl.model.ControlHandler;
+import org.eclipse.rcptt.tesla.ecl.model.GetComboItems;
+import org.eclipse.rcptt.tesla.internal.ui.processors.SWTUIProcessor;
+import org.eclipse.swt.custom.CCombo;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Widget;
+
+public class GetComboItemsService extends AbstractActionService {
+
+ @Override
+ protected Object exec(final Command command) throws CoreException {
+ final GetComboItems gci = (GetComboItems) command;
+ final ControlHandler control = gci.getControl();
+
+ final Element element = TeslaBridge.find(control, getContext());
+ final Widget combo = (Widget) TeslaBridge.getClient()
+ .getProcessor(SWTUIProcessor.class).getMapper()
+ .get(element).widget;
+
+ if (!(combo instanceof Combo) && !(combo instanceof CCombo)) {
+ throw new CoreException(
+ err("'get-combo-items' can be used only on combo box"));
+ }
+
+ final EclList list = CoreFactory.eINSTANCE.createEclList();
+ combo.getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ addComboItemsToList(combo, list);
+ }
+
+ });
+
+ return list;
+ }
+
+ private static void addComboItemsToList(Widget widget, EclList list) {
+ if (widget instanceof Combo) {
+ Combo combo = (Combo) widget;
+ addItemsToList(combo.getItems(), list);
+ } else if (widget instanceof CCombo) {
+ CCombo combo = (CCombo) widget;
+ addItemsToList(combo.getItems(), list);
+ }
+ }
+
+ private static void addItemsToList(String[] items, EclList list) {
+ if (items == null) {
+ return;
+ }
+ for (int i = 0; i < items.length; i++) {
+ EclString item = CoreFactory.eINSTANCE.createEclString();
+ item.setValue(items[i]);
+ list.getElements().add(item);
+ }
+ }
+
+}
diff --git a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/ExcelFileService.java b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/ExcelFileService.java
index 6c00cbf..0352a40 100644
--- a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/ExcelFileService.java
+++ b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/ExcelFileService.java
@@ -38,7 +38,7 @@
book = new XSSFWorkbook();
} else {
throw new CoreException(EclDataApachePOIImplPlugin.createErr(
- "Error getting extension of file %s. Only 'xls' and 'xslx' are supported.", file.toURI()));
+ "Error getting extension of file %s. Only 'xls' and 'xlsx' are supported.", file.toURI()));
}
return book;
}
@@ -53,8 +53,7 @@
e, "File not found %s", file.toURI()));
} catch (InvalidFormatException e) {
throw new CoreException(EclDataApachePOIImplPlugin.createErr(
- "Error getting extension of file %s. Only 'xls' and 'xslx' are supported.",
- file.toURI()));
+ "Invalid format of file %s", file.toURI()));
} catch (IOException e) {
throw new CoreException(EclDataApachePOIImplPlugin.createErr(
e, "Error reading file %s", file.toURI()));
diff --git a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableCellsService.java b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableCellsService.java
index 8a64e95..d19b993 100644
--- a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableCellsService.java
+++ b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableCellsService.java
@@ -32,6 +32,11 @@
EList<String> cells = getTableCells.getCells();
for (String cellName : cells) {
+ if (cellName == null || cellName.equals("")) {
+ return EclDataApachePOIImplPlugin
+ .createErr("Error getting 'cells' parameter. Cell name must not be null or empty");
+ }
+
CellReference cellRef = new CellReference(cellName);
int rowIndex = cellRef.getRow();
int colIndex = cellRef.getCol();
diff --git a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableRangeService.java b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableRangeService.java
index 6aa441c..8490592 100644
--- a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableRangeService.java
+++ b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/GetTableRangeService.java
@@ -30,11 +30,15 @@
GetTableRange getTableRange = (GetTableRange) command;
Table table = getTableRange.getTable();
String range = getTableRange.getRange();
-
+ if (range == null || range.equals("")) {
+ return EclDataApachePOIImplPlugin
+ .createErr("Error getting 'range' parameter. Value must not be null or empty");
+ }
if (range.indexOf(":") == -1) {
return EclDataApachePOIImplPlugin.createErr(
"Invalid value of 'range' parameter. Range string must contain the first cell name and the last cell name, separated by a colon.");
}
+
String[] cells = range.split(":");
String firstCell = cells[0];
String lastCell = cells[1];
diff --git a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/SetTableCellsService.java b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/SetTableCellsService.java
index 3f72fcf..32d66a7 100644
--- a/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/SetTableCellsService.java
+++ b/runtime/org.eclipse.rcptt.ecl.data.apache.poi.impl/src/org/eclipse/rcptt/ecl/data/apache/poi/impl/internal/commands/SetTableCellsService.java
@@ -39,7 +39,7 @@
String key = getValue(entry.getKey());
if (key == null || key.equals("")) {
return EclDataApachePOIImplPlugin
- .createErr("Error getting 'cells' parameter. Map key must not be null");
+ .createErr("Error getting 'cells' parameter. Map key must not be null or empty");
}
String value = getValue(entry.getValue());
addCellValue(table, key, value);