示例#1
0
  @Override
  public void execute() {
    redo();

    // Edit in-place
    UIRequestManager.INSTANCE.fireRequest(new TreeEditElementRequest(this, fFolder));
  }
示例#2
0
  @Override
  public void redo() {
    fParent.getFolders().add(fFolder);

    // Select
    UIRequestManager.INSTANCE.fireRequest(
        new TreeSelectionRequest(this, new StructuredSelection(fFolder), true));
  }
示例#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);
  }