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.TestLoadSaveConnectorConfiguration.java

License:Open Source License

@Test
public void testSaveLoadConnectorConfiguration() {
    ConnectorConfRepositoryStore store = (ConnectorConfRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(ConnectorConfRepositoryStore.class);
    final int initialSize = store.getChildren().size();
    final String connectorDefId = "testLoadConnectorDefinition";
    final String version = "1.0.0";
    final String name = "testLoadConnector";
    final String name2 = "testLoadConnector2";
    final String dataName = "dataLoadConnector";
    final String saveName = "testLoadConnectorConfig";
    createConnector(connectorDefId);/*from w  ww  .  j  a v a 2 s.co  m*/
    SWTBotTestUtil.createNewDiagram(bot);
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show();
    createData(dataName);
    //SWTBotConnectorTestUtil.addConnectorToPool(bot, connectorDefId,version, new String[]{"Uncategorized"},name);
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors");
    bot.button("Add...").click();
    bot.text().setText(connectorDefId);
    bot.table().select(connectorDefId);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    //SWTBotConnectorTestUtil.addConnectorToPool(bot, connectorLabel,connectorVersion,dbCategoryLabel, connectorName);
    bot.textWithLabel("Name *").setText(name);
    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();
    SWTBotTestUtil.setOutputStorageExpressionByName(bot, dataName, String.class.getName(), 0);

    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.table().select(name + " -- " + connectorDefId + " (" + version + ") -- ON_FINISH");
    bot.button("Edit...").click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.toolbarButton("Save").click();
    bot.textWithLabel("Name *").setText(saveName);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.button(IDialogConstants.FINISH_LABEL).click();
    //add a new connector and load previous configuration connector
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Connectors");
    bot.button("Add...").click();
    //bot.tree().setFocus();
    //bot.tree().expandNode("Uncategorized").select(connectorDefId + " (" + version + ")");
    bot.text().setText(connectorDefId);
    bot.table().select(connectorDefId);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.textWithLabel("Name *").setText(name2);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.toolbarButton("Load").click();
    final SWTBotTree wizardTree = bot.treeWithId(SWTBotConstants.SELECTION_CONNECTOR_CONFIGURATION_TREE_ID);
    wizardTree.setFocus();
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            wizardTree.getTreeItem(saveName).select();
            return wizardTree.selectionCount() > 0;
        }

        public void init(SWTBot bot) {

        }

        public String getFailureMessage() {
            return "Cannot select tree item";
        }
    }, 10000, 1000);

    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)));
    bot.button(IDialogConstants.FINISH_LABEL).click();

    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.NEXT_LABEL)));
    bot.button(IDialogConstants.NEXT_LABEL).click();
    assertEquals("text field should be completed with hello world", bot.textWithLabel("text").getText(),
            "hello world");
    //remove configuration
    bot.toolbarButton("Load").click();
    assertTrue("remove button should be enabled", bot.button("Remove").isEnabled());
    bot.tree().setFocus();
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            bot.tree().getTreeItem(saveName).select();
            return bot.tree().selectionCount() > 0;
        }

        public void init(SWTBot bot) {

        }

        public String getFailureMessage() {
            return "Cannot select tree item";
        }
    }, 10000, 500);
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button("Remove")));
    bot.button("Remove").click();
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            return bot.tree().getAllItems().length == initialSize;
        }

        public void init(SWTBot bot) {
        }

        public String getFailureMessage() {
            return "Fail to delete configuration";
        }
    });
    bot.button(IDialogConstants.CANCEL_LABEL).click();
    bot.button(IDialogConstants.CANCEL_LABEL).click();
    bot.saveAllEditors();
    assertEquals("invalid number of configuration", initialSize, store.getChildren().size());
}

From source file:org.bonitasoft.studio.contract.ui.wizard.AddInputContractFromDataWizardDialog.java

License:Open Source License

@Override
public void moveFinishButton() {
    final Button finishButton = getButton(IDialogConstants.FINISH_ID);
    getFinishAndNewButton().moveAbove(finishButton);
    finishButton.setText(IDialogConstants.FINISH_LABEL);
}

From source file:org.bonitasoft.studio.data.test.DataSWTBotTests.java

License:Open Source License

