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

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

Introduction

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

Prototype

String YES_LABEL

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

Click Source Link

Document

The label for yes buttons.

Usage

From source file:org.bonitasoft.expressions.test.TestPatternExpressionViewer.java

License:Open Source License

private void fillGroovyExpression() {
    bot.link(Messages.switchEditor).click("Switch editor");
    bot.button(IDialogConstants.YES_LABEL).click();
    editGroovyEditor(0, "Request", String.class.getName(), "sqlQuery", GROOVY_SQL_QUERY);
    bot.sleep(1000);//from   ww w.j a  va2  s .  c  o m
    bot.button(IDialogConstants.NEXT_LABEL).click();
    if (bot.button(IDialogConstants.NEXT_LABEL).isEnabled()) {
        bot.button(IDialogConstants.NEXT_LABEL).click();
    }
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)), 5000);
    bot.button(IDialogConstants.FINISH_LABEL).click();
    bot.sleep(1000);
    bot.activeEditor().save();
}

From source file:org.bonitasoft.studio.actors.tests.SWTbot.ActorFilterEditionTest.java

License:Open Source License

public void removeActorFilterDefinition(String name, String version) {
    SWTBotActorFilterUtil.activateActorFilterDefEditionShell(bot);
    bot.waitUntil(Conditions.widgetIsEnabled(
            bot.tree().expandNode("Uncategorized").getNode(name + " (" + version + ")")), 10000);
    bot.tree().expandNode("Uncategorized").select(name + " (" + version + ")");
    assertNotNull("could not find" + name + " (" + version + ")",
            bot.tree().expandNode("Uncategorized").getNode(name + " (" + version + ")"));
    bot.tree().expandNode("Uncategorized").select(name + " (" + version + ")");
    bot.button("Delete").click();
    if (!FileActionDialog.getDisablePopup()) {
        bot.button(IDialogConstants.YES_LABEL).click();
    }// w w w.j a va 2  s  .  c o m
    bot.button(IDialogConstants.CANCEL_LABEL).click();
}

