@Inject
  public ManagableFileTreePresenter(
      IManagableFileTreeView view,
      IFileTreeView.Presenter fileTreePresenter,
      IFileServiceAsync fileService,
      MessageView.Presenter messagePresenter,
      ITextInputView.Presenter textInputPresenter,
      ICreateSemanticMarkupFilesDialogView.Presenter createSemanticMarkupFilesDialogPresenter) {
    this.fileService = fileService;
    this.view = view;
    this.view.setPresenter(this);
    this.fileTreePresenter = fileTreePresenter;
    fileTreePresenter.addSelectionListener(this);
    this.messagePresenter = messagePresenter;
    this.textInputPresenter = textInputPresenter;
    this.createSemanticMarkupFilesDialogPresenter = createSemanticMarkupFilesDialogPresenter;

    this.defaultServletPath =
        view.getUploader().getServletPath()
            + "?username="******"&sessionID="
            + Authentication.getInstance().getSessionID();
    view.getUploader().setServletPath(defaultServletPath);
    view.getUploader().addOnFinishUploadHandler(new OnFinishUploadHandler());
    view.getUploader().addOnStartUploadHandler(new OnStartUploadHandler());
    view.getUploader().setI18Constants(new MyUploaderConstants());

    IUploadStatus statusWidget = new BaseUploadStatus();
    statusWidget.setCancelConfiguration(IUploadStatus.DEFAULT_CANCEL_CFG);
    // show uploading constantly, instead of the files
    /*display.getUploader().addOnStatusChangedHandler(new OnStatusChangedHandler() {
    @Override
    public void onStatusChanged(IUploader uploader) {
    	uploader.getStatusWidget().setFileName("Uploading...");
    }
      });
      display.getUploader().addOnChangeUploadHandler(new OnChangeUploaderHandler() {
    @Override
    public void onChange(IUploader uploader) {
    	System.out.println("on change");
    }
      });*/
    view.getUploader().setStatusWidget(statusWidget);
    view.setStatusWidget(statusWidget.getWidget());
    view.getUploader().setFileInput(new MyFileInput(view.getAddButton()));

    initActions();
  }
  @Override
  public void onDownload() {
    final FileImageLabelTreeItem selection = fileTreePresenter.getSelectedItem();
    if (selection != null) {
      final String selectionPath = selection.getFileInfo().getFilePath();
      if (selectionPath != null) {
        fileService.getDownloadPath(
            Authentication.getInstance().getToken(),
            selectionPath,
            new RPCCallback<String>() {
              @Override
              public void onResult(String result) {
                // target=" + result.getData() + "&directory=yes
                Window.Location.replace(
                    URL.encode(
                        "/etcsite/download/?target="
                            + result
                            + "&username="******"&"
                            + "sessionID="
                            + Authentication.getInstance().getSessionID()));

                /*Window.open("/etcsite/download/?target=" + result.getData() + "&username="******"&" +
                "sessionID=" + Authentication.getInstance().getSessionID()
                , "download", "resizable=yes,scrollbars=yes,menubar=yes,location=yes,status=yes"); */
              }
            });
      } else {
        messagePresenter.showMessage("File Manager", "Not downloadable");
      }
    } else {
      messagePresenter.showMessage("File Manager", "Please select a file to download");
    }
  }
 private void setStepWidget() {
   if (task == null) panel.setWidget(inputPresenter.getView());
   else
     this.taskService.getTask(
         Authentication.getInstance().getToken(),
         task,
         new RPCCallback<Task>() {
           @Override
           public void onResult(Task result) {
             if (result.getTaskType().getTaskTypeEnum().equals(TaskTypeEnum.SEMANTIC_MARKUP)) {
               switch (TaskStageEnum.valueOf(result.getTaskStage().getTaskStage())) {
                 case INPUT:
                   panel.setWidget(inputPresenter.getView());
                   break;
                 case OUTPUT:
                   outputPresenter.setTask(task);
                   panel.setWidget(outputPresenter.getView());
                   break;
                 case PREPROCESS_TEXT:
                   preprocessPresenter.setTask(task);
                   panel.setWidget(preprocessPresenter.getView());
                   break;
                 case LEARN_TERMS:
                   learnPresenter.setTask(task);
                   panel.setWidget(learnPresenter.getView());
                   break;
                 case REVIEW_TERMS:
                   reviewPresenter.setTask(task);
                   panel.setWidget(reviewPresenter.getView());
                   break;
                 case PARSE_TEXT:
                   parsePresenter.setTask(task);
                   panel.setWidget(parsePresenter.getView());
                   break;
                 default:
                   panel.setWidget(inputPresenter.getView());
                   break;
               }
             }
           }
         });
 }
 @Override
 public void onDelete() {
   FileImageLabelTreeItem selection = fileTreePresenter.getSelectedItem();
   if (selection != null && !selection.getFileInfo().isSystemFile()) {
     fileService.deleteFile(
         Authentication.getInstance().getToken(),
         selection.getFileInfo().getFilePath(),
         new RPCCallback<Void>() {
           @Override
           public void onResult(Void result) {
             ManagableFileTreePresenter.this.initActions();
             fileTreePresenter.clearSelection();
             fileTreePresenter.refresh(fileFilter);
           }
         });
   } else {
     messagePresenter.showMessage(
         "File Manager", "Please select a valid file or directory to delete");
   }
 }