Author: jjankovi
Date: 2012-04-30 07:45:53 -0400 (Mon, 30 Apr 2012)
New Revision: 40630
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java
Log:
overloaded methods copyResourceToClass and replaceInEditor added
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java 2012-04-30
11:44:24 UTC (rev 40629)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java 2012-04-30
11:45:53 UTC (rev 40630)
@@ -69,26 +69,31 @@
* @param replacement
*/
public void replaceInEditor(SWTBotEclipseEditor ed, String target, String replacement)
{
+ replaceInEditor(ed, target, replacement, true);
+ }
+
+ /**
+ * Method replaces string "target" by string "replacement.
+ * @param target
+ * @param replacement
+ */
+ public void replaceInEditor(SWTBotEclipseEditor ed, String target,
+ String replacement, boolean save) {
ed.selectRange(0, 0, ed.getText().length());
ed.setText(ed.getText().replace(target,replacement));
- ed.save();
+ if (save) ed.save();
}
-
/**
- * Method copies resource to class opened in SWTBotEditor
+ * Method copies resource to class opened in SWTBotEditor with entered parameters
* @param classEdit
* @param resource
* @param closeEdit
+ * @param param
*/
public void copyResourceToClass(SWTBotEditor classEdit,
- InputStream resource, boolean closeEdit) {
- SWTBotEclipseEditor st = classEdit.toTextEditor();
- st.selectRange(0, 0, st.getText().length());
- String code = readStream(resource);
- st.setText(code);
- classEdit.save();
- if (closeEdit) classEdit.close();
+ InputStream resource, boolean closeEdit, Object... param) {
+ copyResourceToClass(classEdit, resource, true, closeEdit, param);
}
/**
@@ -99,12 +104,13 @@
* @param param
*/
public void copyResourceToClass(SWTBotEditor classEdit,
- InputStream resource, boolean closeEdit, Object... param) {
+ InputStream resource, boolean save, boolean closeEdit, Object... param) {
String s = readStream(resource);
String code = MessageFormat.format(s, param);
- classEdit.toTextEditor().selectRange(0, 0,
classEdit.toTextEditor().getText().length());
- classEdit.toTextEditor().setText(code);
- classEdit.save();
+ SWTBotEclipseEditor st = classEdit.toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ st.setText(code);
+ if (save) classEdit.save();
if (closeEdit) classEdit.close();
}
Show replies by date