Example usage for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL

List of usage examples for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL.

Prototype

String FINISH_LABEL

To view the source code for org.eclipse.jface.dialogs IDialogConstants FINISH_LABEL.

Click Source Link

Document

The label for finish buttons.

Usage

From source file:org.bonitasoft.studio.connectors.test.swtbot.ConnectorPropertyTest.java

License:Open Source License

private void createData(String dataName) {
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Data");
    bot.button("Add...").click();
    assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.textWithLabel("Name").setText(dataName);
    assertTrue(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.FINISH_LABEL).click();
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testCreate() throws Exception {
    final String id = "test";
    final String version = "1.0.0";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    bot.textWithLabel("Definition id *").setText(id);
    assertTrue(IDialogConstants.NEXT_LABEL + " should be enabled",
            bot.button(IDialogConstants.NEXT_LABEL).isEnabled());
    assertTrue(IDialogConstants.FINISH_LABEL + " should be enabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorDefRepositoryStore.class);
    ConnectorDefinition connectorDef = store.getDefinition(id, version);
    assertNotNull("the connectorDef file was not created", connectorDef);
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testExistingConnectorDefinition() throws Exception {
    final String id = "test1";
    final String textLabel = "Definition id *";
    final String textLabelVersion = "Version *";
    final String version = "1.1.0";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    bot.textWithLabel(textLabel).setText(id);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    testButtonDisabled(id, textLabel);/* w w w  . j  a  va  2s  .co m*/
    bot.textWithLabel(textLabelVersion).setText(version);
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            return bot.button(IDialogConstants.FINISH_LABEL).isEnabled();
        }

        public void init(SWTBot bot) {

        }

        public String getFailureMessage() {
            return "changing version should enable finish button";
        }
    }, 5000);

    bot.button(IDialogConstants.CANCEL_LABEL).click();

}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testSelectCategory() throws Exception {
    final String id = "test2";
    final String version = "1.0.0";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version);
    bot.treeWithLabel(Messages.categoryLabel).select(0);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorDefRepositoryStore.class);
    ConnectorDefinition connectorDef = store.getDefinition(id, version);
    assertEquals("category size should be equal to 1", 1, connectorDef.getCategory().size());
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testNewCategory() throws Exception {
    final String id = "test3";
    final String version = "1.0.0";
    final String categoryId = "category1";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version);
    SWTBotConnectorTestUtil.createNewCategory(bot, categoryId);
    bot.treeWithLabel(Messages.categoryLabel).select(categoryId);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorDefRepositoryStore.class);
    ConnectorDefinition connectorDef = store.getDefinition(id, version);
    assertEquals("category list size should be equal to 1", connectorDef.getCategory().size(), 1);
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testCreateExistingCategory() throws Exception {
    final String id = "test7";
    final String version = "1.0.0";
    final String categoryId = "category3";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    SWTBotConnectorTestUtil.createConnectorDefinition(bot, id, version);
    SWTBotConnectorTestUtil.createNewCategory(bot, categoryId);
    bot.button("New...").click();
    bot.textWithLabel("Id").setText(categoryId);
    assertFalse("Ok button should be disabled when trying to create an existing category",
            bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.button(IDialogConstants.CANCEL_LABEL).click();
    bot.button(IDialogConstants.FINISH_LABEL).click();
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testAddInputs() throws Exception {
    final String id = "test5";
    final String textLabel = "Definition id *";
    final String version = "1.0.0";
    final String inputName = "testInput";
    final String mandatory = "Mandatory";
    final String value = "hello";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    bot.textWithLabel(textLabel).setText(id);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Remove").click();
    SWTBotTable table = bot.table();/*from  w w  w .j  a v a 2 s  .c  o m*/
    table.click(0, 0);
    bot.sleep(500);
    bot.text(0).setText(inputName);
    table.click(0, 1);
    bot.ccomboBox().setSelection(mandatory);
    SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US";
    Keyboard key = KeyboardFactory.getSWTKeyboard();
    key.pressShortcut(Keystrokes.CR);
    bot.waitUntil(Conditions.widgetIsEnabled(table));
    table.click(0, 3);
    bot.text().setText("hello");
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorDefRepositoryStore.class);
    ConnectorDefinition connectorDef = store.getDefinition(id, version);
    assertEquals("wrong number of inputs", connectorDef.getInput().size(), 2);
    Input input = connectorDef.getInput().get(0);
    assertEquals("wrong input name", input.getName(), inputName);
    assertEquals("wrong input value", input.getDefaultValue(), value);
    assertTrue("input should be mandatory", input.isMandatory());
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorDefinitionTest.java

License:Open Source License

@Test
public void testAddOutputs() throws Exception {
    final String id = "test6";
    final String textLabel = "Definition id *";
    final String version = "1.0.0";
    final String outputName = "output";
    final String type = "java.lang.Boolean";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    bot.textWithLabel(textLabel).setText(id);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Add...").click();
    bot.button("Remove").click();
    SWTBotTable table = bot.table();//  w  w w  .j  a v a  2 s. com
    table.click(0, 0);
    bot.sleep(500);
    bot.text(0).setText(outputName);
    table.click(0, 1);
    bot.ccomboBox().setSelection(type);
    Keyboard key = KeyboardFactory.getSWTKeyboard();
    key.pressShortcut(Keystrokes.CR);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorDefRepositoryStore store = (ConnectorDefRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorDefRepositoryStore.class);
    ConnectorDefinition connectorDef = store.getDefinition(id, version);
    assertEquals("wrong number of outputs", connectorDef.getOutput().size(), 2);
    Output output = connectorDef.getOutput().get(0);
    assertEquals("wrong output name", output.getName(), outputName);
    assertEquals("wrong type of output", output.getType(), type);
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorTestUtil.java

License:Open Source License

/**
 * use it to create a connector def and impl (no window should be opened)
 * @param bot//from   w ww  .ja v  a 2 s  . c  om
 * @param id
 * @param version
 * @param className
 * @param packageName
 */
public static void createConnectorDefAndImpl(final SWTWorkbenchBot bot, String id, String version,
        String className, String packageName) {
    final int nbEditorsBefore = bot.editors().size();
    activateConnectorDefinitionShell(bot);
    createConnectorDefinition(bot, id, version);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    activateConnectorImplementationShell(bot);
    bot.table().select(id);
    SWTBotCombo comboBoxToSelectVersion = bot.comboBoxWithLabel("Definition version");
    if (comboBoxToSelectVersion.isEnabled()) {
        comboBoxToSelectVersion.setSelection(version);
    }
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.textWithLabel("Class name *").setText(className);
    bot.textWithLabel("Package *").setText(packageName);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            return nbEditorsBefore + 1 == bot.editors().size();
        }

        public void init(SWTBot bot) {
        }

        public String getFailureMessage() {
            return "Editor for implementation has not been opened.";
        }
    }, 30000);
}

