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.apache.directory.studio.valueeditors.password.PasswordDialog.java

License:Apache License

/**
 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
 *///from   ww w.  j a va 2  s.c om
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    // load dialog settings
    try {
        int tabIndex = ValueEditorsActivator.getDefault().getDialogSettings()
                .getInt(SELECTED_TAB_DIALOGSETTINGS_KEY);
        if (currentPassword == null || currentPassword.toBytes().length == 0) {
            tabIndex = NEW_TAB;
        }
        tabFolder.setSelection(tabIndex);
    } catch (Exception e) {
    }

    try {
        String hashMethodName = ValueEditorsActivator.getDefault().getDialogSettings()
                .get(SELECTED_HASH_METHOD_DIALOGSETTINGS_KEY);

        LdapSecurityConstants hashMethod = LdapSecurityConstants.getAlgorithm(hashMethodName);

        if ((hashMethod == null) || NO_HASH_METHOD.equals(hashMethodName)) {
            newPasswordHashMethodComboViewer.setSelection(new StructuredSelection(NO_HASH_METHOD));
        } else {
            newPasswordHashMethodComboViewer.setSelection(new StructuredSelection(hashMethod));
        }
    } catch (Exception e) {
    }

    // update on load
    updateTabFolder();
}

From source file:org.apache.directory.studio.valueeditors.password.PasswordDialog.java

License:Apache License

/**
 * Verifies the current password.//ww  w  .  j  a v  a2 s  .c o  m
 */
