Author: jjankovi
Date: 2012-01-16 03:32:44 -0500 (Mon, 16 Jan 2012)
New Revision: 37851
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java
Log:
new method for copying content from resource with entered parameter to class opened in
Eclipse editor
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java 2012-01-16
08:26:13 UTC (rev 37850)
+++
trunk/cdi/tests/org.jboss.tools.cdi.bot.test/src/org/jboss/tools/cdi/bot/test/uiutils/EditorResourceHelper.java 2012-01-16
08:32:44 UTC (rev 37851)
@@ -13,6 +13,7 @@
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
import java.util.Scanner;
import org.eclipse.core.resources.IFile;
@@ -50,6 +51,23 @@
}
/**
+ * Method copies resource to class opened in SWTBotEditor with entered parameters
+ * @param classEdit
+ * @param resource
+ * @param closeEdit
+ * @param param
+ */
+ public void replaceClassContentByResource(InputStream resource, boolean closeEdit,
Object... param) {
+ SWTBotEclipseEditor classEdit = getEd().toTextEditor();
+ 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();
+ if (closeEdit) classEdit.close();
+ }
+
+ /**
* method copies resource from folder "src" param to folder "target"
param
* @param src
* @param target
Show replies by date