protected Vector validateUseCaseMaps(List selectedUseCaseMap, Vector auxiliar) {
   auxiliar.clear();
   auxiliar.addAll(selectedUseCaseMap);
   for (int i = 0; i < selectedUseCaseMap.size(); i++) {
     UseCaseMap useCaseMap = (UseCaseMap) selectedUseCaseMap.get(i);
     for (int j = 0; j < useCaseMap.getPaths().size(); j++) {
       Path path = (Path) useCaseMap.getPaths().get(j);
       for (int k = 0; k < path.getNodes().size(); k++) {
         PathNode node = (PathNode) path.getNodes().get(k);
         if (node instanceof ResponsibilityNode) {
           for (int h = 0;
               h < ((ResponsibilityNode) node).getResponsibility().getPreconditions().size();
               h++) {
             Condition condition =
                 (Condition)
                     ((ResponsibilityNode) node).getResponsibility().getPreconditions().get(h);
             if (!condition.getType().equals(Condition.mappingCondition)
                 && !selectedUseCaseMap.contains(
                     condition.getDependencyResponsibility().getMap())) {
               auxiliar.add(condition.getDependencyResponsibility().getMap());
               return validateUseCaseMaps(auxiliar, new Vector());
             }
           }
         }
         if (node instanceof StubNode) {
           if (!selectedUseCaseMap.contains(((StubNode) node).getReferencedMap())) {
             auxiliar.add(((StubNode) node).getReferencedMap());
             return validateUseCaseMaps(auxiliar, new Vector());
           }
         }
       }
     }
   }
   return auxiliar;
 }
 private void fillPropertyTable(Table table, List properties) {
   for (Iterator iter = properties.iterator(); iter.hasNext(); ) {
     UseCaseMap useCaseMap = (UseCaseMap) iter.next();
     final TableItem item = new TableItem(table, SWT.NONE);
     item.setText(new String[] {useCaseMap.getName(), useCaseMap.getDescription()});
     item.setData(useCaseMap);
   }
 }
 protected void updateTablesToAddFunctionalUseCaseMap(UseCaseMap map) {
   for (int i = mappedTable.getItems().length - 1; i >= 0; i--) {
     TableEditor editor = (TableEditor) editorsTable.get(mappedTable.getItems()[i]);
     for (int j = 0; j < map.getComponentRoles().size(); j++) {
       ComponentRole c = (ComponentRole) map.getComponentRoles().get(j);
       int index = ((CCombo) editor.getEditor()).getItemCount();
       ((CCombo) editor.getEditor()).add(c.getFullName());
       ((CCombo) editor.getEditor()).setData(String.valueOf(index), c);
       auxiliarTable.put((CCombo) editor.getEditor(), c, new Integer(index));
     }
   }
 }
 protected void updateTablesToRemoveFunctionalUseCaseMap(UseCaseMap map) {
   for (int i = mappedTable.getItems().length - 1; i >= 0; i--) {
     TableEditor editor = (TableEditor) editorsTable.get(mappedTable.getItems()[i]);
     for (int j = map.getComponentRoles().size() - 1; j >= 0; j--) {
       ComponentRole c = (ComponentRole) map.getComponentRoles().get(j);
       Integer index = (Integer) auxiliarTable.get(editor.getEditor(), c);
       if (((CCombo) editor.getEditor()).getSelectionIndex() == index) {
         ((CCombo) editor.getEditor()).select(0);
       }
       ((CCombo) editor.getEditor()).remove(index);
       ((CCombo) editor.getEditor()).redraw();
     }
   }
 }
 private void updateEventTableToAdd() {
   Vector architecturalMaps = new Vector();
   for (int i = 0; i < architecturalUseCaseMapTable.getItemCount(); i++) {
     architecturalMaps.add(architecturalUseCaseMapTable.getItem(i).getData());
   }
   List events = getEvents(architecturalMaps);
   Vector allEvents = new Vector();
   for (int i = 0; i < architecturalMaps.size(); i++) {
     UseCaseMap useCaseMap = (UseCaseMap) architecturalMaps.get(i);
     if (useCaseMap.getComponentRoles().size() > 0) {
       ComponentRole role = (ComponentRole) useCaseMap.getComponentRoles().get(0);
       allEvents.addAll(role.getMap().getCoreModel().getEvents());
       break;
     }
   }
   for (int i = 0; i < events.size(); i++) {
     setComboBoxToEvents(eventTable, (ConditionEvent) events.get(i), allEvents);
   }
 }
 private List getEvents(Vector architecturalMaps) {
   Vector currentEvents = new Vector();
   for (int i = 0; i < eventTable.getItemCount(); i++) {
     currentEvents.add((ConditionEvent) eventTable.getItem(i).getData());
   }
   Vector result = new Vector();
   EList events;
   for (int i = 0; i < architecturalMaps.size(); i++) {
     UseCaseMap useCaseMap = (UseCaseMap) architecturalMaps.get(i);
     if (useCaseMap.getComponentRoles().size() > 0) {
       ComponentRole role = (ComponentRole) useCaseMap.getComponentRoles().get(0);
       events = role.getMap().getCoreModel().getEvents();
       for (int j = 0; j < events.size(); j++) {
         if (!currentEvents.contains(events.get(j))) {
           result.add(events.get(j));
         }
       }
       break;
     }
   }
   for (int j = result.size() - 1; j >= 0; j--) {
     ConditionEvent event = (ConditionEvent) result.get(j);
     EList conditions = event.getAssociatedConditions();
     boolean contains = false;
     for (int i = conditions.size() - 1; i >= 0; i--) {
       if (architecturalMaps.contains(
           ((Condition) conditions.get(i)).getSourceResponsibility().getMap())) {
         contains = true;
         break;
       }
     }
     if (!contains) {
       result.remove(j);
     }
   }
   return result;
 }
  public void initEditFamily(
      List ArchitecturalUseCaseMaps, List FunctionalUseCaseMaps, Family family) {
    createShell();
    Vector functionalMaps = new Vector();
    functionalMaps.addAll(FunctionalUseCaseMaps);
    functionalMaps.removeAll(ArchitecturalUseCaseMaps);
    createUseCaseMaps(shell, ArchitecturalUseCaseMaps, functionalMaps);
    fillPropertyTable(architecturalUseCaseMapTable, family.getArchitecturalUseCaseMaps());
    createEvents(shell, architecturalUseCaseMapTable);
    updateTablesToAddArchitecturalUseCaseMap(
        family.getArchitecturalUseCaseMaps(), functionalUseCaseMapTable, mappedTable);
    fillPropertyTable(functionalUseCaseMapTable, family.getFunctionalUseCaseMaps());

    for (int i = 0; i < family.getFunctionalUseCaseMaps().size(); i++)
      updateTablesToAddFunctionalUseCaseMap((UseCaseMap) family.getFunctionalUseCaseMaps().get(i));

    for (int i = 0; i < family.getFamilyElement().size(); i++) {
      FamilyElement familyElement = (FamilyElement) family.getFamilyElement().get(i);
      for (int j = 0; j < mappedTable.getItems().length; j++) {
        TableItem item = mappedTable.getItems()[j];
        if (item.getData().equals(familyElement.getArchitecturalComponent())) {
          TableEditor editor = (TableEditor) editorsTable.get(item);
          CCombo combo = ((CCombo) editor.getEditor());
          for (int k = 0; k < combo.getItemCount(); k++) {
            if (auxiliarTable.get(combo, familyElement.getFunctionalComponent()) != null
                && (Integer) auxiliarTable.get(combo, familyElement.getFunctionalComponent())
                    == k) {
              combo.select(k);
              break;
            }
          }
        }
      }
    }

    Vector auxComponents = new Vector();
    for (int i = 0; i < family.getFunctionalUseCaseMaps().size(); i++) {
      for (int j = 0;
          j < ((UseCaseMap) family.getFunctionalUseCaseMaps().get(i)).getComponentRoles().size();
          j++) {
        if (!auxComponents.contains(
            ((UseCaseMap) family.getFunctionalUseCaseMaps().get(i)).getComponentRoles().get(j))) {
          auxComponents.add(
              ((UseCaseMap) family.getFunctionalUseCaseMaps().get(i)).getComponentRoles().get(j));
        }
      }
    }

    Vector architecturalMap =
        validateUseCaseMaps(family.getArchitecturalUseCaseMaps(), new Vector());
    for (int i = 0; i < architecturalMap.size(); i++) {
      UseCaseMap useCaseMap = (UseCaseMap) architecturalMap.get(i);
      for (int j = 0; j < useCaseMap.getComponentRoles().size(); j++) {
        boolean findComponent = false;
        for (int k = 0; k < mappedTable.getItems().length; k++) {
          TableItem item = mappedTable.getItems()[k];
          if (item.getData().equals(useCaseMap.getComponentRoles().get(j))) {
            findComponent = true;
            break;
          }
        }
        if (!findComponent) {
          boolean existsUseCaseMap = false;
          for (int k = 0; k < architecturalUseCaseMapTable.getItems().length; k++) {
            TableItem item = architecturalUseCaseMapTable.getItems()[k];
            if (item.getData()
                .equals(((ComponentRole) useCaseMap.getComponentRoles().get(j)).getMap())) {
              existsUseCaseMap = true;
              break;
            }
          }
          if (!existsUseCaseMap) {
            final TableItem item = new TableItem(architecturalUseCaseMapTable, SWT.NONE);
            item.setText(
                new String[] {
                  ((ComponentRole) useCaseMap.getComponentRoles().get(j)).getMap().getName(),
                  ((ComponentRole) useCaseMap.getComponentRoles().get(j)).getMap().getDescription()
                });
            item.setData(((ComponentRole) useCaseMap.getComponentRoles().get(j)).getMap());
          }
          setComboBox(
              mappedTable, (ComponentRole) useCaseMap.getComponentRoles().get(j), auxComponents);
        }
      }
    }

    ConditionEventToConditionEventMapEntryImpl key;
    Object value;
    for (Iterator e = family.getEvents().iterator(); e.hasNext(); ) {
      key = (ConditionEventToConditionEventMapEntryImpl) e.next();
      value = family.getEvents().get(key.getKey());
      for (int j = 0; j < eventTable.getItems().length; j++) {
        TableItem item = eventTable.getItems()[j];
        if (item.getData().equals(key.getKey())) {
          TableEditor editor = (TableEditor) editorsTableToEvent.get(item);
          CCombo combo = ((CCombo) editor.getEditor());
          for (int k = 0; k < combo.getItemCount(); k++) {
            if ((Integer) auxiliarTableToEvent.get(combo, value) == k) {
              combo.select(k);
              break;
            }
          }
        }
      }
    }

    familyName.setText(modifyFamily.getName());
  }