private void addProjectConfigurationInFirstProject() {
    final PMDProjectPropertyDialogBot dialog =
        JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_1);
    assertTrue("PMD should be enabled", dialog.enablePMD().isChecked());
    assertTrue(
        "The button to add a new configuration should be enabled when PMD is enabled",
        dialog.addConfiguration().isEnabled());

    dialog.enablePMD().select();
    dialog.addConfiguration().click();
    final AddRuleSetConfigurationWizardBot wizard = AddRuleSetConfigurationWizardBot.getActive();
    assertFalse(
        "The finish button should be disabled as long as the name is missing",
        wizard.finish().isEnabled());

    wizard.project().click();
    wizard.next().click();
    assertFalse(
        "The finish button should be disabled as long as the name is missing",
        wizard.finish().isEnabled());

    wizard.name().setText(PROJECT_CONFIGURATION_NAME);
    assertFalse(
        "The finish button should be disabled as long as the location is missing",
        wizard.finish().isEnabled());

    final String projectRelativePath = PMD_XML.toString();
    wizard.location().setText(projectRelativePath);
    wizard.bot().waitUntil(Conditions.tableHasRows(wizard.rules(), 2));
    final String[] expectedNames = new String[] {"ExtendsObject", "BooleanInstantiation"};
    final String[] actualNames = wizard.ruleNames();
    assertArrayEquals("Rules of the PMD configuration", expectedNames, actualNames);
    assertTrue(
        "The finish button should be enabled if bot a name and a location with a valid configuration is available",
        wizard.finish().isEnabled());

    wizard.finish().click();
    wizard.bot().waitUntil(Conditions.shellCloses(wizard));
    dialog.bot().waitUntil(Conditions.tableHasRows(dialog.configurations(), 3));
    assertTrue(
        "The added configuration should be activated",
        dialog.configurations().getTableItem(2).isChecked());
    assertEquals(
        "Name of the configuration",
        PROJECT_CONFIGURATION_NAME,
        dialog.configurations().cell(2, "Name"));
    assertEquals("Type of the configuration", "Project", dialog.configurations().cell(2, "Type"));
    assertEquals(
        "Location of the configuration",
        projectRelativePath,
        dialog.configurations().cell(2, "Location"));

    dialog.ok().click();
    dialog.bot().waitUntil(Conditions.shellCloses(dialog));
  }
  private void activateTheSameConfigurationInSecondProject() {
    PMDProjectPropertyDialogBot dialog =
        JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_2);
    assertFalse("PMD should be disabled by default", dialog.enablePMD().isChecked());

    dialog.enablePMD().select();
    assertEquals(
        "The previously added configuration should als be available in the second project",
        1,
        dialog.configurations().rowCount());
    assertFalse(
        "The available configuration should not be activated",
        dialog.configurations().getTableItem(0).isChecked());
    assertEquals(
        "Name of the configuration",
        FILE_SYSTEM_CONFIGURATION_NAME,
        dialog.configurations().cell(0, "Name"));
    assertEquals(
        "Type of the configuration", "File System", dialog.configurations().cell(0, "Type"));
    assertEquals(
        "Location of the configuration",
        rules.getAbsolutePath(),
        dialog.configurations().cell(0, "Location"));

    dialog.configurations().getTableItem(0).check();
    dialog.ok().click();
    dialog.bot().waitUntil(Conditions.shellCloses(dialog));

    dialog = JavaProjectClient.openPMDProjectPropertyDialog(PROJECT_NAME_2);
    assertTrue("PMD should be enabled", dialog.enablePMD().isChecked());
    assertTrue(
        "The configuration should be activated",
        dialog.configurations().getTableItem(0).isChecked());

    dialog.ok().click();
    dialog.bot().waitUntil(Conditions.shellCloses(dialog));
  }