예제 #1
0
 private void setToDefaultTask(TodoTask task) {
   List<TodoTask> elements = fTodoTasksList.getElements();
   elements.remove(task);
   elements.add(0, task);
   fTodoTasksList.setElements(elements);
   fTodoTasksList.enableButton(IDX_DEFAULT, false);
 }
예제 #2
0
 private void doTodoButtonPressed(int index) {
   TodoTask edited = null;
   if (index != IDX_ADD) {
     edited = fTodoTasksList.getSelectedElements().get(0);
   }
   if (index == IDX_ADD || index == IDX_EDIT) {
     TodoTaskInputDialog dialog =
         new TodoTaskInputDialog(getShell(), edited, fTodoTasksList.getElements());
     if (dialog.open() == Window.OK) {
       if (edited != null) {
         fTodoTasksList.replaceElement(edited, dialog.getResult());
       } else {
         fTodoTasksList.addElement(dialog.getResult());
       }
     }
   } else if (index == IDX_DEFAULT) {
     setToDefaultTask(edited);
   }
 }
예제 #3
0
 private void updateModel(DialogField field) {
   if (field == fTodoTasksList) {
     StringBuffer tags = new StringBuffer();
     StringBuffer prios = new StringBuffer();
     List<TodoTask> list = fTodoTasksList.getElements();
     for (int i = 0; i < list.size(); i++) {
       if (i > 0) {
         tags.append(',');
         prios.append(',');
       }
       TodoTask elem = list.get(i);
       tags.append(elem.name);
       prios.append(elem.priority);
     }
     setValue(PREF_TODO_TASK_TAGS, tags.toString());
     setValue(PREF_TODO_TASK_PRIORITIES, prios.toString());
     validateSettings(PREF_TODO_TASK_TAGS, null, null);
   } else if (field == fCaseSensitiveCheckBox) {
     String state = String.valueOf(fCaseSensitiveCheckBox.isSelected());
     setValue(PREF_TODO_TASK_CASE_SENSITIVE, state);
   }
 }