Search in sources :

Example 1 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project linuxtools by eclipse.

the class EditDockerFileTest method testEditDockerFile.

@Test
public void testEditDockerFile() {
    getConnection();
    DockerImagesTab imageTab = openDockerImagesTab();
    try {
        String dockerFilePath = new File(EDIT_DOCKERFILE_FOLDER).getCanonicalPath();
        getConnection();
        imageTab.activate();
        new DefaultToolItem("Build Image").click();
        new WaitUntil(new ShellIsAvailable("Build a Docker Image"));
        new LabeledText("Image Name:").setText(IMAGE_NAME);
        new LabeledText("Directory:").setText(dockerFilePath);
        new PushButton("Edit Dockerfile").click();
        new WaitUntil(new ShellIsAvailable("Dockerfile Editor"), TimePeriod.LONG);
        DefaultStyledText defaultStyledText = new DefaultStyledText();
        String editorText = defaultStyledText.getText();
        assertTrue("Editor is empty!", StringUtils.isNotEmpty(editorText));
        defaultStyledText.setText(BUILD_IMAGE);
        CTabFolder tabFolder = new DefaultCTabFolder();
        CTabItem tabItem = tabFolder.getSelection();
        KeyboardFactory.getKeyboard().invokeKeyCombination(SWT.CTRL, 'S');
        tabItem.close();
        new DefaultShell("Build a Docker Image").setFocus();
        new FinishButton().click();
        new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG);
    } catch (IOException ex) {
        fail("Resource file not found!");
    }
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) CTabFolder(org.eclipse.reddeer.swt.api.CTabFolder) DefaultCTabFolder(org.eclipse.reddeer.swt.impl.ctab.DefaultCTabFolder) LabeledText(org.eclipse.reddeer.swt.impl.text.LabeledText) DockerImagesTab(org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab) DefaultToolItem(org.eclipse.reddeer.swt.impl.toolbar.DefaultToolItem) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning) IOException(java.io.IOException) CTabItem(org.eclipse.reddeer.swt.api.CTabItem) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) DefaultCTabFolder(org.eclipse.reddeer.swt.impl.ctab.DefaultCTabFolder) WaitUntil(org.eclipse.reddeer.common.wait.WaitUntil) PushButton(org.eclipse.reddeer.swt.impl.button.PushButton) File(java.io.File) Test(org.junit.Test)

Example 2 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project jbosstools-hibernate by jbosstools.

the class JpaXmlEditor method getSourceText.

/**
 * Returns editor's source text
 * @return editor source text
 */
public String getSourceText() {
    activateSourceTab();
    DefaultStyledText dst = new DefaultStyledText(this);
    String source = dst.getText();
    return source;
}
Also used : DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)

Example 3 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project jbosstools-hibernate by jbosstools.

the class CodeGenerationKeyWordsTest method createRevengFile.

private void createRevengFile() {
    ProjectExplorer pe = new ProjectExplorer();
    pe.open();
    pe.selectProjects(prj);
    NewReverseEngineeringFileWizard wizard = new NewReverseEngineeringFileWizard();
    wizard.open();
    wizard.next();
    TableFilterWizardPage page = new TableFilterWizardPage(wizard);
    page.setConsoleConfiguration(prj);
    page.refreshDatabaseSchema();
    page.pressInclude();
    wizard.finish();
    ReverseEngineeringEditor re = new ReverseEngineeringEditor();
    re.activateSourceTab();
    DefaultStyledText ds = new DefaultStyledText();
    ds.selectPosition(ds.getPositionOfText("</hibernate-reverse-engineering>"));
    ds.insertText("<table catalog=\"SAKILA\" schema=\"PUBLIC\" name=\"ACTOR\">" + "<column name=\"FIRST_NAME\" property=\"implements\" type=\"string\" /></table>");
    re.save();
}
Also used : ProjectExplorer(org.eclipse.reddeer.eclipse.ui.navigator.resources.ProjectExplorer) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) ReverseEngineeringEditor(org.jboss.tools.hibernate.reddeer.mapper.editors.ReverseEngineeringEditor) NewReverseEngineeringFileWizard(org.jboss.tools.hibernate.reddeer.console.wizards.NewReverseEngineeringFileWizard) TableFilterWizardPage(org.jboss.tools.hibernate.reddeer.console.wizards.TableFilterWizardPage)

Example 4 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project jbosstools-hibernate by jbosstools.

the class JPADetailsViewTest method testJPADetailView.

