Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarvin Mueller2014-11-06 10:53:59 +0000
committerMarvin Mueller2014-11-06 13:16:41 +0000
commitcc21cd6ee23eec83c51186f8829418ea9f272375 (patch)
tree5a3fe05825f577695b655637f9fdf71a043b0132 /org.eclipse.jubula.toolkit.api.gen
parent52cbc6541d06bcd2ae5dcd3f67c21df8be33d600 (diff)
downloadorg.eclipse.jubula.core-cc21cd6ee23eec83c51186f8829418ea9f272375.tar.gz
org.eclipse.jubula.core-cc21cd6ee23eec83c51186f8829418ea9f272375.tar.xz
org.eclipse.jubula.core-cc21cd6ee23eec83c51186f8829418ea9f272375.zip
Sprint task - API added InteractionMode as enum to use for everything which has to do with e.g. mouse clicks
Diffstat (limited to 'org.eclipse.jubula.toolkit.api.gen')
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/resources/enumMappings.properties1
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java13
-rw-r--r--org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet12
3 files changed, 21 insertions, 5 deletions
diff --git a/org.eclipse.jubula.toolkit.api.gen/resources/enumMappings.properties b/org.eclipse.jubula.toolkit.api.gen/resources/enumMappings.properties
index 731de881c..2f7aa2b13 100644
--- a/org.eclipse.jubula.toolkit.api.gen/resources/enumMappings.properties
+++ b/org.eclipse.jubula.toolkit.api.gen/resources/enumMappings.properties
@@ -15,3 +15,4 @@ CompSystem.SearchType=org.eclipse.jubula.toolkit.enums.ValueSets.SearchType
CompSystem.TreeDirection=org.eclipse.jubula.toolkit.enums.ValueSets.TreeDirection
CompSystem.XUnits=org.eclipse.jubula.toolkit.enums.ValueSets.Unit
CompSystem.YUnits=org.eclipse.jubula.toolkit.enums.ValueSets.Unit
+CompSystem.MouseButton=org.eclipse.jubula.toolkit.enums.ValueSets.InteractionMode \ No newline at end of file
diff --git a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java
index 206ae3f32..17690be21 100644
--- a/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java
+++ b/org.eclipse.jubula.toolkit.api.gen/src/org/eclipse/jubula/toolkit/api/gen/internal/utils/NameLoader.java
@@ -137,7 +137,18 @@ public class NameLoader {
if (mapEntry != null) {
return mapEntry;
}
- mapEntry = m_mappingProperties.getProperty(type);
+
+ return getRealTypeForParameter(type, name);
+ }
+ /**
+ * Checks in the name mappings property file whether there is a mapping for a
+ * given parameter name and returns it and if not, returns the original type
+ * @param type the type of the parameter
+ * @param name the name of the parameter
+ * @return the name which should be used if you need the real type from the parameter
+ */
+ public String getRealTypeForParameter(String type, String name) {
+ String mapEntry = m_mappingProperties.getProperty(type);
if (mapEntry != null) {
return mapEntry;
}
diff --git a/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet b/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
index d5783a110..c9226b019 100644
--- a/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
+++ b/org.eclipse.jubula.toolkit.api.gen/templates/ClassGenerator.javajet
@@ -173,7 +173,8 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
@NonNull public CAP <%=methodName%>(
<%
// add parameters to method
- Map<String, String> paramMap = new HashMap<String, String>();
+ Map<String, String> paramMap = new HashMap<String, String>();// with enums
+ Map<String, String> paramTypeMap = new HashMap<String, String>();// only "simple" types
Iterator<Param> paramIterator = params.iterator();
while (paramIterator.hasNext()) {
Param param = paramIterator.next();
@@ -181,7 +182,9 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
String name = param.getName();
String paramType = nameLoader.findTypeForParameter(type, name);
String paramName = nameLoader.translateFromCompSystem(name);
+ String fixedType = nameLoader.getRealTypeForParameter(type, name);
paramMap.put(name, paramType);
+ paramTypeMap.put(name, fixedType);
%>
@NonNull <%=paramType%> <%=paramName%><%if(paramIterator.hasNext()){%>,<%}%>
<%}%>
@@ -197,9 +200,10 @@ public <%if (genInterface) {%>interface<%} else {%>class<%}%> <%=className%>
String paramName = parameter.getName();%>
<%String translatedParamName = nameLoader.translateFromCompSystem(paramName);%>
Validate.notNull(<%=translatedParamName%>, "Argument '<%=translatedParamName%>' must not be null"); //$NON-NLS-1$
- <%String paramType = paramMap.get(paramName);%>
- <%if (nameLoader.isInEnumMap(paramType)) {%>
- messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.rcValue(), "java.lang.String")); //$NON-NLS-1$
+ <%String paramEnumType = paramMap.get(paramName);%>
+ <%String paramType = paramTypeMap.get(paramName);%>
+ <%if (nameLoader.isInEnumMap(paramEnumType)) {%>
+ messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.rcValue(), "<%=paramType%>")); //$NON-NLS-1$
<%} else {%>
messageCap.addMessageParam(new MessageParam(<%=translatedParamName%>.toString(), "<%=paramType%>")); //$NON-NLS-1$
<%}%>

Back to the top