Ellié Computing Home Page
My Shopping Cart

Your shopping cart is empty

Display Cart

Call us at +1 586 62 ELLIE / +1 586 62 35543 Office Closed
sales@elliecomputing.com - Contact us


FolderDocument object

 

 

Prototype for FolderDocument objects

Syntax

To create a folder document:

var parameters = new Document.Parameters ( );
parameters.document_type = "folders";

var doc = new Document (parameters, "view");

Parameters

none.

Property Of

none.

Implemented In

ECMerge 2.1

Description

FolderDocument objects handle folder browsing or folder comparisons.

Properties

Property Description
root FolderDocument.Item object. Root item, let you access the folder's item tree from the root
information See description in Document object.

 

Properties of information

Property Description
background_content_diff Boolean. Read-only. True if content differentiation is used in background to determine the comparison status of files. Use macro "options_toggle_background_content_diff" to switch this option on and off.
visiting_sub_folders Boolean. Read-only. True if the view is currently visiting all folders. Use macro "options_toggle_folder_visit", to switch this on and off.


 

 

Methods

compare
compare_content
generic_copy
get_bookmarks_selection
get_item
get_statistics (in Document object)
merge
recompare
remove
reset_written_state
resolve

Examples

Example 1.

Creates a folder document to compare two directories, view it and display the statistics box:

var parameters = new Document.Parameters ( );
paramerers.left.url = "/folder1";
paramerers.left.url = "/folder2";
parameters.object_type = "folders";

var doc = new Document (parameters, "view");
add_frame (doc);
execute_macro ("view_comparison_stats");

See Also 

  FolderDocument.Selection object, FolderDocument.Item object

Method compare / compare_content / recompare / reset_written_state

Syntax

function compare (selection)
function compare_content (selection)
function recompare (selection)
function reset_written_state (selection)

Parameters

selection. FolderDocument.Selection object. Selection of items to compare

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

compare and compare_content make the folder document compares the selected items. compare_content always compares the content of the items (when possible). compare follows the rules established in the Folder Comparisons panel of the Document options (i.e. "typed.folders.comparison" name space of the OptionsSet object).

recompare invalidates the result of previous comparisons for selected items, it does not run comparison at once.

reset_written_state removes the Written marker. Written items are ignored by the merge method.

Examples

Example 1.

Compares the currently selected elements:

current_frame.coordinator.document.compare (current_frame.coordinator.current_view.clone_selection());

Method generic_copy

Syntax

function generic_copy (selection, source, target, mode, questions_answers)

Parameters

selection. FolderDocument.Selection object. Selection of items to act on
source, target. Side string. Source and target sides for the generic copy operation
mode. Generic Copy Action string. Type of action to do
questions_answers. Questions/Answers string. Optional. Gives pre-established answers to known UI questions, allowing you to avoid messages boxes.

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

Realizes the same operation as Generic Copy Dialog Box, without user interface.

Note the presence of the "simulate" question, in questions_answers parameter which allow you to only simulate the generic copy operation, and as such, only generate the log corresponding to what would be done (assuming everything is successful).

Examples

Example 1.

Cheks whether the document is folder document, then proposes various actions in choose( ) box and act:

var currentdoc = current_frame.coordinator.document;
if (!(currentdoc instanceof FolderDocument))
    return alert("can't apply folder selection test on non-folder document");
   
// take the selection and copies it from left to right with selected parameters
var copy_choices = ["copy", "mirror", "copy (test only)"];
var copy_codes = ["copy", "mirror", "copy"];
var qa_codes = ["", "", "yes:simulate"];
var copy_choice_idx = choose ("Select a copy mode:", copy_choices);
if (copy_choice_idx != -1)
{
    currentdoc.generic_copy (current_frame.coordinator.current_view.clone_selection(),
        "left", "right", copy_codes[copy_choice_idx], qa_codes[copy_choice_idx]);
}

See Also 

  FolderDocument.Selection object, Side string, Generic Copy Action string, Questions/Answers string

Method get_bookmarks_selection

Syntax

function get_bookmarks_selection( )
returns a FolderDocument.Selection object

Parameters

none.

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

Returns a selection built of the bookmarked items. This method allows you to act on bookmarked items, as easily as you can on selected items.

Examples

Example 1.

Compares contents of the bookmarked items:

var currentdoc = current_frame.coordinator.document;
if (!(currentdoc instanceof FolderDocument))
    return alert("can't apply folder test on non-folder document");

currentdoc.compare (currendoc.get_bookmarks_selection());

See Also 

  FolderDocument.Selection object

Method get_item

Syntax

function get_item (url, side)
returns a FolderDocument.Item object or undefined if not found.

Parameters

url. URL object or String. URL leading to the object which is compared in the wanted folder item
side. Side string. Side in which the searched object appears in the comparison. If undefined or omitted, searches all the sides.

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

get_item searches for the comparison item in which the object pointed to by url appears.

Examples

Example 1.

Finds an item which has the object pointed to by "c:\\temp" in its ancestor side:

var currentdoc = current_frame.coordinator.document;
if (!(currentdoc instanceof FolderDocument))
    return alert("can't apply folder test on non-folder document");

var item = currentdoc.get_item ("c:\\temp", "ancestor");

See Also 

  FolderDocument.Item object

Method merge

Syntax

function merge (selection, questions_answers)

Parameters

selection. FolderDocument.Selection object. Selection of items to act on
questions_answers. Questions/Answers string. Optional. Gives pre-established answers to known UI questions, allowing you to avoid messages boxes.

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

Realizes the 'write merge results' operation as defined in Ellié Computing Merge: it takes each item, do the necessary comparisons, deduce the appropriate action from the comparison class and the settings found in the current document OptionsSet, then it executes this action.

merge will skip errors and unresolved items by default. You can change these baheviour with questions_answers parameters.

Examples

Example 1.

Merges the selected items:

var currentdoc = current_frame.coordinator.document;
if (!(currentdoc instanceof FolderDocument))
    return alert("can't apply folder test on non-folder document");

currentdoc.merge (current_frame.coordinator.current_view.clone_selection());

See Also 

FolderDocument.Selection object,  reset_written_state method.

Method remove

Syntax

function remove (selection, side, questions_answers)

Parameters

selection. FolderDocument.Selection object. Selection of items to act on
side. Side string. Side from which the objects must be removed
questions_answers. Questions/Answers string. Optional. Gives pre-established answers to known UI questions, allowing you to avoid messages boxes.

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

Deletes the file system objects in given side, for each item of the selection.

Note the presence of the "simulate" question, in questions_answers parameter which allow you to only simulate the deletion operation, and as such, only generate the log corresponding to what would be done (assuming everything is successful).

Examples

Example 1.

Tests whether current document is a folder, then asks if the user really wants to delete, then ask if confirmations are necessary, and deleted currently selected items:

var currentdoc = current_frame.coordinator.document;
if (!(currentdoc instanceof FolderDocument))
    return alert("can't apply folder selection test on non-folder document");
   
if (confirm ("Are you sure you want to delete selected items in " +
    current_frame.coordinator.current_view.role + " side?"))
{
    var yesnos = confirm ("Remove confirmations ?") ? "yes=fm-rm-folder,fm-rm-f-folder" : "";

    currentdoc.remove (current_frame.coordinator.current_view.clone_selection(),
        current_frame.coordinator.current_view.role, yesnos);
}

See Also 

  FolderDocument.Selection object, Questions/Answers string

Method resolve

Syntax

function resolve (selection, rules_set, undoable)

Parameters

selection. FolderDocument.Selection object. Selection of items to act on
rules_set. FolderDocument.MergeRulesSet object. Set of actions to use for selected items
undoable. Boolean. True if you want the resolution action to be undoable. This is possible only if the document is viewed.

Method Of

FolderDocument object

Implemented In

ECMerge 2.1

Description

Resolves the selected items with the given resolution rules.

Examples

Example 1.

Tests whether current document is a folder, then let the user choose an action, and finally resolve currently selected item with it:

var currentdoc = current_frame.coordinator.document;
if (!(currentdoc instanceof FolderDocument))
    return alert("can't apply folder selection test on non-folder document");

var sel = current_frame.coordinator.current_view.clone_selection();
var actions = [ 'none', 'mimic:left', 'mimic:right', 'delete' ];
var action = actions[choose('choose an action to apply:', actions)];
if (action)
    currentdoc.resolve (sel, FolderDocument.MergeRulesSet(action));

See Also 

  FolderDocument.Selection object, FolderDocument.MergeRulesSet object