@Test
public void testJPADetailView() {
    ProjectUtils.getItem(PRJ, "org.gen", "Actor.java").open();
    TextEditor textEditor = new TextEditor("Actor.java");
    textEditor.setCursorPosition(20, 1);
    JPADetailsView jpaDetailsView = new JPADetailsView();
    jpaDetailsView.open();
    try {
        new DefaultStyledText("Type 'Actor' is mapped as entity.");
    } catch (RedDeerException e) {
        fail("JPA details should be available - known issue - https://issues.jboss.org/browse/JBIDE-17940");
    }
}
Also used : JPADetailsView(org.jboss.tools.hibernate.reddeer.view.JPADetailsView) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) TextEditor(org.eclipse.reddeer.workbench.impl.editor.TextEditor) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) Test(org.junit.Test)

Example 5 with DefaultStyledText

use of org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText in project jbosstools-openshift by jbosstools.

the class ServerAdapterFromResourceTest method newAdapterFromResource.

private void newAdapterFromResource(Resource type, String name) {
    project.refresh();
    project.getOpenShiftResource(type, name).select();
    new ContextMenuItem(OpenShiftLabel.ContextMenu.NEW_ADAPTER_FROM_EXPLORER).select();
    new DefaultShell(OpenShiftLabel.Shell.SERVER_ADAPTER_SETTINGS);
    String resourceType = null;
    String selectors = name + " name=" + name;
    if (type.equals(Resource.DEPLOYMENT)) {
        resourceType = "ReplicationController";
        selectors = name + " deploymentconfig=" + serviceReq.getService().getName() + ", name=" + serviceReq.getService().getName() + ", deployment=" + name;
    } else {
        resourceType = type.toString().replaceFirst(".$", "").replaceAll(" ", "");
    }
    assertTrue("Resource should be preselected for new OpenShift 3 server adapter", new DefaultTreeItem(project.getName(), selectors).isSelected());
    try {
        new DefaultStyledText(resourceType);
    } catch (RedDeerException e) {
        fail("Resource type does not match");
    }
    new FinishButton().click();
    new WaitWhile(new ShellIsAvailable(""));
    new WaitWhile(new JobIsRunning(), TimePeriod.LONG, false);
    assertTrue("OpenShift 3 server adapter was not created.", new ServerAdapterExists(Version.OPENSHIFT3, name, resourceType).test());
    adapter = new ServerAdapter(Version.OPENSHIFT3, name, resourceType);
}
Also used : ShellIsAvailable(org.eclipse.reddeer.swt.condition.ShellIsAvailable) RedDeerException(org.eclipse.reddeer.common.exception.RedDeerException) ServerAdapter(org.jboss.tools.openshift.reddeer.view.resources.ServerAdapter) FinishButton(org.eclipse.reddeer.swt.impl.button.FinishButton) WaitWhile(org.eclipse.reddeer.common.wait.WaitWhile) ContextMenuItem(org.eclipse.reddeer.swt.impl.menu.ContextMenuItem) DefaultShell(org.eclipse.reddeer.swt.impl.shell.DefaultShell) ServerAdapterExists(org.jboss.tools.openshift.reddeer.condition.ServerAdapterExists) DefaultTreeItem(org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem) DefaultStyledText(org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText) JobIsRunning(org.eclipse.reddeer.workbench.core.condition.JobIsRunning)

Aggregations

DefaultStyledText (org.eclipse.reddeer.swt.impl.styledtext.DefaultStyledText)8 WaitWhile (org.eclipse.reddeer.common.wait.WaitWhile)4 DefaultShell (org.eclipse.reddeer.swt.impl.shell.DefaultShell)4 RedDeerException (org.eclipse.reddeer.common.exception.RedDeerException)3 ShellIsAvailable (org.eclipse.reddeer.swt.condition.ShellIsAvailable)3 JobIsRunning (org.eclipse.reddeer.workbench.core.condition.JobIsRunning)3 Test (org.junit.Test)3 IOException (java.io.IOException)2 WaitUntil (org.eclipse.reddeer.common.wait.WaitUntil)2 FinishButton (org.eclipse.reddeer.swt.impl.button.FinishButton)2 OkButton (org.eclipse.reddeer.swt.impl.button.OkButton)2 PushButton (org.eclipse.reddeer.swt.impl.button.PushButton)2 ContextMenuItem (org.eclipse.reddeer.swt.impl.menu.ContextMenuItem)2 DefaultTreeItem (org.eclipse.reddeer.swt.impl.tree.DefaultTreeItem)2 File (java.io.File)1 DockerImagesTab (org.eclipse.linuxtools.docker.reddeer.ui.DockerImagesTab)1 AbstractWaitCondition (org.eclipse.reddeer.common.condition.AbstractWaitCondition)1 WaitTimeoutExpiredException (org.eclipse.reddeer.common.exception.WaitTimeoutExpiredException)1 CoreLayerException (org.eclipse.reddeer.core.exception.CoreLayerException)1 LaunchView (org.eclipse.reddeer.eclipse.debug.ui.views.launch.LaunchView)1