From source file:org.bonitasoft.studio.actors.ui.wizard.ManageOrganizationWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    try {/*from   w w w . ja v a 2  s .  c  o  m*/
        getContainer().run(true, false, new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask(Messages.saveOrganization, IProgressMonitor.UNKNOWN);
                for (Organization organization : organizationsWorkingCopy) {
                    monitor.subTask(Messages.validatingOrganizationContent);
                    String errorMessage = isOrganizationValid(organization);
                    if (errorMessage != null) {
                        throw new InterruptedException(organization.getName() + ": " + errorMessage);
                    }
                    String fileName = organization.getName() + "."
                            + OrganizationRepositoryStore.ORGANIZATION_EXT;
                    IRepositoryFileStore file = store.getChild(fileName);
                    Organization oldOrga = null;
                    if (file == null) {
                        file = store.createRepositoryFileStore(fileName);
                    } else {
                        oldOrga = (Organization) file.getContent();
                    }
                    if (oldOrga != null) {
                        RefactorActorMappingsOperation refactorOp = new RefactorActorMappingsOperation(oldOrga,
                                organization);
                        refactorOp.run(monitor);
                    }
                    file.save(organization);
                }
                for (Organization orga : organizations) {
                    boolean exists = false;
                    for (Organization orgCopy : organizationsWorkingCopy) {
                        if (orgCopy.getName().equals(orga.getName())) {
                            exists = true;
                            break;
                        }
                    }
                    if (!exists) {
                        IRepositoryFileStore f = store
                                .getChild(orga.getName() + "." + OrganizationRepositoryStore.ORGANIZATION_EXT);
                        if (f != null) {
                            f.delete();
                        }
                    }
                }
                monitor.done();
            }
        });
    } catch (InterruptedException e) {
        openErrorStatusDialog(e.getMessage());
        return false;
    } catch (InvocationTargetException e) {
        BonitaStudioLog.error(e);
        return false;
    }
    IPreferenceStore preferenceStore = BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore();
    String pref = preferenceStore.getString(ActorsPreferenceConstants.TOGGLE_STATE_FOR_PUBLISH_ORGANIZATION);
    boolean publishOrganization = preferenceStore.getBoolean(ActorsPreferenceConstants.PUBLISH_ORGANIZATION);
    if (publishOrganization && MessageDialogWithToggle.ALWAYS.equals(pref)) {
        try {
            publishOrganization(preferenceStore);
        } catch (InvocationTargetException e) {
            BonitaStudioLog.error(e);

        } catch (InterruptedException e) {
            BonitaStudioLog.error(e);
        }
    } else {
        if (MessageDialogWithToggle.NEVER.equals(pref) && activeOrganizationHasBeenModified) {
            String[] buttons = { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
            MessageDialogWithToggle mdwt = new MessageDialogWithToggle(Display.getDefault().getActiveShell(),
                    Messages.organizationHasBeenModifiedTitle, null,
                    Messages.bind(Messages.organizationHasBeenModifiedMessage, activeOrganization.getName()),
                    MessageDialog.WARNING, buttons, 0, Messages.doNotDisplayAgain, false);
            mdwt.setPrefStore(preferenceStore);
            mdwt.setPrefKey(ActorsPreferenceConstants.TOGGLE_STATE_FOR_PUBLISH_ORGANIZATION);
            int index = mdwt.open();
            if (index == 2) {
                try {
                    publishOrganization(preferenceStore);
                    if (mdwt.getToggleState()) {
                        preferenceStore.setDefault(ActorsPreferenceConstants.PUBLISH_ORGANIZATION, true);
                    }
                } catch (InvocationTargetException e) {
                    BonitaStudioLog.error(e);

                } catch (InterruptedException e) {
                    BonitaStudioLog.error(e);
                }
            } else {
                if (mdwt.getToggleState()) {
                    preferenceStore.setDefault(ActorsPreferenceConstants.PUBLISH_ORGANIZATION, false);
                    preferenceStore.setDefault(ActorsPreferenceConstants.TOGGLE_STATE_FOR_PUBLISH_ORGANIZATION,
                            MessageDialogWithToggle.ALWAYS);
                }
            }
        }

    }
    return true;
}

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

License:Open Source License

private static String[] getButtonLabelsFor(int kind) {
    String[] dialogButtonLabels;//from   w  w  w.  ja va  2  s  .  com
    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);
    }//from   ww  w  .jav  a  2s.  com
    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.common.jface.YesNoToAllDialog.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(4, false));
    buttonbar.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
    super.createButton(buttonbar, NO_TO_ALL, Messages.noToAll, false);
    super.createButton(buttonbar, NO, IDialogConstants.NO_LABEL, true);
    super.createButton(buttonbar, YES, IDialogConstants.YES_LABEL, false);
    super.createButton(buttonbar, YES_TO_ALL, Messages.yesToAll, false);
    return buttonBar;
}

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

License:Open Source License

