use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project eclipse-pmd by acanda.
the class JavaProjectClient method createFileInProject.
/**
* Creates a text file in a project.
*
* @param projectName The name of the existing project.
* @param relativePath The path of the file including the file name, relative to the project.
* @param content The content of the file.
*/
public static void createFileInProject(final String projectName, final Path relativePath, final String content) {
final SWTWorkbenchBot bot = new SWTWorkbenchBot();
bot.menu("File").menu("New").menu("File").click();
final SWTBotShell dialog = bot.shell("New File");
if (relativePath.getParent() != null) {
dialog.bot().text(0).setText(projectName + "/" + relativePath.getParent().toString());
} else {
dialog.bot().text(0).setText(projectName);
}
dialog.bot().text(1).setText(relativePath.getFileName().toString());
dialog.bot().button("Finish").click();
final SWTBotEditor editor = bot.editorByTitle(relativePath.getFileName().toString());
editor.toTextEditor().setText(content);
editor.saveAndClose();
}
use of org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot in project eclipse-pmd by acanda.
the class GUITestCase method resetWorkbench.
@AfterClass
public static void resetWorkbench() {
final SWTWorkbenchBot workbenchBot = new SWTWorkbenchBot();
workbenchBot.resetWorkbench();
}
Aggregations