@Override
 public void execute() {
   // Ensure fIndex is stored just before execute because if this is part of a composite delete
   // action
   // then the index positions will have changed
   fIndex = fFolder.getElements().indexOf(fElement);
   if (fIndex != -1) { // might be already be deleted from Command in CompoundCommand
     fFolder.getElements().remove(fElement);
   }
 }
Beispiel #2
0
  @Override
  public void redo() {
    fParent.getFolders().add(fFolder);

    // Select
    UIRequestManager.INSTANCE.fireRequest(
        new TreeSelectionRequest(this, new StructuredSelection(fFolder), true));
  }
Beispiel #3
0
  @Override
  public void undo() {
    fParent.getFolders().remove(fFolder);

    // Select the parent node if no node is selected (this happens when the node is deleted)
    TreeSelectionRequest request =
        new TreeSelectionRequest(this, new StructuredSelection(fParent), true) {
          @Override
          public boolean shouldSelect(Viewer viewer) {
            return viewer.getSelection().isEmpty();
          }
        };
    UIRequestManager.INSTANCE.fireRequest(request);
  }
 @Override
 public void undo() {
   if (fIndex != -1) { // might be already be deleted from Command in CompoundCommand
     fFolder.getElements().add(fIndex, fElement);
   }
 }