@Test
public void testMoveData() throws Exception {
    Pool pool = createProcessWithData();
    Lane lane = (Lane) pool.getElements().get(0);
    SWTBotEditor botEditor = bot.activeEditor();
    SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());

    SWTBotGefEditPart parent = gmfEditor.getEditPart("Step1").parent();
    final Activity step = (Activity) ((IGraphicalEditPart) parent.part()).resolveSemanticElement();
    SWTBotGefEditPart poolPart = gmfEditor.getEditPart(pool.getName()).parent();
    poolPart.select();//  w ww .  j  a  v a 2  s .co  m
    poolPart.click();
    addDataOnSelectedElementWithName("dataToMove");
    int nbPoolData = pool.getData().size();
    final int nbStepData = step.getData().size();
    bot.table().select("dataToMove -- Text");
    // button("Move...")
    bot.button(Messages.moveData).click();
    bot.tree().getTreeItem("Pool " + pool.getName()).getNode("Lane " + lane.getName()).select("Task Step1");
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.menu("Diagram").menu("Save").click();
    bot.waitUntil(new DefaultCondition() {

        public boolean test() throws Exception {
            return nbStepData + 1 == step.getData().size();
        }

        public String getFailureMessage() {
            return "data not removed";
        }
    });
    assertEquals("data not added", nbPoolData - 1, pool.getData().size());
    bot.menu("Diagram").menu("Close").click();
}

From source file:org.bonitasoft.studio.data.test.DataSWTBotTests.java

License:Open Source License

/**Add a Text Data
 * /*from  ww  w.  java2s  .  c  om*/
 * @param dataName
 */
private void addDataOnSelectedElementWithName(String dataName) {
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show();
    SWTBotTestUtil.selectTabbedPropertyView(bot, "Data");

    bot.button("Add...").click();
    // Shell "New variable"
    bot.waitUntil(Conditions.shellIsActive(Messages.newVariable));

    bot.textWithLabel(Messages.name + " *").setText(dataName);
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)));
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.menu("Diagram").menu("Save").click();
}

From source file:org.bonitasoft.studio.data.test.DataSWTBotTests.java

License:Open Source License

@Test
public void testDataDefaultValueReturnType() throws Exception {
    SWTBotTestUtil.createNewDiagram(bot);
    SWTBotEditor botEditor = bot.activeEditor();
    SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());

    IGraphicalEditPart part = (IGraphicalEditPart) gmfEditor.mainEditPart().part();
    MainProcess model = (MainProcess) part.resolveSemanticElement();
    Pool pool = (Pool) model.getElements().get(0);

    gmfEditor.getEditPart(pool.getName()).parent().select();
    bot.viewById(SWTBotTestUtil.VIEWS_PROPERTIES_PROCESS_GENERAL).show();

    SWTBotTestUtil.selectTabbedPropertyView(bot, "Data");

    bot.button("Add...").click();
    // Shell "New variable"
    bot.waitUntil(Conditions.shellIsActive(Messages.newVariable));

    final String dataName = "myDataName";
    bot.textWithLabel(Messages.name + " *").setText(dataName);

    String defaultValue = "test return type";
    bot.textWithLabel(Messages.defaultValueLabel).setText(defaultValue);
    bot.sleep(500);//from  ww  w .  j  a  v a2 s . c  o m

    bot.toolbarButtonWithId(ExpressionViewer.SWTBOT_ID_EDITBUTTON).click();
    assertEquals("Expression return type should be " + String.class.getName(), String.class.getName(),
            bot.comboBoxWithLabel(Messages.returnType).getText());
    bot.button(IDialogConstants.OK_LABEL).click();

    bot.comboBoxWithLabel(Messages.datatypeLabel).setSelection(DataTypeLabels.integerDataType);

    defaultValue = "50";
    bot.textWithLabel(Messages.defaultValueLabel).setText(defaultValue);
    bot.sleep(500);
    bot.toolbarButtonWithId(ExpressionViewer.SWTBOT_ID_EDITBUTTON).click();
    assertEquals("Expression return type should be " + Integer.class.getName(), Integer.class.getName(),
            bot.comboBoxWithLabel(Messages.returnType).getText());

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

    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)));
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.menu("Diagram").menu("Save").click();

    bot.menu("Diagram").menu("Close").click();
}

From source file:org.bonitasoft.studio.data.test.DataSWTBotTests.java

License:Open Source License

