use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class RenameJavaClassSwtBotTest method renameJavaClass.
@Test
public void renameJavaClass() {
SWTWorkbenchBot _bot = this.getBot();
StringConcatenation _builder = new StringConcatenation();
_builder.append("package test");
_builder.newLine();
_builder.append("class XtendClass extends JavaClass {");
_builder.newLine();
_builder.append("}");
_builder.newLine();
final SWTBotEclipseEditor xtendEditor = SwtBotProjectHelper.newXtendEditor(_bot, "XtendClass", "test", _builder);
SWTWorkbenchBot _bot_1 = this.getBot();
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("package test;");
_builder_1.newLine();
_builder_1.append("public class ?JavaClass? {}");
_builder_1.newLine();
final SWTBotEclipseEditor javaEditor = SwtBotProjectHelper.newJavaEditor(_bot_1, "JavaClass", "test", _builder_1);
this.renameInJavaEditor(javaEditor, "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 RenameXtendClassSwtBotTest method renameXtendClassWithAA.
@Test
public void renameXtendClassWithAA() {
SWTWorkbenchBot _bot = this.getBot();
StringConcatenation _builder = new StringConcatenation();
_builder.append("import org.eclipse.xtend.lib.annotations.Data");
_builder.newLine();
_builder.append("@Data");
_builder.newLine();
_builder.append("class ?Fonk? {}");
_builder.newLine();
final SWTBotEclipseEditor barEditor = SwtBotProjectHelper.newXtendEditor(_bot, "Fonk", _builder);
this.renameInXtendEditor(barEditor, "NewFonk", "Rename Element");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("import org.eclipse.xtend.lib.annotations.Data");
_builder_1.newLine();
_builder_1.append("@Data");
_builder_1.newLine();
_builder_1.append("class NewFonk {}");
_builder_1.newLine();
this.assertEquals(_builder_1, barEditor.getText());
this.assertEquals("NewFonk.xtend", barEditor.getTitle());
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class SwtBotProjectHelper method newXtendEditor.
public static SWTBotEclipseEditor newXtendEditor(final SWTWorkbenchBot it, final String typeName, final CharSequence content) {
SWTBotEclipseEditor _newXtendEditor = SwtBotProjectHelper.newXtendEditor(it, typeName, "", (SwtBotProjectHelper.defaultProject + "/src"));
final Procedure1<SWTBotEclipseEditor> _function = (SWTBotEclipseEditor it_1) -> {
SwtBotProjectHelper.setContent(it_1, content);
};
return ObjectExtensions.<SWTBotEclipseEditor>operator_doubleArrow(_newXtendEditor, _function);
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class SwtBotProjectHelper method newJavaEditor.
public static SWTBotEclipseEditor newJavaEditor(final SWTWorkbenchBot it, final String typeName, final CharSequence content) {
SWTBotEclipseEditor _newJavaEditor = SwtBotProjectHelper.newJavaEditor(it, typeName, "", (SwtBotProjectHelper.defaultProject + "/src"));
final Procedure1<SWTBotEclipseEditor> _function = (SWTBotEclipseEditor it_1) -> {
SwtBotProjectHelper.setContent(it_1, content);
};
return ObjectExtensions.<SWTBotEclipseEditor>operator_doubleArrow(_newJavaEditor, _function);
}
use of org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor in project xtext-xtend by eclipse.
the class SwtBotProjectHelper method newXtendEditor.
public static SWTBotEclipseEditor newXtendEditor(final SWTWorkbenchBot it, final String typeName, final String packageName, final String sourceFolderPath) {
SWTBotEclipseEditor _xblockexpression = null;
{
try {
SwtBotProjectHelper.fileNew(it, "Xtend Class");
} catch (final Throwable _t) {
if (_t instanceof WidgetNotFoundException) {
final WidgetNotFoundException e = (WidgetNotFoundException) _t;
final Consumer<SWTBotShell> _function = (SWTBotShell it_1) -> {
StringConcatenation _builder = new StringConcatenation();
_builder.append("Shell: \'");
String _text = it_1.getText();
_builder.append(_text);
_builder.append("\', active: ");
boolean _isActive = it_1.isActive();
_builder.append(_isActive);
InputOutput.<String>println(_builder.toString());
};
((List<SWTBotShell>) Conversions.doWrapArray(it.shells())).forEach(_function);
StringConcatenation _builder = new StringConcatenation();
_builder.append(SWTBotPreferences.SCREENSHOTS_DIR);
_builder.append("/MenuFileNotFound");
long _currentTimeMillis = System.currentTimeMillis();
_builder.append(_currentTimeMillis);
_builder.append(".");
_builder.append(SWTBotPreferences.SCREENSHOT_FORMAT);
final Function1<SWTBotShell, Boolean> _function_1 = (SWTBotShell it_1) -> {
return Boolean.valueOf(it_1.isActive());
};
SWTUtils.captureScreenshot(_builder.toString(), IterableExtensions.<SWTBotShell>head(IterableExtensions.<SWTBotShell>filter(((Iterable<SWTBotShell>) Conversions.doWrapArray(it.shells())), _function_1)).widget);
throw e;
} else {
throw Exceptions.sneakyThrow(_t);
}
}
it.shell("Xtend Class").activate();
SWTBotText _textWithLabel = it.textWithLabel("Source folder:");
_textWithLabel.setText(sourceFolderPath);
SWTBotText _textWithLabel_1 = it.textWithLabel("Package:");
_textWithLabel_1.setText(packageName);
SWTBotText _textWithLabel_2 = it.textWithLabel("Name:");
_textWithLabel_2.setText(typeName);
it.button("Finish").click();
_xblockexpression = it.editorByTitle((typeName + ".xtend")).toTextEditor();
}
return _xblockexpression;
}
Aggregations