Author: rhopp
Date: 2012-01-31 06:54:50 -0500 (Tue, 31 Jan 2012)
New Revision: 38325
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTFormsBotExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/.settings/org.eclipse.jdt.core.prefs
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotFactory.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotSection.java
Log:
Added basic support for FormText, new Labels in IDELabel & support for Twistie.
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/.settings/org.eclipse.jdt.core.prefs 2012-01-31
11:48:05 UTC (rev 38324)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/.settings/org.eclipse.jdt.core.prefs 2012-01-31
11:54:50 UTC (rev 38325)
@@ -1,4 +1,4 @@
-#Tue Nov 02 16:59:13 EET 2010
+#Tue Nov 22 17:51:41 CET 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotFactory.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotFactory.java 2012-01-31
11:48:05 UTC (rev 38324)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTBotFactory.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -19,6 +19,7 @@
protected static final SWTUtilExt util = new SWTUtilExt(bot);
protected static final SWTOpenExt open = new SWTOpenExt(bot);
protected static final SWTJBTExt jbt = new SWTJBTExt(bot);
+ protected static final SWTFormsBotExt formsBot = new SWTFormsBotExt();
// Views
protected static final PackageExplorer packageExplorer = new PackageExplorer();
@@ -31,6 +32,10 @@
return bot;
}
+ public static SWTFormsBotExt getFormsBot() {
+ return formsBot;
+ }
+
public static SWTEclipseExt getEclipse() {
return eclipse;
}
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTFormsBotExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTFormsBotExt.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTFormsBotExt.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -0,0 +1,64 @@
+package org.jboss.tools.ui.bot.ext;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.forms.finder.SWTFormsBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotFormTextExt;
+
+
+/**
+ * Extended version of SWTFormsBot with formText recognition capabilities
+ *
+ *
+ * @author rhopp
+ *
+ */
+
+public class SWTFormsBotExt extends SWTFormsBot{
+
+ public SWTBotFormTextExt formText(){
+ return formText(0);
+ }
+
+ @SuppressWarnings("unchecked")
+ public SWTBotFormTextExt formText(int index){
+ try{
+ List<FormText> formTexts = (List<FormText>)
widgets(widgetOfType(FormText.class));
+ return new SWTBotFormTextExt(formTexts.get(index));
+ }catch(WidgetNotFoundException ex){
+ throw new WidgetNotFoundException("Could not find widget of type FormText",
ex);
+ }catch(ArrayIndexOutOfBoundsException ex){
+ throw new ArrayIndexOutOfBoundsException("There is widget Form Text with such a
index");
+ }
+ }
+
+ public SWTBotFormTextExt formTextWithText(String text){
+ return formTextWithText(text, 0);
+ }
+
+ @SuppressWarnings("unchecked")
+ public SWTBotFormTextExt formTextWithText(String text, int index){
+ try{
+ List<SWTBotFormTextExt> formTextBots = new
ArrayList<SWTBotFormTextExt>();
+ List<FormText> formTexts = (List<FormText>)
widgets(widgetOfType(FormText.class));
+ for (FormText formText : formTexts) {
+ SWTBotFormTextExt auxBotFormTextExt = new SWTBotFormTextExt(formText);
+ String textik = auxBotFormTextExt.getText();
+ if (textik.equals(text)){
+ formTextBots.add(auxBotFormTextExt);
+ }
+ }
+ return formTextBots.get(index);
+ }catch(WidgetNotFoundException ex){
+ throw new WidgetNotFoundException("Could not find widget of type FormText",
ex);
+ }catch(IndexOutOfBoundsException ex){
+ throw new ArrayIndexOutOfBoundsException("There is widget Form Text with such a
index");
+ }
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTFormsBotExt.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java 2012-01-31
11:48:05 UTC (rev 38324)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/gen/ActionItem.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -599,6 +599,63 @@
}
};
}
+
+ public static class GitGitRepositories {
+ /**
+ * respresents item : Git->Git Repositories
+ */
+ public static final IView LABEL = new IView() {
+ public String getName() {return "Git Repositories";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("Git");
+ return l;
+ }
+ };
+ }
+
+ public static class GitGitReflog {
+ /**
+ * respresents item : Git->Git Reflog
+ */
+ public static final IView LABEL = new IView() {
+ public String getName() {return "Git Reflog";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("Git");
+ return l;
+ }
+ };
+ }
+
+ public static class GitGitStaging {
+ /**
+ * respresents item : Git->Git Staging
+ */
+ public static final IView LABEL = new IView() {
+ public String getName() {return "Git Staging";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("Git");
+ return l;
+ }
+ };
+ }
+
+ public static class GitGitTreeCompare {
+ /**
+ * respresents item : Git->Git Tree Compare
+ */
+ public static final IView LABEL = new IView() {
+ public String getName() {return "Git Tree Compare";}
+ public List<String> getGroupPath() {
+ List<String> l = new Vector<String>();
+ l.add("Git");
+ return l;
+ }
+ };
+ }
+
public static class SpringBeansCrossReferences {
/**
* represents item : Spring->Beans Cross References
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -0,0 +1,90 @@
+package org.jboss.tools.ui.bot.ext.parts;
+
+import java.lang.reflect.Field;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swtbot.swt.finder.ReferenceBy;
+import org.eclipse.swtbot.swt.finder.SWTBotWidget;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.results.StringResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.internal.forms.widgets.FormTextModel;
+import org.hamcrest.SelfDescribing;
+
+@SWTBotWidget(clasz = FormText.class, preferredName="formText", referenceBy = {
ReferenceBy.MNEMONIC })
+public class SWTBotFormTextExt extends AbstractSWTBotControl<FormText>{
+
+ public SWTBotFormTextExt(FormText w) throws WidgetNotFoundException {
+ super(w);
+ }
+
+ public SWTBotFormTextExt(FormText w, SelfDescribing description)
+ throws WidgetNotFoundException {
+ super(w, description);
+ }
+
+ public String selectionText() {
+ return syncExec(new StringResult() {
+
+ @Override
+ public String run() {
+ return widget.getSelectionText();
+ }
+ });
+ }
+
+ public AbstractSWTBotControl<FormText> click() {
+ Event e = createEvent();
+ e.text = getText();
+ notify(SWT.MouseDown, e);
+ return click(true);
+ }
+
+ public String selectedLinkText() {
+ return syncExec(new StringResult() {
+
+ @Override
+ public String run() {
+ return widget.getSelectedLinkText();
+ }
+ });
+ }
+
+ public String toolTipText() {
+ return syncExec(new StringResult() {
+
+ @Override
+ public String run() {
+ return widget.getToolTipText();
+ }
+ });
+ }
+
+ @Override
+ @SuppressWarnings("restriction")
+ public String getText() {
+ Field field;
+ try {
+ field = widget.getClass().getDeclaredField("model");
+ } catch (SecurityException e1) {
+ throw new SecurityException(e1);
+ } catch (NoSuchFieldException e1) {
+ throw new SecurityException(e1);
+ }
+ FormTextModel model;
+ field.setAccessible(true);
+ try {
+ model = (FormTextModel)field.get(widget);
+ } catch (IllegalArgumentException e1) {
+ throw new SecurityException(e1);
+ } catch (IllegalAccessException e1) {
+ throw new SecurityException(e1);
+ }
+ return model.getAccessibleText().trim();
+
+ }
+
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotFormTextExt.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -0,0 +1,73 @@
+package org.jboss.tools.ui.bot.ext.parts;
+
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swtbot.swt.finder.ReferenceBy;
+import org.eclipse.swtbot.swt.finder.SWTBotWidget;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.results.BoolResult;
+import org.eclipse.swtbot.swt.finder.results.StringResult;
+import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
+import org.eclipse.ui.forms.widgets.Twistie;
+import org.hamcrest.SelfDescribing;
+
+@SWTBotWidget(clasz = Twistie.class, preferredName="twistie", referenceBy = {
ReferenceBy.LABEL})
+public class SWTBotTwistie extends AbstractSWTBotControl<Twistie>{
+
+ public SWTBotTwistie(Twistie w) throws WidgetNotFoundException {
+ super(w);
+ }
+
+ public SWTBotTwistie(Twistie w, SelfDescribing description)
+ throws WidgetNotFoundException {
+ super(w, description);
+ }
+ /**
+ * Returns text of the first sibling label
+ * @return text of the first sibling Label (or CLabel) or null if there is no Label
+ */
+
+ public String getLabelText(){
+ return syncExec(new StringResult() {
+ @Override
+ public String run() {
+ Control[] aux = widget.getParent().getChildren();
+ for (Control control : aux) {
+ if (control instanceof CLabel){
+ return ((CLabel)control).getText();
+ }
+ if (control instanceof Label){
+ return ((Label)control).getText();
+ }
+ }
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Toggles twistie (expands its section)
+ */
+ public AbstractSWTBotControl<Twistie> toggle() {
+ setFocus();
+ keyboard().typeCharacter('\r');
+ return this;
+ }
+
+
+ /**
+ * Checks whether the Twistie is expanded
+ * @return true if Twistie is expanded
+ */
+ public boolean isExpanded(){
+ return syncExec(new BoolResult() {
+
+ @Override
+ public Boolean run() {
+ return widget.isExpanded();
+ }
+ });
+ }
+
+}
Property changes on:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/parts/SWTBotTwistie.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-01-31
11:48:05 UTC (rev 38324)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/types/IDELabel.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -271,6 +271,10 @@
public static final String JBOSS_TOOLS_PALETTE = "JBoss Tools Palette";
public static final String PALETTE = "Palette";
public static final String JBOSS_CENTRAL = "JBoss Central";
+ public static final String GIT_REPOSITORIES = "Git Repositories";
+ public static final String GIT_REFLOG = "Git Reflog";
+ public static final String GIT_STAGING = "Git Staging";
+ public static final String GIT_TREE_COMPARE = "Git Tree Compare";
public static final String AGENDA = "Agenda";
public static final String AUDIT = "Audit";
public static final String GLOBAL_DATA = "Global Data";
@@ -803,6 +807,21 @@
public static final String IMPLEMENTATION_COMBO_LABEL =
"Implementation:*";
}
+ public static class JBossCentralEditor{
+ public static final String JBOSS_CENTRAL = "JBoss Central";
+ public static final String DYNAMIC_WEB_PROJECT = "Dynamic Web Project";
+ public static final String JAVA_EE_WEB_PROJECT = "Java EE Web Project";
+ public static final String HTML5_PROJECT = "HTML5 Project";
+ public static final String RICHFACES_PROJECT = "RichFaces Project";
+ public static final String OPENSHIFT_APP = "OpenShift Express
Application";
+ public static final String JAVA_EE_PROJECT = "Java EE Project";
+ public static final String SPRING_MVC_PROJECT = "Spring MVC Project";
+ public static final String NEW_DYNAMIC_WEB_PROJECT = "New Dynamic Web
Project";
+ public static final String PROJECT_EXAMPLE = "Project Example";
+ public static final String NEW_JBOSS_PROJECT = "New JBoss Project";
+ public static final String OPENSHIFT_APP_WIZARD = "OpenShift application
wizard";
+ }
+
public static class NewViewDialog{
public static final String FROM_VIEW_ID_TEXT_LABEL = "From View ID:";
public static final String TEMPLATE_TEXT_LABEL = "Template:*";
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotSection.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotSection.java 2012-01-31
11:48:05 UTC (rev 38324)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/widgets/SWTBotSection.java 2012-01-31
11:54:50 UTC (rev 38325)
@@ -13,6 +13,11 @@
*/
public class SWTBotSection extends AbstractSWTBotControl<Section> {
+ @Override
+ protected AbstractSWTBotControl<Section> click(boolean post) {
+ // TODO Auto-generated method stub
+ return super.click(post);
+ }
private final SWTBot bot;
public SWTBotSection(Section w) throws WidgetNotFoundException {
super(w);
Show replies by date