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

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

Introduction

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

Prototype

String NEXT_LABEL

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

Click Source Link

Document

The label for next buttons.

Usage

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

License:Open Source License

@Test
public void testConnectorImplementationEdition() {
    final int nbEditorsBefore = bot.editors().size();
    SWTBotConnectorTestUtil.activateConnectorImplementationShell(bot);
    final String id = "testImplementation2";
    final String id2 = "textImplementation3";
    final String definition = "testEdit";
    final String className = "MyConnectorImpl2";
    final String packageName = "org.bonita.connector.test";

    selectDefinition(definition);/*w  w w.j av a  2  s .  c o  m*/

    bot.textWithLabel("Implementation id *").setText(id);
    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);
    bot.menu("Development").menu("Connectors").menu("Edit implementation...").click();
    bot.table().unselect();
    assertFalse("Edit button should be disabled", bot.button(Messages.Edit).isEnabled());
    bot.table().select(id + " (1.0.0) -- " + packageName + "." + className);
    bot.button(Messages.Edit).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("Implementation id should be " + id, bot.textWithLabel("Implementation id *").getText(), id);
    assertEquals("Version should be 1.0.0", bot.textWithLabel("Version *").getText(), "1.0.0");
    assertEquals("Class name should be " + className, bot.textWithLabel("Class name *").getText(), className);
    assertEquals("Package should be " + packageName, bot.textWithLabel("Package *").getText(), packageName);
    bot.textWithLabel("Implementation id *").setText(id2);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    ConnectorImplRepositoryStore store = (ConnectorImplRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorImplRepositoryStore.class);
    ConnectorImplementation connectorImpl = store.getImplementation(id, "1.0.0");
    assertNull("connectorImplementation with id" + id + "should not exist anymore", connectorImpl);
    connectorImpl = store.getImplementation(id2, "1.0.0");
    assertNotNull("connectorImplementation id was not edited correctly", connectorImpl);
    assertEquals("connector id should be " + id2, connectorImpl.getImplementationId(), id2);
    removeImplementation(id2);
}

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

License:Open Source License

public void createConnector(String connectorDefinitionId) {
    final String widgetId = "textWidget";
    final String pageId = "connectorDefPageId";
    SWTBotConnectorTestUtil.activateConnectorDefinitionShell(bot);
    bot.textWithLabel("Definition id *").setText(connectorDefinitionId);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.textWithLabel("Page id *").setText(pageId);
    bot.button("Add...").click();
    bot.textWithLabel("Widget id*").setText(widgetId);
    bot.textWithLabel("Display name").setText("text");
    bot.comboBoxWithLabel("Widget type").setSelection("Text");
    bot.comboBoxWithLabel("Input *").setSelection(0);
    bot.button(IDialogConstants.OK_LABEL).click();
    bot.button("Apply").click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button("Add...").click();
    bot.button(IDialogConstants.FINISH_LABEL).click();
}

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

License:Open Source License

private void addConnector(String connectorDefinitionId, String name, String dataName, String version) {
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors");
    bot.button("Add...").click();
    assertFalse(IDialogConstants.NEXT_LABEL + " should be disabled",
            bot.button(IDialogConstants.NEXT_LABEL).isEnabled());
    assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.tree().expandNode("Uncategorized").select(connectorDefinitionId + " (" + version + ")");
    assertTrue(IDialogConstants.NEXT_LABEL + " should be disabled",
            bot.button(IDialogConstants.NEXT_LABEL).isEnabled());
    assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertFalse(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.textWithLabel("Name *").setText(name);
    assertTrue(IDialogConstants.FINISH_LABEL + " should be disabled",
            bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.textWithLabel("text").setText("hello world");
    bot.sleep(1000); // Due to delayed observable on databinding
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.comboBox().setSelection(dataName + " (java.lang.String)");
    bot.button(IDialogConstants.FINISH_LABEL).click();
}

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

License:Open Source License

private void editConnector(String connectorDefinitionId, String name, String version, String dataName) {
    bot.table().select(name + " -- " + connectorDefinitionId + " (" + version + ") -- ON_FINISH");
    bot.button("Edit...").click();
    assertEquals("the name text field is not well completed", bot.textWithLabel("Name *").getText(), name);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("the widget text should be completed with the text hello world", "hello world",
            bot.textWithLabel("text").getText());
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals(dataName + " (java.lang.String) should be selected in the comboBox",
            dataName + " (java.lang.String)", bot.comboBox().getText());
    assertEquals("the text field should be completed with the ouptut name Ouput1", "Output1",
            bot.text().getText());//from   w ww .  ja  va  2s .  c om
    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 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  a2s .  com*/
    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();/*from  ww w.j a  v a2s  . co  m*/
    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   ww w . ja  v  a2 s  .com
 * @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
 * /*from w ww  .j av a  2 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);
}

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

License:Open Source License

public static void selectDefinitionInConnectorShell(final SWTBot bot, final String definition) {
    bot.treeWithId(SWTBotConstants.SWTBOT_ID_EXPLORER_LEFT_TREE).select(0);
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            return bot.tableWithId(SWTBotConstants.SWTBOT_ID_EXPLORER_RIGHT_TABLE).rowCount() > 0;
        }/*from   ww w .  ja  v a2 s.com*/

        public void init(SWTBot bot) {
        }

        public String getFailureMessage() {
            return "No items found in right table of connector explorer";
        }
    });
    bot.tableWithId(SWTBotConstants.SWTBOT_ID_EXPLORER_RIGHT_TABLE).select(definition);
    bot.button(IDialogConstants.NEXT_LABEL).click();
}