Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Barbe2016-07-22 03:23:47 -0400
committerMarvin Mueller2016-07-28 09:14:02 -0400
commit42552b1a01b17ef4c3a674dd1bb6c61b5da5e648 (patch)
tree026719072541ec178c2515d15bc3e6548625ce82
parent6cf7785217762fe4b14b2426dffda5eb1441e4e7 (diff)
downloadorg.eclipse.jubula.core-42552b1a01b17ef4c3a674dd1bb6c61b5da5e648.tar.gz
org.eclipse.jubula.core-42552b1a01b17ef4c3a674dd1bb6c61b5da5e648.tar.xz
org.eclipse.jubula.core-42552b1a01b17ef4c3a674dd1bb6c61b5da5e648.zip
Extension Wizard - Fixed that only those component types are shown, whose tester / super class is knownv8.3.0.122
Change-Id: Ib329105d527212a284491a4f4f18354103d36d2b Signed-off-by: Kevin Barbe <kevin.barbe@bredex.de>
-rw-r--r--org.eclipse.jubula.extensions.wizard/resources/rrobot/extension.rtask2
-rw-r--r--org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/NewJubulaExtensionWizard.java69
-rw-r--r--org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/view/NewJubulaExtensionWizardPageThree.java7
3 files changed, 57 insertions, 21 deletions
diff --git a/org.eclipse.jubula.extensions.wizard/resources/rrobot/extension.rtask b/org.eclipse.jubula.extensions.wizard/resources/rrobot/extension.rtask
index 67c9c5c98..d9a422360 100644
--- a/org.eclipse.jubula.extensions.wizard/resources/rrobot/extension.rtask
+++ b/org.eclipse.jubula.extensions.wizard/resources/rrobot/extension.rtask
@@ -250,7 +250,7 @@ import ${SuperClassQualifier};
* provide testability for the selected component type.<br/>
* The following methods / classes can be quite handy for your actions:<br/>
* - <code>getRobot()</code> returns the Robot that offers several methods for
- * mouse interactions
+ * mouse interactions<br/>
* - <code>Verifier</code> handles comparisons for expected and actual values
* and automatically gives the result to Jubula, so your method
* does not need a return value<br/><br/>
diff --git a/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/NewJubulaExtensionWizard.java b/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/NewJubulaExtensionWizard.java
index 4d99c35cb..36f14275d 100644
--- a/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/NewJubulaExtensionWizard.java
+++ b/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/NewJubulaExtensionWizard.java
@@ -198,8 +198,53 @@ public final class NewJubulaExtensionWizard extends Wizard
}
}
- //CHECKSTYLE:OFF
+ /**
+ * Resolves the tester class qualifier of the component's type
+ * @param componentTypeQualifier the component's type qualifier
+ * @return the tester class qualifier or <code>null</code> if it could not
+ * be found
+ */
+ public static String resolveTesterClass(
+ final String componentTypeQualifier) {
+
+ CompSystem compSystem = ComponentBuilder.getInstance().getCompSystem();
+ Component typeComponent = compSystem
+ .findComponent(componentTypeQualifier);
+
+ if (typeComponent instanceof ConcreteComponent) {
+ return ((ConcreteComponent) typeComponent)
+ .getTesterClass();
+ }
+
+ return null;
+ }
+
+ /**
+ * Looks up the tester class for abstract and concrete components in the
+ * tester class map
+ * @param componentTypeQualifier the component type's qualifier
+ * @return the looked up tester class qualifier or <code>null</code> if it
+ * could not be found
+ */
+ public static String lookupTesterClassInMap(
+ final String componentTypeQualifier) {
+
+ Properties prop = new Properties();
+
+ try (InputStream input = NewJubulaExtensionWizard.class
+ .getResourceAsStream(
+ Messages.TesterClassMapProperties)) {
+
+ prop.load(input);
+ return prop.getProperty(componentTypeQualifier);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ //CHECKSTYLE:OFF
+
/**
* Initializes the robot values
* @param task the RobotTask to initialize
@@ -238,30 +283,14 @@ public final class NewJubulaExtensionWizard extends Wizard
} else {
Component typeComponent = compSystem
.findComponent(componentTypeQualifier);
- String testerClass;
- if (typeComponent instanceof ConcreteComponent) {
- testerClass = ((ConcreteComponent) typeComponent)
- .getTesterClass();
- } else {
- testerClass = null;
- }
+ String testerClass = resolveTesterClass(componentTypeQualifier);
if (testerClass != null) {
superClassQualifier = testerClass;
superClassName = superClassQualifier
.substring(superClassQualifier.lastIndexOf('.') + 1);
} else {
- Properties prop = new Properties();
-
- try (InputStream input = this.getClass()
- .getResourceAsStream(
- Messages.TesterClassMapProperties)) {
- prop.load(input);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
String testerClassQualifier =
- prop.getProperty(componentTypeQualifier);
+ lookupTesterClassInMap(componentTypeQualifier);
if (testerClassQualifier != null) {
superClassQualifier = testerClassQualifier;
@@ -434,6 +463,8 @@ public final class NewJubulaExtensionWizard extends Wizard
}
});
}
+
+
//CHECKSTYLE:ON
diff --git a/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/view/NewJubulaExtensionWizardPageThree.java b/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/view/NewJubulaExtensionWizardPageThree.java
index f8af89eba..5b0bf841d 100644
--- a/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/view/NewJubulaExtensionWizardPageThree.java
+++ b/org.eclipse.jubula.extensions.wizard/src/org/eclipse/jubula/extensions/wizard/view/NewJubulaExtensionWizardPageThree.java
@@ -25,6 +25,7 @@ import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.jubula.extensions.wizard.NewJubulaExtensionWizard;
import org.eclipse.jubula.extensions.wizard.i18n.Messages;
import org.eclipse.jubula.extensions.wizard.model.Storage;
import org.eclipse.jubula.extensions.wizard.utils.Status;
@@ -646,7 +647,11 @@ public final class NewJubulaExtensionWizardPageThree extends WizardPage {
types.forEach(new Consumer<String>() {
@Override
public void accept(String c) {
- m_componentType.add(c);
+ if ((NewJubulaExtensionWizard.resolveTesterClass(c)
+ != null) || NewJubulaExtensionWizard
+ .lookupTesterClassInMap(c) != null) {
+ m_componentType.add(c);
+ }
}
});

Back to the top