@Override
 public IStatus handle(
     final String id,
     final IConsoleService tools,
     final Map<String, Object> data,
     final IProgressMonitor monitor) {
   if (id.equals(LOAD_HISTORY_ID)) {
     return loadHistory(tools, data, monitor);
   }
   if (id.equals(SAVE_HISTORY_ID)) {
     return saveHistory(tools, data, monitor);
   }
   if (id.equals(ADDTO_HISTORY_ID)) {
     final String item =
         ToolEventHandlerUtil.getCheckedData(data, "text", String.class, true); // $NON-NLS-1$
     tools.getTool().getHistory().addCommand(item, tools.getController().getCurrentSubmitType());
     return Status.OK_STATUS;
   }
   throw new UnsupportedOperationException();
 }
  protected IStatus saveHistory(
      final IConsoleService tools, final Map<String, Object> data, final IProgressMonitor monitor) {
    try {
      CoreException fileException = null;
      IFileStore fileStore = null;
      final IStatus status;

      final String filename =
          ToolEventHandlerUtil.getCheckedData(data, "filename", String.class, true); // $NON-NLS-1$
      final ToolWorkspace workspaceData = tools.getWorkspaceData();
      try {
        fileStore = workspaceData.toFileStore(filename);
      } catch (final CoreException e) {
        fileException = e;
      }
      if (fileStore == null) {
        status =
            new Status(
                IStatus.ERROR,
                NicoCore.PLUGIN_ID,
                -1,
                NLS.bind(
                    Messages.ToolController_FileOperation_error_CannotResolve_message, filename),
                fileException);
      } else {
        status =
            tools
                .getTool()
                .getHistory()
                .save(fileStore, EFS.NONE, workspaceData.getEncoding(), false, monitor);
      }
      tools.handleStatus(status, monitor);
      return status;
    } catch (final OperationCanceledException e) {
      return Status.CANCEL_STATUS;
    }
  }