indexing
	cluster: "demangler"
	namespace: "candidate"
	description: "Move an FSO from one directory to another in a `SYNCHRONISED_DIRECTORY' object."
	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: move_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:13  finnerty
	-- concrete sub-type of TRANSFORM that moves files
	--

class MOVE_TRANSFORM
	-- Move an FSO from one directory to another in a
	-- `SYNCHRONISED_DIRECTORY' object.

inherit
	TRANSFORM

creation {ANY}
	make

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

	remove is
			-- Perform undo operation on virtual directory.
		do
			m_object.put_parent (m_old_parent)
			-- 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 ("Move [")
			Result.append_string (m_old_path)
			Result.append_string ("] to [")
			Result.append_string (m_object.path)
			Result.append_string ("].")
		end

feature {ANY}
	-- Perform move_transformations
	do_action is
			-- Perform a corrective operation on a sync_dir
		do
			sync_report.sync_dir.move_to (m_old_path, m_object.path)
		end

	do_undo is
			-- Undo a corrective operation on a sync_dir
		do
			sync_report.sync_dir.move_to (m_object.path, m_old_path)
		end
	
feature {NONE}
	make(an_fso, an_new_parent: FILE_SYSTEM_OBJECT; a_report: SYNC_REPORT) is
			-- Create a move
		require
			-- In general it is pointless unless an_fso.parent /= an_new_parent
		do
			m_object := an_fso
			m_old_parent := m_object.parent
			m_old_path := m_object.path
			sync_report := a_report
			m_object.put_parent (an_new_parent)
		ensure
			an_fso.parent = an_new_parent
		end

	m_old_path: STRING

	m_object: FILE_SYSTEM_OBJECT
			-- Moving object

	m_old_parent:  FILE_SYSTEM_OBJECT
			-- Initial parent of moving object (for undoing)

end -- class MOVE_TRANSFORM
