Beispiel #1
0
 public void saveData() {
   ResourceInfo info;
   List<ResourceInfo> list = project.getResources();
   for (int i = 0; i < table.getItemCount(); i++) {
     info = list.get(i);
     info.setSelected(table.getItem(i).getChecked());
   }
 }
Beispiel #2
0
 void updateTable(int[] selection, int index) {
   table.removeAll();
   for (ResourceInfo info : project.getResources()) {
     TableItem item = new TableItem(table, SWT.NONE);
     item.setText(0, info.getName());
     item.setText(1, info.getId());
     item.setChecked(info.getSelected());
   }
   if (selection == null) {
     if (table.getItemCount() > 0) {
       if (index > -1) {
         if (index > table.getItemCount() - 1) {
           index = table.getItemCount() - 1;
         }
       } else index = 0;
       table.setSelection(index);
     }
     // Else: nothing to select
   } else table.setSelection(selection);
 }