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

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

Introduction

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

Prototype

String OK_LABEL

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

Click Source Link

Document

The label for OK buttons.

Usage

From source file:org.bonitasoft.studio.commands.test.DuplicateCommandTest.java

License:Open Source License

private void baseTest(boolean sourceDirty) throws PartInitException {
    DiagramRepositoryStore drs = (DiagramRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(DiagramRepositoryStore.class);

    SWTBotTestUtil.createNewDiagram(bot);
    SWTBotEditor botEditor = bot.activeEditor();

    final int nbEditorsBefore = bot.editors().size();
    int nbProcessesBefore = drs.getAllProcesses().size();

    String processName = botEditor.getTitle().substring(0, botEditor.getTitle().lastIndexOf("(") - 1);
    String processVersion = botEditor.getTitle().substring(botEditor.getTitle().lastIndexOf("(") + 1,
            botEditor.getTitle().lastIndexOf(")")) + " duplicated";

    if (sourceDirty) {
        alterDiagram(botEditor);// w w w.j  a v a  2  s.  c  o  m
    }

    bot.menu("Diagram").menu("Duplicate...").click();
    bot.waitUntil(
            Conditions.shellIsActive(org.bonitasoft.studio.common.Messages.openNameAndVersionDialogTitle));
    bot.text(0).setText(processName);
    bot.text(1).setText(processVersion);
    bot.text(2).setText("Pool" + System.currentTimeMillis());
    assertTrue("OK button should be active", bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.button(IDialogConstants.OK_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 "There should be only one more editor open";
        }
    });

    int nbProcessAfte = drs.getAllProcesses().size();
    assertEquals("There should be only one more process defined", nbProcessesBefore + 1, nbProcessAfte);

    if (sourceDirty) {
        botEditor.save();
    }

    MainProcess newDiagram = drs.getDiagram(processName, processVersion).getContent();
    List<Pool> pools = ModelHelper.getAllItemsOfType(newDiagram, ProcessPackage.Literals.POOL);
    final ProcessConfigurationRepositoryStore store = (ProcessConfigurationRepositoryStore) RepositoryManager
            .getInstance().getRepositoryStore(ProcessConfigurationRepositoryStore.class);
    for (Pool p : pools) {
        String id = ModelHelper.getEObjectID(p);
        ProcessConfigurationFileStore file = store
                .getChild(id + "." + ProcessConfigurationRepositoryStore.CONF_EXT);
        assertNotNull("Process configuration is missing after duplicate for " + p.getName() + " ("
                + p.getVersion() + ")", file);
        final Configuration conf = file.getContent();
        assertTrue("Actor mapping is missing in process configuraiton after duplicate for " + p.getName() + " ("
                + p.getVersion() + ")", !conf.getActorMappings().getActorMapping().isEmpty());
    }
}

From source file:org.bonitasoft.studio.common.diagram.tools.CustomDiagramGraphicalViewerKeyHandler.java

License:Open Source License

@Override
public boolean keyPressed(KeyEvent event) {
    if (event.keyCode == 127) {
        GraphicalEditPart part = (GraphicalEditPart) getFocusEditPart();
        Widget widget = (Widget) part.resolveSemanticElement();
        String[] buttonList = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
        List<Object> widgetSelected = new ArrayList<Object>();
        widgetSelected.add(widget);/*w w w .  ja  v  a 2s  .  co m*/
        OutlineDialog dialog = new OutlineDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                Messages.deleteFormFieldDialogTitle, Display.getCurrent().getSystemImage(SWT.ICON_WARNING),
                Messages.bind(Messages.askConfirmationForDeleting, widget.getName()), MessageDialog.CONFIRM,
                buttonList, 1, widgetSelected);
        int ok = 0;
        RemoveWidgetReferencesOperation op = new RemoveWidgetReferencesOperation(
                ModelHelper.getPageFlow(widget), widget);
        if (ok == dialog.open()) {
            CompoundCommand cc = new CompoundCommand();
            op.setCompoundCommand(cc);
            op.updateReferencesInScripts();
            IProgressService service = PlatformUI.getWorkbench().getProgressService();
            try {
                service.busyCursorWhile(op);

            } catch (InvocationTargetException e) {
                BonitaStudioLog.error(e);
            } catch (InterruptedException e) {
                BonitaStudioLog.error(e);
            }
            if (!op.isCanExecute()) {
                event.doit = false;
                return false;
            }

        } else {
            event.doit = false;
            return false;
        }
    }
    return super.keyPressed(event);
}

From source file:org.bonitasoft.studio.common.jface.MessageDialogWithPrompt.java

License:Open Source License

private static String[] getButtonLabelsFor(int kind) {
    String[] dialogButtonLabels;/*  www  .  j  a v  a 2  s. c  o m*/
    switch (kind) {
    case ERROR:
    case INFORMATION:
    case WARNING: {
        dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
        break;
    }
    case CONFIRM: {
        dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
        break;
    }
    case QUESTION: {
        dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
        break;
    }
    case QUESTION_WITH_CANCEL: {
        dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
        break;
    }
    default: {
        throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$
    }
    }
    return dialogButtonLabels;
}

