private void setComboBox(Table table, ComponentRole value, List componentsToMap) { final TableItem item = new TableItem(table, SWT.NONE); item.setText(new String[] {value.getFullName(), value.getAbstractInfo()}); item.setData(value); TableEditor editor = new TableEditor(table); final CCombo comboRole = new CCombo(table, SWT.READ_ONLY); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL); gd.widthHint = 200; comboRole.setLayoutData(gd); int j = 0; for (j = 0; j < componentsToMap.size(); j++) { ComponentRole c = (ComponentRole) componentsToMap.get(j); comboRole.add(c.getFullName()); comboRole.setData(String.valueOf(j), c); auxiliarTable.put(comboRole, c, new Integer(j)); } if (value.getAbstractInfo().equals(ComponentRole.standardComponent)) { comboRole.add(value.getFullName()); comboRole.setData(String.valueOf(j), value); comboRole.select(j); auxiliarTable.put(comboRole, value, new Integer(j)); } else { comboRole.add( Messages.getString( "org.isistan.flabot.edit.ucmeditor.dialogs.FamilyManagerDialog.noneRole")); //$NON-NLS-1$ comboRole.setData("None", "None"); // $NON-NLS-1$ //$NON-NLS-2$ comboRole.select(j); } editor.grabHorizontal = true; editor.setEditor(comboRole, item, 2); editorsTable.put(item, editor); combosTable.put(item, comboRole); }
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)); } } }