def execute(self, context): validation_result = self._validator.validate(context) if validation_result: old_filename = context.filename context.set_basename(self._new_basename.strip()) RideFileNameChanged(datafile=context, old_filename=old_filename).publish() return validation_result
def change_format(self, controller, format): if controller.is_same_format(format): return old_path = controller.filename controller.set_format(format) controller.execute(SaveFile()) if old_path: self._remove_file(old_path) RideFileNameChanged(old_filename=old_path, datafile=controller).publish()
def execute(self, context): validation_result = BaseNameValidator( self._new_basename).validate(context) if validation_result: old_filename = context.filename modify_imports = self._should_modify_imports() if modify_imports is None: return if modify_imports: context.set_basename_and_modify_imports(self._new_basename) else: context.set_basename(self._new_basename) RideFileNameChanged(datafile=context, old_filename=old_filename).publish() return validation_result