public void removeConnectorDefinition(final String name, final String version) {
    SWTBotConnectorTestUtil.activateConnectorDefEditionShell(bot);
    bot.tree().setFocus();/*from   ww  w.jav a2s.c  o m*/
    bot.waitUntil(new ICondition() {

        public boolean test() throws Exception {
            bot.tree().select("Uncategorized").expandNode("Uncategorized").select(name + " (" + version + ")");
            return bot.tree().selectionCount() > 0;
        }

        public void init(SWTBot bot) {

        }

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

    assertNotNull("could not find" + name + " (" + version + ")", bot.tree().select("Uncategorized")
            .expandNode("Uncategorized").getNode(name + " (" + version + ")"));
    bot.tree().select("Uncategorized").expandNode("Uncategorized").select(name + " (" + version + ")");
    bot.button("Delete").click();
    if (!FileActionDialog.getDisablePopup()) {
        bot.waitUntil(Conditions.shellIsActive("Delete?"));
        bot.button(IDialogConstants.YES_LABEL).click();
    }
    bot.button(IDialogConstants.CANCEL_LABEL).click();
}

From source file:org.bonitasoft.studio.diagram.test.TestDeleteDiagrams.java

License:Open Source License

@Test
public void testDeleteDiagrams() {

    final DiagramRepositoryStore diagramStore = RepositoryManager.getInstance()
            .getRepositoryStore(DiagramRepositoryStore.class);

    final int nbDiagramsInRepository = diagramStore.getChildren().size();

    final SWTBotMenu diagramMenu = bot.menu("Diagram");
    final List<String> newDiagramsName = new ArrayList<String>();
    for (int i = 0; i < nbDiagrams; i++) {
        SWTBotTestUtil.createNewDiagram(bot);
        bot.waitUntil(Conditions.widgetIsEnabled(diagramMenu), 40000);
        newDiagramsName.add(bot.activeEditor().getTitle());
    }/*from w w w  .j  a  v  a2 s  .  c om*/
    assertEquals("4 diagrams should have been created", nbDiagrams, newDiagramsName.size());

    final int nbEditors = bot.editors().size();
    final String currentDiagramName = bot.activeEditor().getTitle();
    bot.waitUntil(Conditions.widgetIsEnabled(bot.menu("Diagram")), 10000);
    bot.menu("Diagram").menu("Delete...").click();
    bot.waitUntil(Conditions.shellIsActive(Messages.DeleteDiagramWizardPage_title), 10000);

    final SWTBotTree tree = bot.tree();
    assertEquals("the list of diagrams should contain 4 items", nbDiagramsInRepository + nbDiagrams,
            tree.getAllItems().length);

    final TableCollection selection = tree.selection();
    assertEquals("only " + currentDiagramName + " should be selected in the tree viewer", 1,
            selection.rowCount());
    assertEquals("diagram " + currentDiagramName + " should be selected", currentDiagramName,
            selection.get(0, 0));

    //   final SWTBotTreeItem firstSwtBotTreeItem = tree.getAllItems()[1];
    //   final SWTBotTreeItem secondSwtBotTreeItem = tree.getAllItems()[2];
    //   final SWTBotTreeItem thirdSwtBotTreeItem = tree.getAllItems()[3];

    tree.select(newDiagramsName.get(1), newDiagramsName.get(2), newDiagramsName.get(3));

    bot.button(Messages.removeProcessLabel).click();

    bot.waitUntil(Conditions.shellIsActive(Messages.confirmProcessDeleteTitle));
    bot.button(IDialogConstants.YES_LABEL).click();
    bot.waitUntil(new ICondition() {

        @Override
        public boolean test() throws Exception {
            return nbEditors - 3 == bot.editors().size();
        }

        @Override
        public void init(final SWTBot bot) {

        }

        @Override
        public String getFailureMessage() {
            return "editors have not been closed after deleted diagrams";
        }
    }, 40000, 100);

    assertEquals("deleted diagrams are still in repository", nbDiagramsInRepository + 1,
            diagramStore.getChildren().size());

}

From source file:org.bonitasoft.studio.swtbot.framework.application.BotOpenDiagramDialog.java

License:Open Source License

public BotOpenDiagramDialog delete() {
    bot.button(org.bonitasoft.studio.diagram.custom.i18n.Messages.removeProcessLabel).click();
    bot.waitUntil(Conditions//from   w w  w  .  j  a v a  2 s  .  c  o m
            .shellIsActive(org.bonitasoft.studio.diagram.custom.i18n.Messages.confirmProcessDeleteTitle));
    bot.button(IDialogConstants.YES_LABEL).click();
    bot.waitUntil(Conditions.shellIsActive(getDialogTitle()));
    bot.activeShell().setFocus();
    return this;
}

From source file:org.codecover.eclipse.views.controls.DeleteTestElementsConfirmDialog.java

License:Open Source License

/**
 * Constructs a dialog which asks the user to confirm a deletion of test
 * elements./*from   w ww .  j a  va2  s.  c  o  m*/
 * 
 * @param shell     the parent shell
 * @param selection the test elements the user selected for deletion
 */
public DeleteTestElementsConfirmDialog(Shell shell, Object[] selection) {
    super(shell, TITLE, null, MSG, MessageDialog.QUESTION,
            // adapt YES_BUTTON_INDEX if you change the following!
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1);
    this.selection = selection;
    this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
}