indexing
	cluster: "demangler"
	namespace: "candidate"
	description: "A fix for a single error in a `synchronised_directory'."
	original_author: "Justin Finnerty"
	original_date: "July 2005"
	current_date: "$Date: 2005/09/27 06:14:47 $"
	current_author: "$Author: finnerty $"
	revision: "$Revision: 2.1 $"	
	-- $Log: rename_transform.e,v $
	-- Revision 2.1  2005/09/27 06:14:47  finnerty
	-- Updated to use GOBO and work with SE and VE
	--
	-- Revision 2.0  2005/08/26 23:31:39  finnerty
	-- == alpha version ==
	--
	-- Revision 1.1  2005/08/17 06:42:33  finnerty
	-- concrete sub-type of TRANSFORM that renames a file
	--

class RENAME_TRANSFORM
	-- Change name on object in a `synchronised_directory'.

inherit
	TRANSFORM

creation {ANY}
	make

feature {ANY}
	-- Queries on object
	name: UC_STRING is
			-- descriptive label for rename_transform type (for REPORT_DISPLAY etc)
		once
			!!Result.make_from_utf8 ("Rename")
		end

	remove is
			-- Perform undo operation on virtual directory.
		do
			m_object.set_name (m_old_name)
			-- Indicate we are not doable
			previous_transform := Current
		end
	
	to_text: UC_STRING is
			-- concise description of action to perform (for
			-- REPORT_DISPLAY etc).
		do
			!!Result.make_from_utf8 ("Rename [")
			Result.append_string (m_old_name)
			Result.append_string ("] to [")
			Result.append_string (m_object.name)
			Result.append_string ("] in [")
			Result.append_string (m_object.parent.path)
			Result.append_string ("].")
		end

feature {ANY}
	-- Perform rename_transformations
	do_action is
			-- Perform a corrective operation on a sync_dir
		do
			sync_report.sync_dir.rename_to (m_parent_path, m_old_name, m_object.name)
		end

	do_undo is
			-- Undo a corrective operation on a sync_dir
		do
			sync_report.sync_dir.rename_to (m_parent_path, m_object.name, m_old_name)
		end

feature {NONE}
	make(an_fso: FILE_SYSTEM_OBJECT; a_new_name: STRING; a_report: SYNC_REPORT) is
			-- Make object
		require
			-- a_new_name is valid file name for filesystem
			-- Valid_file_name: is_valid_path (a_new_name)
		do
			m_object := an_fso
			m_old_name := m_object.name
			m_parent_path := m_object.parent.path
			m_object.set_name (a_new_name)
			sync_report := a_report
		end

	m_old_name: STRING

	m_parent_path: STRING

	m_object: FILE_SYSTEM_OBJECT

end -- class RENAME_TRANSFORM
