use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class RenameJavaClassSwtBotTest method renameJavaClassXtendReference.
@Test
public void renameJavaClassXtendReference() {
SWTWorkbenchBot _bot = this.getBot();
StringConcatenation _builder = new StringConcatenation();
_builder.append("package test;");
_builder.newLine();
_builder.append("public class JavaClass {}");
_builder.newLine();
final SWTBotEclipseEditor javaEditor = SwtBotProjectHelper.newJavaEditor(_bot, "JavaClass", "test", _builder);
SWTWorkbenchBot _bot_1 = this.getBot();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package test");
_builder_1.newLine();
_builder_1.append("class XtendClass extends ?JavaClass? {");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final SWTBotEclipseEditor xtendEditor = SwtBotProjectHelper.newXtendEditor(_bot_1, "XtendClass", "test", _builder_1);
this.renameInXtendEditor(xtendEditor, "NewJavaClass", "Rename Type");
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("package test");
_builder_2.newLine();
_builder_2.append("class XtendClass extends NewJavaClass {");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
this.assertEquals(_builder_2, xtendEditor.getText());
Assert.assertFalse(xtendEditor.isDirty());
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("package test;");
_builder_3.newLine();
_builder_3.append("public class NewJavaClass {}");
_builder_3.newLine();
this.assertEquals(_builder_3, javaEditor.getText());
Assert.assertFalse(javaEditor.isDirty());
this.assertEquals("NewJavaClass.java", javaEditor.getTitle());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class RenameXtendClassBug516096SwtBotTest method testBug516096.
@Test
public void testBug516096() {
final String projectName = "this is a test";
SwtBotProjectHelper.newXtendProject(this.getBot(), projectName);
SWTBotEclipseEditor _newXtendEditor = SwtBotProjectHelper.newXtendEditor(this.getBot(), "Foo", "", (projectName + "/src"));
final Procedure1<SWTBotEclipseEditor> _function = (SWTBotEclipseEditor it) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class ?Foo? {}");
_builder.newLine();
SwtBotProjectHelper.setContent(it, _builder);
};
final SWTBotEclipseEditor fooEditor = ObjectExtensions.<SWTBotEclipseEditor>operator_doubleArrow(_newXtendEditor, _function);
this.renameInXtendEditor(fooEditor, "Bar", "Rename Element");
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Bar {}");
_builder.newLine();
this.assertEquals(_builder, fooEditor.getText());
this.assertEquals("Bar.xtend", fooEditor.getTitle());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class RenameXtendClassSwtBotTest method renameXtendClass.
@Test
public void renameXtendClass() {
SWTWorkbenchBot _bot = this.getBot();
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo extends Bar {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final SWTBotEclipseEditor fooEditor = SwtBotProjectHelper.newXtendEditor(_bot, "Foo", _builder);
SWTWorkbenchBot _bot_1 = this.getBot();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class ?Bar? {}");
_builder_1.newLine();
final SWTBotEclipseEditor barEditor = SwtBotProjectHelper.newXtendEditor(_bot_1, "Bar", _builder_1);
this.renameInXtendEditor(barEditor, "NewBar", "Rename Element");
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("class Foo extends NewBar {");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
this.assertEquals(_builder_2, fooEditor.getText());
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("class NewBar {}");
_builder_3.newLine();
this.assertEquals(_builder_3, barEditor.getText());
this.assertEquals("NewBar.xtend", barEditor.getTitle());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class RenameXtendClassSwtBotTest method renameXtendClassReference.
@Test
public void renameXtendClassReference() {
SWTWorkbenchBot _bot = this.getBot();
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Bar {}");
_builder.newLine();
final SWTBotEclipseEditor barEditor = SwtBotProjectHelper.newXtendEditor(_bot, "Bar", _builder);
SWTWorkbenchBot _bot_1 = this.getBot();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class Foo extends ?Bar? {");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
final SWTBotEclipseEditor fooEditor = SwtBotProjectHelper.newXtendEditor(_bot_1, "Foo", _builder_1);
this.renameInXtendEditor(fooEditor, "NewBar", "Rename Element");
StringConcatenation _builder_2 = new StringConcatenation();
_builder_2.append("class Foo extends NewBar {");
_builder_2.newLine();
_builder_2.append("}");
_builder_2.newLine();
this.assertEquals(_builder_2, fooEditor.getText());
StringConcatenation _builder_3 = new StringConcatenation();
_builder_3.append("class NewBar {}");
_builder_3.newLine();
this.assertEquals(_builder_3, barEditor.getText());
this.assertEquals("NewBar.xtend", barEditor.getTitle());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project linuxtools by eclipse.
the class TestCreateSystemtapScript method testTapsetContents.
@Test
public void testTapsetContents() {
// Create a blank script and add a function to it while it's open.
String scriptName = "probeScript.stp";
createScript(bot, scriptName);
SWTBotView funcView = bot.viewByTitle("Function");
funcView.setFocus();
SWTBotTree funcTree = funcView.bot().tree();
SWTBotTreeItem item = funcTree.getTreeItem(funcNodeName);
item.doubleClick();
SWTBotEclipseEditor editor = bot.activeEditor().toTextEditor();
assertTrue(editor.getText().contains(item.getText()));
// Open a non-stap file and add a probe. This should bring up a dialog
// asking if the function should be added to the only open .stp file.
clickMainMenu("File", "New", "Other...");
SWTBotShell shell = bot.shell("New");
shell.setFocus();
shell.bot().text().setText("Untitled Text File");
bot.waitUntil(new NodeAvailableAndSelect(bot.tree(), "General", "Untitled Text File"));
bot.button("Finish").click();
bot.waitUntil(Conditions.shellCloses(shell));
SWTBotView probeView = bot.viewByTitle("Probe Alias");
probeView.setFocus();
SWTBotTree probeTree = probeView.bot().tree();
SWTBotTreeItem probeCategory = probeTree.getTreeItem(probeCategoryFull);
probeCategory.expand();
bot.waitUntil(new TreeItemPopulated(probeCategory));
String dialogTitle = "Select Script";
item = probeCategory.getNode(probeGroup);
item.expand();
bot.waitUntil(new TreeItemPopulated(item));
item = item.getNode(0);
item.doubleClick();
{
Matcher<Shell> withText = withText(dialogTitle);
bot.waitUntil(Conditions.waitForShell(withText));
}
shell = bot.shell(dialogTitle);
shell.setFocus();
bot.button("Yes").click();
bot.waitUntil(Conditions.shellCloses(shell));
// The editor containing the script should now be in focus.
bot.waitUntil(new EditorIsActive(scriptName));
assertTrue(wasProbeInserted(editor, item, false));
// Open the probe's definition file (an .stp script).
probeView.show();
item.contextMenu("View Definition").click();
bot.waitUntil(new EditorIsActive(probeDef.getName()));
// Adding a probe while an .stp editor is in focus should always add it
// to that editor, even if multiple .stp editors are open.
item = probeCategory.getNode(probeGroup);
item.doubleClick();
assertTrue(wasProbeInserted(bot.activeEditor().toTextEditor(), item, true));
assertFalse(wasProbeInserted(editor, item, true));
// Switch to the non-stp editor, and add a probe. A dialog should appear
// to let the user choose which of the open files to add to.
editor = bot.editorByTitle("Untitled 1").toTextEditor();
editor.show();
item = probeCategory.getNode(probeSingleWithoutDef);
item.doubleClick();
shell = bot.shell(dialogTitle);
shell.setFocus();
SWTBotTable table = bot.table();
assertTrue(table.containsItem(scriptName));
assertTrue(table.containsItem(probeDef.getName()));
table.select(scriptName);
bot.button("OK").click();
bot.waitUntil(Conditions.shellCloses(shell));
bot.waitUntil(new EditorIsActive(scriptName));
assertTrue(wasProbeInserted(bot.activeEditor().toTextEditor(), item, false));
}
Aggregations