Search in sources :

Example 1 with SWTBot

use of org.eclipse.swtbot.swt.finder.SWTBot in project xtext-xtend by eclipse.

the class AbstractRefactoringSwtBotTest method renameInXtendEditor.

public void renameInXtendEditor(final SWTBotEclipseEditor xtendEditor, final String newName, final String dialogName) {
    final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(xtendEditor, "Refactor", "Rename Element");
    renameMenuItem.click();
    boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
    if (_isUseInlineRefactoring) {
        this.waitForLinkedMode();
        xtendEditor.typeText(newName);
        boolean _isUsePreview = this.testParams.isUsePreview();
        if (_isUsePreview) {
            xtendEditor.pressShortcut(SWT.CTRL, SWT.CR);
            AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
            AbstractRefactoringSwtBotTest.bot.button("OK").click();
        } else {
            xtendEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
        }
    } else {
        SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
        final Procedure1<SWTBot> _function = (SWTBot it) -> {
            SWTBotText _textWithLabel = it.textWithLabel("New name:");
            _textWithLabel.setText(newName);
            boolean _isUsePreview_1 = this.testParams.isUsePreview();
            if (_isUsePreview_1) {
                it.button("Preview >").click();
            }
            it.button("OK").click();
        };
        ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
    }
    this.waitForRefactoring(xtendEditor);
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText)

Example 2 with SWTBot

use of org.eclipse.swtbot.swt.finder.SWTBot in project xtext-xtend by eclipse.

the class AbstractRefactoringSwtBotTest method undo.

public void undo(final SWTBotEclipseEditor editor) {
    editor.setFocus();
    editor.pressShortcut(SWT.MOD1, 'Z');
    AbstractRefactoringSwtBotTest.bot.shell("Undo").activate();
    AbstractRefactoringSwtBotTest.bot.button("OK").click();
    SWTBot _sWTBot = new SWTBot();
    WaitForRefactoringCondition _waitForRefactoringCondition = new WaitForRefactoringCondition(editor, true);
    _sWTBot.waitUntil(_waitForRefactoringCondition, 15000);
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) WaitForRefactoringCondition(org.eclipse.xtend.ide.tests.WaitForRefactoringCondition)

Example 3 with SWTBot

use of org.eclipse.swtbot.swt.finder.SWTBot in project xtext-xtend by eclipse.

the class AbstractRefactoringSwtBotTest method waitForRefactoring.

protected void waitForRefactoring(final SWTBotEclipseEditor editor) {
    SWTBot _sWTBot = new SWTBot();
    WaitForRefactoringCondition _waitForRefactoringCondition = new WaitForRefactoringCondition(editor, false);
    _sWTBot.waitUntil(_waitForRefactoringCondition, 15000);
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) WaitForRefactoringCondition(org.eclipse.xtend.ide.tests.WaitForRefactoringCondition)

Example 4 with SWTBot

use of org.eclipse.swtbot.swt.finder.SWTBot in project xtext-xtend by eclipse.

the class AbstractRefactoringSwtBotTest method renameInJavaEditor.

public void renameInJavaEditor(final SWTBotEclipseEditor javaEditor, final String newName, final String dialogName) {
    final SWTBotMenu renameMenuItem = SwtBotProjectHelper.clickableContextMenu(javaEditor, "Refactor", "Rename...");
    renameMenuItem.click();
    boolean _isUseInlineRefactoring = this.testParams.isUseInlineRefactoring();
    if (_isUseInlineRefactoring) {
        javaEditor.typeText(newName);
        boolean _isUsePreview = this.testParams.isUsePreview();
        if (_isUsePreview) {
            javaEditor.pressShortcut(SWT.CTRL, SWT.CR);
            AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate();
            AbstractRefactoringSwtBotTest.bot.button("OK").click();
        } else {
            javaEditor.pressShortcut(KeyStroke.getInstance(SWT.LF));
        }
    } else {
        SWTBot _bot = AbstractRefactoringSwtBotTest.bot.shell(dialogName).activate().bot();
        final Procedure1<SWTBot> _function = (SWTBot it) -> {
            SWTBotText _textWithLabel = it.textWithLabel("New name:");
            _textWithLabel.setText(newName);
            boolean _isUsePreview_1 = this.testParams.isUsePreview();
            if (_isUsePreview_1) {
                it.button("Next").click();
            }
            it.button("Finish").click();
        };
        ObjectExtensions.<SWTBot>operator_doubleArrow(_bot, _function);
    }
    this.waitForRefactoring(javaEditor);
}
Also used : SWTBot(org.eclipse.swtbot.swt.finder.SWTBot) SWTBotMenu(org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu) SWTBotText(org.eclipse.swtbot.swt.finder.widgets.SWTBotText)

Example 5 with SWTBot

use of org.eclipse.swtbot.swt.finder.SWTBot in project xtext-xtend by eclipse.

the class AbstractRefactoringSwtBotTest method waitForLinkedMode.

protected void waitForLinkedMode() {
    SWTBot _sWTBot = new SWTBot();
    WaitForLinkedModeCondition _waitForLinkedModeCondition = new WaitForLinkedModeCondition(this.controller);
    _sWTBot.waitUntil(_waitForLinkedModeCondition);
}
Also used : WaitForLinkedModeCondition(org.eclipse.xtend.ide.tests.WaitForLinkedModeCondition) SWTBot(org.eclipse.swtbot.swt.finder.SWTBot)

Aggregations

SWTBot (org.eclipse.swtbot.swt.finder.SWTBot)8 SWTBotShell (org.eclipse.swtbot.swt.finder.widgets.SWTBotShell)3 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)2 SWTBotMenu (org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu)2 SWTBotText (org.eclipse.swtbot.swt.finder.widgets.SWTBotText)2 WaitForRefactoringCondition (org.eclipse.xtend.ide.tests.WaitForRefactoringCondition)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IFile (org.eclipse.core.resources.IFile)1 Path (org.eclipse.core.runtime.Path)1 ProjectExplorerTreeItemAppearsCondition (org.eclipse.linuxtools.changelog.ui.tests.utils.ProjectExplorerTreeItemAppearsCondition)1 TableAppearsCondition (org.eclipse.linuxtools.changelog.ui.tests.utils.TableAppearsCondition)1 SWTBotEclipseEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor)1 SWTBotEditor (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor)1 SWTBotTable (org.eclipse.swtbot.swt.finder.widgets.SWTBotTable)1 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)1 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)1 IEditorReference (org.eclipse.ui.IEditorReference)1 WaitForLinkedModeCondition (org.eclipse.xtend.ide.tests.WaitForLinkedModeCondition)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1