@Test
public void testCreateDataWithExistingId() {
    //Add the data myData on pool
    String dataName = "myData";
    String dataName1 = "myData1";

    SWTBotTestUtil.createNewDiagram(bot);
    SWTBotEditor botEditor = bot.activeEditor();
    SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());
    String diagramTitle = botEditor.getTitle();
    getDataSection(bot);/*from   www  .j  a  v a 2s. com*/
    bot.button(Messages.addData).click();
    bot.textWithLabel(Messages.name + " *").setText(dataName);
    assertTrue("finish button should be enabled", bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.FINISH_LABEL).click();

    //try to add a data myData on step
    SWTBotTestUtil.selectEventOnProcess(bot, gmfEditor, "Step1");
    getDataSection(bot);
    bot.button(Messages.addData).click();
    bot.textWithLabel(Messages.name + " *").setText(dataName);
    assertFalse("finish button should be enabled", bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.textWithLabel(Messages.name + " *").setText(dataName1);
    assertTrue("finish button should be enabled", bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.FINISH_LABEL).click();

    //add a second task and add a data named myData1
    bot.editorByTitle(diagramTitle).show();
    bot.editorByTitle(diagramTitle).setFocus();
    SWTBotTestUtil.selectElementInContextualPaletteAndDragIt(gmfEditor, "Step1",
            SWTBotTestUtil.CONTEXTUALPALETTE_STEP, new Point(550, 180));
    getDataSection(bot);
    bot.button(Messages.addData).click();
    bot.textWithLabel(Messages.name + " *").setText(dataName1);
    assertTrue("finish button should be enabled", bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    bot.button(IDialogConstants.FINISH_LABEL).click();

}

From source file:org.bonitasoft.studio.data.ui.property.section.AbstractDataSectionTest.java

License:Open Source License

/**
 * @throws java.lang.Exception/*  w  w w .  j av a 2s.  com*/
 */
@Before
public void setUp() throws Exception {
    when(sectionUnderTest.getActiveShell()).thenReturn(shell);
    when(sectionUnderTest.createWizardDialog(addWizard, IDialogConstants.FINISH_LABEL))
            .thenReturn(wizardDialog);
    when(sectionUnderTest.createWizardDialog(editWizard, IDialogConstants.OK_LABEL)).thenReturn(wizardDialog);

    final StructuredSelection selection = new StructuredSelection(aBusinessData().build());
    when(sectionUnderTest.getStructuredSelection((ISelectionProvider) anyObject())).thenReturn(selection);
}

From source file:org.bonitasoft.studio.data.ui.property.section.control.BusinessDataViewer.java

License:Open Source License

@Override
protected void addData() {
    final Pool pool = (Pool) getDataContainerObservable().getValue();
    createWizardDialog(new AddBusinessObjectDataWizard(pool, store, TransactionUtil.getEditingDomain(pool)),
            IDialogConstants.FINISH_LABEL).open();
}

From source file:org.bonitasoft.studio.data.ui.property.section.control.ProcessDataViewer.java

License:Open Source License

protected void moveData(final IStructuredSelection structuredSelection) {
    final DataAware container = (DataAware) getDataContainerObservable().getValue();
    final MoveDataWizard moveDataWizard = new MoveDataWizard(container);
    if (createWizardDialog(moveDataWizard, IDialogConstants.FINISH_LABEL).open() == Dialog.OK) {
        final DataAware dataAware = moveDataWizard.getSelectedDataAwareElement();
        try {/*w w w  . j  av a  2  s  . co m*/
            final MoveDataCommand cmd = new MoveDataCommand(TransactionUtil.getEditingDomain(dataAware),
                    container, structuredSelection.toList(), dataAware);
            OperationHistoryFactory.getOperationHistory().execute(cmd, null, null);

            if (!(cmd.getCommandResult().getStatus().getSeverity() == Status.OK)) {
                final List<Object> data = (List<Object>) cmd.getCommandResult().getReturnValue();
                String dataNames = "";
                for (final Object d : data) {
                    dataNames = dataNames + ((Element) d).getName() + ",";
                }
                dataNames = dataNames.substring(0, dataNames.length() - 1);
                MessageDialog.openWarning(Display.getDefault().getActiveShell(),
                        Messages.PromoteDataWarningTitle,
                        Messages.bind(Messages.PromoteDataWarningMessage, dataNames));
            }

        } catch (final ExecutionException e1) {
            BonitaStudioLog.error(e1);
        }
    }
}

From source file:org.bonitasoft.studio.data.ui.wizard.CreateVariableProposalListener.java

License:Open Source License

@Override
public String handleEvent(final EObject context, final String fixedReturnType) {
    Assert.isNotNull(context);//w ww . j  a  v a 2s  .  c  o m
    final EObject dataContainer = getDataContainer(context);
    final Data dataWorkingCopy = ProcessFactory.eINSTANCE.createData();
    dataWorkingCopy.setMultiple(multipleData);
    dataWorkingCopy.setDataType(ModelHelper.getDataTypeForID(dataContainer, DataTypeLabels.stringDataType));
    final DataWizard newWizard = new DataWizard(TransactionUtil.getEditingDomain(context), dataContainer,
            dataWorkingCopy, feature, Collections.singleton(feature), true, fixedReturnType);
    newWizard.setIsPageFlowContext(isPageFlowContext);
    final CustomWizardDialog wizardDialog = new CustomWizardDialog(activeShell(), newWizard,
            IDialogConstants.FINISH_LABEL);
    if (wizardDialog.open() == Dialog.OK) {
        final Data newData = newWizard.getNewData();
        if (newData != null) {
            return newData.getName();
        }
    }
    return null;
}