Search in sources :

Example 11 with SWTBotEclipseEditor

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());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractRefactoringSwtBotTest(org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)

Example 12 with SWTBotEclipseEditor

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());
}
Also used : SWTWorkbenchBot(org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot) SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test) AbstractRefactoringSwtBotTest(org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)

Example 13 with SWTBotEclipseEditor

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);
}
Also used : SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)

Example 14 with SWTBotEclipseEditor

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);
}
Also used : SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)

Example 15 with SWTBotEclipseEditor

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;
}
Also used : WidgetNotFoundException(org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException) SWTBotEclipseEditor(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) List(java.util.List) SWTBotShell(org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)

Aggregations

SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)18 Test (org.junit.Test)14 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)7 Path (org.eclipse.core.runtime.Path)6 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)6 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)6 IEditorReference (org.eclipse.ui.IEditorReference)6 AbstractRefactoringSwtBotTest (org.eclipse.xtend.ide.tests.AbstractRefactoringSwtBotTest)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)5 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)5 Ignore (org.junit.Ignore)4 ProjectExplorerTreeItemAppearsCondition (org.eclipse.linuxtools.changelog.ui.tests.utils.ProjectExplorerTreeItemAppearsCondition)3 InputStream (java.io.InputStream)2 IFile (org.eclipse.core.resources.IFile)2 IResource (org.eclipse.core.resources.IResource)2 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)2 List (java.util.List)1 TableAppearsCondition (org.eclipse.linuxtools.changelog.ui.tests.utils.TableAppearsCondition)1 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)1