From source file:org.bonitasoft.studio.common.jface.ValidationDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Composite blank = new Composite(parent, SWT.NONE);
    blank.setLayoutData(new GridData(1, 1));
    Composite buttonbar = new Composite(parent, SWT.None);
    buttonbar.setLayout(new GridLayout(3, false));
    buttonbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
    if (messageType == YES_NO_SEEDETAILS || messageType == YES_NO) {
        super.createButton(buttonbar, YES, IDialogConstants.YES_LABEL, false);
        super.createButton(buttonbar, NO, IDialogConstants.NO_LABEL, true);
    }//ww  w.j a va2 s.c  om
    if (messageType == OK_SEEDETAILS || messageType == OK_ONLY) {
        super.createButton(buttonbar, OK, IDialogConstants.OK_LABEL, true);
    }
    if (messageType == YES_NO_SEEDETAILS || messageType == OK_SEEDETAILS) {
        super.createButton(buttonbar, SEE_DETAILS, seeDetails, false);
    }
    return buttonBar;
}

From source file:org.bonitasoft.studio.connectors.test.exporter.SWTBotConnectorExportTests.java

License:Open Source License

private void exportConnector(String connector, String fileName, boolean hasDependencies, boolean hasSources)
        throws Exception {
    File f = new File(ProjectUtil.getBonitaStudioWorkFolder().getAbsolutePath());
    final String exportPath = f.getAbsolutePath();
    SWTBotConnectorTestUtil.activateExportConnectorShell(bot);
    bot.table().select(connector);/*from  w w  w .ja  v a 2s  .  c  om*/
    assertFalse("Finish button should be disabled", bot.button(IDialogConstants.FINISH_LABEL).isEnabled());
    if (hasSources) {
        bot.checkBoxWithLabel("Include sources").select();
    } else {
        bot.checkBoxWithLabel("Include sources").deselect();
    }
    if (hasDependencies) {
        bot.checkBoxWithLabel("Add dependencies").select();
    } else {
        bot.checkBoxWithLabel("Add dependencies").deselect();
    }
    bot.textWithLabel("Destination *").setText(exportPath);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.waitUntil(Conditions.shellIsActive("Export result"));
    bot.button(IDialogConstants.OK_LABEL).click();
    checkExportedFile(exportPath, fileName, hasDependencies, hasSources);
}

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

License:Open Source License

private void createWidget(String widgetId, String widgetType, int inputIndex) {
    bot.button("Add...").click();
    assertFalse("button ok should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.textWithLabel("Widget id*").setText(widgetId);
    bot.comboBoxWithLabel("Widget type").setSelection(widgetType);
    if (!widgetType.equals("Group")) {
        bot.comboBoxWithLabel("Input *").setSelection(inputIndex);
    } else {//w  ww.  j ava 2 s  . com
        assertFalse("inputs combo box should be disabled for Group widget",
                bot.comboBoxWithLabel("Input *").isEnabled());
    }
    assertTrue("button ok should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.button(IDialogConstants.OK_LABEL).click();

}

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

License:Open Source License

@Test
public void testConnectorDefinitionWizardPageValidityName() {
    final String connectorDefId = "testWizardPage1";
    final String pageId = "pageTest";
    final String pageIdLabelStar = Messages.pageId + " *";
    final String widgetIdStar = Messages.widgetId + "*";
    final String widgetIdValid = "myWidgetId";

    openConnectorDefinitionWizardPage(connectorDefId);
    bot.button(Messages.Add).click();// ww  w .  j a v a 2 s .c o m
    bot.waitUntil(Conditions.shellIsActive(Messages.newConnectorDefinition));

    // ----- Test Page id name validity ----- 
    assertFalse("button Apply should be disabled", bot.button(Messages.apply).isEnabled());

    // valid id
    bot.textWithLabel(pageIdLabelStar).setText(pageId);
    assertTrue("button Apply should be enabled", bot.button(Messages.apply).isEnabled());

    // whitespace in id
    bot.textWithLabel(pageIdLabelStar).setText("bla bla");
    assertFalse("button Apply should be disabled", bot.button(Messages.apply).isEnabled());

    // forbidden characters
    bot.textWithLabel(pageIdLabelStar).setText("//dfgjkdfg**");
    assertFalse("button Apply should be disabled", bot.button(Messages.apply).isEnabled());

    // valid id
    bot.textWithLabel(pageIdLabelStar).setText(pageId);
    assertTrue("button Apply should be enabled", bot.button(Messages.apply).isEnabled());

    // ----- test widget id validity ------
    bot.button(Messages.Add).click();
    bot.waitUntil(Conditions.shellIsActive(Messages.addWidget));
    bot.comboBoxWithLabel(Messages.input + " *").setSelection(0);

    // valid text
    bot.textWithLabel(widgetIdStar).setText(widgetIdValid);
    assertTrue("button OK should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled());

    // forbidden characters
    bot.textWithLabel(widgetIdStar).setText("//lfhsduh**");
    assertFalse("button OK should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled());

    // whitespace
    bot.textWithLabel(widgetIdStar).setText("bla bla");
    assertFalse("button OK should be disabled", bot.button(IDialogConstants.OK_LABEL).isEnabled());

    // valid text
    bot.textWithLabel(widgetIdStar).setText(widgetIdValid);
    assertTrue("button OK should be enabled", bot.button(IDialogConstants.OK_LABEL).isEnabled());

    bot.button(IDialogConstants.OK_LABEL).click();
    bot.button(Messages.apply).click();
    bot.button(IDialogConstants.CANCEL_LABEL).click();

}

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.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();
}