private void verifyCurrentPassword() {
    String testPassword = testPasswordText.getText();
    if (currentPassword != null) {
        if (currentPassword.verify(testPassword)) {
            MessageDialog dialog = new MessageDialog(getShell(),
                    Messages.getString("PasswordDialog.PasswordVerification"), getShell().getImage(), //$NON-NLS-1$
                    Messages.getString("PasswordDialog.PasswordVerifiedSuccessfully"), //$NON-NLS-1$
                    MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
            dialog.open();
        } else {
            IStatus status = new Status(IStatus.ERROR, ValueEditorsConstants.PLUGIN_ID, 1,
                    Messages.getString("PasswordDialog.PasswordVerificationFailed"), null); //$NON-NLS-1$
            ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(status);
        }
    }
}

From source file:org.bbaw.pdr.ae.view.filesaveandload.local.FileSaveDialog.java

License:Open Source License

@Override
protected final void createButtonsForButtonBar(final Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

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

License:Open Source License

private void createWidget(String widgetId, String widgetType, int inputIndex) {
    bot.button("Add...").click();
    bot.textWithLabel("Widget id*").setText(widgetId);
    bot.comboBoxWithLabel("Widget type").setSelection(widgetType);
    bot.comboBoxWithLabel("Input *").setSelection(inputIndex);
    bot.textWithLabel("Display name").setText(widgetId);
    bot.button(IDialogConstants.OK_LABEL).click();
}

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

License:Open Source License

@Test
public void testConnectorExpression() {
    final String id = "connectorExpressionTest";
    createConnectorDefinition(id);/*from ww w .  j a va  2  s.  co  m*/
    SWTBotConnectorTestUtil.activateConnectorTestWizard(bot);
    bot.text().setText(id);
    bot.table().select(id);
    //    bot.tree().select("Uncategorized");
    //  bot.table().select(id);
    //bot.table().select(indices);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.toolbarButtonWithId(SWTBOT_ID_EDITBUTTON, 0).click();
    bot.table().select("Constant");
    bot.text().setText("Hello World");
    assertFalse("return type combobox should be disabled", bot.comboBoxWithLabel("Return type").isEnabled());
    assertEquals("wrong return type", bot.comboBoxWithLabel("Return type").selection(), String.class.getName());
    bot.button(IDialogConstants.OK_LABEL).click();
    assertEquals("wrong value for input1", bot.textWithLabel("Input1").getText(), "Hello World");
    editGroovyEditor(1, "Input2", Boolean.class.getName(), "booleanScriptTest", "1==1;");
    editGroovyEditor(2, "Input3", Double.class.getName(), "doubleScriptTest", "(double)9.345+1.256;");
    editGroovyEditor(3, "Input4", Float.class.getName(), "floatScriptTest", "(float)9.345+1.256;");
    editGroovyEditor(4, "Input5", Integer.class.getName(), "integerScriptTest", "(int)9+10;");
    editGroovyEditor(5, "Input6", List.class.getName(), "listScriptTest", "def list=[1,2,3];");
    bot.button(IDialogConstants.CANCEL_LABEL).click();
}

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

License:Open Source License

private void editGroovyEditor(int buttonIndex, String inputName, String inputtype, String scriptName,
        String groovyScript) {//from  www . j a  v  a  2  s  .  c  o m
    bot.toolbarButtonWithId(SWTBOT_ID_EDITBUTTON, buttonIndex).click();
    bot.table().select("Script");
    bot.waitUntil(Conditions.widgetIsEnabled(bot.textWithLabel("Name *")), 10000);
    assertFalse("ok button should be disabled until name is specified",
            bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.textWithLabel("Name *").setText(scriptName);
    bot.styledText().setText(groovyScript);
    assertFalse("return type combobox should be disabled", bot.comboBoxWithLabel("Return type").isEnabled());
    assertEquals("return type should be" + inputtype, bot.comboBoxWithLabel("Return type").getText(),
            inputtype);
    bot.button(IDialogConstants.OK_LABEL).click();
    assertEquals("wrong value for " + inputName, bot.textWithLabel(inputName).getText(), scriptName);
}

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

License:Open Source License

private void editGroovyEditor(int buttonIndex, String inputName, String inputtype, String scriptName,
        String groovyScript) {/*from ww w  .  j a v a2  s  .  c  o  m*/
    bot.toolbarButtonWithId(SWTBOT_ID_EDITBUTTON, buttonIndex).click();
    bot.table().select("Script");
    bot.waitUntil(Conditions.widgetIsEnabled(bot.textWithLabel("Name *")), 10000);
    assertFalse("ok button should be disabled until name is specified",
            bot.button(IDialogConstants.OK_LABEL).isEnabled());
    bot.textWithLabel("Name *").setText(scriptName);
    bot.styledText().setText(groovyScript);
    assertFalse("return type combobox should be disabled", bot.comboBoxWithLabel("Return type").isEnabled());
    assertEquals("return type should be" + inputtype, bot.comboBoxWithLabel("Return type").getText(),
            inputtype);
    bot.button(IDialogConstants.OK_LABEL).click();
    assertEquals("wrong value for " + inputName, bot.textWithId(SWTBOT_ID_EXPRESSIONVIEWER_TEXT, 0).getText(),
            scriptName);
}

From source file:org.bonitasoft.studio.actors.tests.exporter.SWTBotActorFilterExportTests.java

License:Open Source License

private void exportActorFilter(String connector, String fileName, boolean hasDependencies, boolean hasSources)
        throws Exception {
    File f = new File(ProjectUtil.getBonitaStudioWorkFolder().getAbsolutePath());
    final String exportPath = f.getAbsolutePath();
    SWTBotActorFilterUtil.activateExportActorFilterShell(bot);
    bot.table().select(connector);//from w w w  .jav a2 s  . c o m
    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.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)), 5000);
    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.actors.tests.organization.OrganizationCreationTest.java

License:Open Source License

@Test
public void testAddOrganization() {
    final String firstName1 = "Coralie";
    final String lastName1 = "Auclair";
    final String firstName2 = "Vincent";
    final String lastName2 = "Gilbert";
    final String firstName3 = "Martin";
    final String lastName3 = "Dupuis";
    final String organizationName = "Organization1";
    final String[] membership1 = { "/Group1", "Role1" };
    final ArrayList<String[]> membershipList1 = new ArrayList<String[]>();
    membershipList1.add(membership1);//from  ww w. j a va  2s . co  m
    final ArrayList<String[]> membershipList2 = new ArrayList<String[]>();
    final String[] membership2 = { "/Group1/Group3", "Role2" };
    membershipList2.add(membership2);
    final String[] membership3 = { "/Group1/Group2/Group4", "Role3" };
    membershipList2.add(membership3);
    SWTBotActorFilterUtil.activateNewOrganizationWizard(bot);
    final SWTBotShell shell = bot.shell(Messages.manageOrganizationTitle);
    bot.button(Messages.add).click();
    bot.table(0).select(organizationName);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button(Messages.addParentGroup).click();
    bot.tree().select("Group1");
    bot.button(Messages.addSubGroup).click();
    bot.tree().select("Group1");
    bot.button(Messages.addSubGroup).click();
    bot.tree().getTreeItem("Group1").getNode("Group2").select();
    bot.button(Messages.addSubGroup).click();
    bot.button(Messages.addParentGroup).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    bot.button(Messages.add).click();
    bot.button(Messages.add).click();
    bot.button(Messages.add).click();
    bot.button(IDialogConstants.NEXT_LABEL).click();
    String user1 = Messages.defaultUserName + 1;
    String user2 = Messages.defaultUserName + 2;
    String user3 = Messages.defaultUserName + 3;
    addNewUSer(user1, firstName1, lastName1, "", membershipList1);
    SWTBotTable table = bot.table();
    assertEquals("First Name " + firstName1 + " in table should be edited", firstName1,
            table.cell(0, Messages.firstName));
    assertEquals("Last Name " + lastName1 + " in table should be edited", lastName1,
            table.cell(0, Messages.lastName));
    addNewUSer(user2, firstName2, lastName2, user1, membershipList2);
    assertEquals("First Name " + firstName2 + " in table should be edited", firstName2,
            table.cell(1, Messages.firstName));
    assertEquals("Last Name " + lastName2 + " in table should be edited", lastName2,
            table.cell(1, Messages.lastName));
    addNewUSer(user3, firstName3, lastName3, user2, membershipList2);
    assertEquals("First Name " + firstName3 + " in table should be edited", firstName3,
            table.cell(2, Messages.firstName));
    assertEquals("Last Name " + lastName3 + " in table should be edited", lastName3,
            table.cell(2, Messages.lastName));

    bot.table().select(0);
    bot.comboBoxWithLabel(Messages.manager).setSelection(user3);
    bot.waitUntil(Conditions.widgetIsEnabled(bot.button(IDialogConstants.FINISH_LABEL)), 10000);
    bot.button(IDialogConstants.FINISH_LABEL).click();

    bot.waitUntil(Conditions.shellIsActive(Messages.organizationValidationFailed), 10000);
    bot.button(IDialogConstants.OK_LABEL).click();

    bot.table().select(0);
    bot.comboBoxWithLabel(Messages.manager).setSelection("");

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

    bot.waitUntil(Conditions.shellCloses(shell));

    OrganizationRepositoryStore store = (OrganizationRepositoryStore) RepositoryManager.getInstance()
            .getRepositoryStore(OrganizationRepositoryStore.class);
    OrganizationFileStore fileStore = store
            .getChild(organizationName + "." + OrganizationRepositoryStore.ORGANIZATION_EXT);
    Organization orga = fileStore.getContent();
    assertNotNull(orga);
    int nbRootGroup = 0;
    for (Group g : orga.getGroups().getGroup()) {
        if (g.getParentPath() == null) {
            nbRootGroup++;
        }
    }
    assertEquals("There should be two root groups", 2, nbRootGroup);
    for (User u : orga.getUsers().getUser()) {
        assertNotNull(u.getMetaDatas());
    }

    synchronizeOrganization(organizationName, user1);
    synchronizeOrganization("ACME", "walter.bates");

}

From source file:org.bonitasoft.studio.actors.tests.organization.OrganizationCreationTest.java

License:Open Source License

private void synchronizeOrganization(String organizationName, String username) {
    SWTBotActorFilterUtil.activateSynchronizeOrganizationWizard(bot);
    bot.table().select(organizationName);
    bot.button(IDialogConstants.NEXT_LABEL).click();
    if (username != null) {
        bot.textWithLabel(Messages.userName).setText(username);
    }/*from   w w  w  .j  av a  2s . c o  m*/
    bot.button(Messages.synchronize).click();
    bot.waitUntil(Conditions.shellIsActive(Messages.synchronizeInformationTitle), 1500000);
    bot.button(IDialogConstants.OK_LABEL).click();
}