From source file:org.bonitasoft.studio.connectors.test.swtbot.SWTBotConnectorTestUtil.java

License:Open Source License

/**
 * connector configuration input widget should be a text field or a text area
 * // w  ww  .j a  va2  s  . c  o m
 * @param bot
 * @param connectorDefinitionId
 * @param name
 * @param dataName
 * @param version
 */
public static void addConnectorToPool(final SWTBot bot, final String connectorDefinitionLabel,
        final String version, final String[] categoryPathLabels, final String connectorName) {
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors");
    bot.button("Add...").click();
    Assert.assertFalse(IDialogConstants.NEXT_LABEL + " should be disabled",
            bot.button(IDialogConstants.NEXT_LABEL).isEnabled());
    Assert.assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    categoryItem = null;
    nodes = null;

    for (int i = 0; i < categoryPathLabels.length; i++) {

        final String categoryLabel = categoryPathLabels[i];
        System.out.println("will try to open node: " + categoryLabel);
        bot.waitUntil(new ICondition() {

            public boolean test() throws Exception {
                if (categoryItem == null) {
                    bot.tree().collapseNode(categoryLabel);
                    categoryItem = bot.tree().expandNode(categoryLabel, true);
                } else {
                    categoryItem.collapseNode(categoryLabel);
                    categoryItem = categoryItem.expandNode(categoryLabel);
                }

                System.out.println("item expanded: " + categoryItem.getText());
                nodes = categoryItem.getNodes();
                if (!nodes.isEmpty() && nodes.get(0).isEmpty()) {
                    return false;
                }
                return !nodes.isEmpty();
            }

            public void init(SWTBot bot) {

            }

            public String getFailureMessage() {
                return "Category " + categoryLabel + " has no children\n" + "Current category item is "
                        + categoryItem != null ? categoryItem.getText() : "null";
            }
        }, 10000, 1000);
    }

    String cNode = null;
    for (String node : nodes) {
        if (node.startsWith(connectorDefinitionLabel) && node.contains(version)) {
            cNode = node;
            break;
        }
    }
    Assert.assertNotNull(
            "Connector " + connectorDefinitionLabel + " (" + version + ") not found in category path "
                    + categoryPathLabels.toString() + " containing children:\n" + nodes,
            cNode);
    final String nodeToSelect = cNode;
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            categoryItem.select(nodeToSelect);
            String selection = bot.tree().selection().get(0, 0);
            return selection != null && selection.startsWith(connectorDefinitionLabel);
        }

        public void init(SWTBot bot) {

        }

        public String getFailureMessage() {
            return "Cannot select tree item";
        }
    }, 10000, 1000);
    Assert.assertTrue(IDialogConstants.NEXT_LABEL + " should be enabled",
            bot.button(IDialogConstants.NEXT_LABEL).isEnabled());
    Assert.assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.NEXT_LABEL).click();
    Assert.assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.textWithLabel("Name *").setText(connectorName);
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.NEXT_LABEL)), 5000);
}