The related files functions enhance the editing experience of coders by providing easy access to supporting and related files that are used actively.

dreamweaver.getRelatedFiles()

Availability

Dreamweaver CS4.

Description

This function gets a list of all the related files. The related files can be child documents, source HTML files, and generated source files.

Arguments

A Boolean value that specifies the display names of the parent document and generated source files.

  • Use the value true if you want to display Source HTML and Generated Source in the menu.

  • Use the value false if you want to display the actual names of the related files in the menu.

Returns

An array of strings, which contains all the scanned related files in the form of absolute local URLs.

dreamweaver.openRelatedFile()

Availability

Dreamweaver CS4.

Description

Displays the selected related file in the Code view of the current document.

Arguments

A string that is the absolute local URL of the file.

Returns

None.

dreamweaver.getActiveRelatedFilePath()

Availability

Dreamweaver CS4.

Description

This function gets the full path of the currently opened related file.

Arguments

None.

Returns

A string that is the absolute local URL of the related file.

dreamweaver.getRelatedFilesFilter()

Availability

Dreamweaver CS5.

Description

This function is used to get the filename filter applied to the related files.

Arguments

None.

Returns

A DWFilenameFilter object representing the filter currently applied to the related files. An empty filter object indicates that all the files will be displayed in the Related Files bar.

DWFilenameFilter objects are new in Dreamweaver CS5. They are used to restrict the files displayed in the Related Files bar.

dreamweaver.setRelatedFilesFilter()

Availability

Dreamweaver CS5.

Description

This function is used to set the filter applied to the Related Files Bar.

Arguments

A String or a DWFilenameFilter. For example, “.js”, “.php”, “*.js”, “*.php.js”, “*.css”, “”, “b*.js”, “b*.*”, “*.js;.css”. An empty string will display all the files in the Related Files bar.

Returns

None.

dreamweaver.getQuickRelatedFilesFilterStrings()

Availability

Dreamweaver CS5.

Description

This function is used to get the array of String objects representing extensions of the files shown in the Related Files bar.

Arguments

None.

Returns

An array of String objects representing extensions of the files shown in the Related Files bar. For example, {“.js”, “.php”, “.css”}.

dreamweaver.invokeRelatedFilesCustomFilterDialog()

Availability

Dreamweaver CS5.

Description

This function is used to invoke the custom related files filter dialog box. The user may apply a filter from this dialog and users should call the getRelatedFilesFilter function to determine the new filter.

Arguments

None.

Returns

None.

dreamweaver.getDynamicRelatedFilesDiscoverySetting()

Availability

Dreamweaver CS5.

Description

The Dynamically-Related Files feature extends the functionality of the Related Files feature by allowing you to see the related files of dynamic pages in the Related Files Bar.

This function is used to get the discovery option for dynamically-related files.

Arguments

None.

Returns

A String object specifying the discovery mechanism, which is one of the following values:

Value

Description

automatic

Enables automatic discovery of related files.

manual

Enables manual discovery of related files. In this case, the user has to manually resolve the references to the related files.

disabled

Disables automatic discovery of related files.

dreamweaver.setDynamicRelatedFilesDiscoverySetting()

Availability

Dreamweaver CS5.

Description

This function is used to set the discovery option for dynamically-related files.

Arguments

A String object specifying the discovery mechanism, which is one of the following values:

Value

Description

automatic

Enables automatic discovery of related files.

manual

Enables manual discovery of related files. In this case, the user has to manually resolve the references to the related files.

disabled

Disables automatic discovery of related files.

Returns

None.

dreamweaver.refreshRelatedFiles()

Availability

Dreamweaver CS5.

Description

This function is used to refresh the related files shown in the Related Files bar for the current document.

Arguments

None.

Returns

None.

dreamweaver.saveAllRelatedFiles()

Availability

Dreamweaver CS5.

Description

This function is used to save all the modified related files for the current document. Invoking the function will save the current document and all the modified related files of the current document. If the document is a new document, then a Save As dialog box is shown.

Arguments

None.

Returns

None.

dreamweaver.canSaveAllRelatedFiles()

Availability

Dreamweaver CS5.

Description

This function is used to determine if any related file for the current document is modified and can be saved.

Arguments

None.

Returns

A Boolean: true if any related file has been modified and can be saved.

document.isRelatedFileViewOpen()

Availability

Dreamweaver CS5.

Description

This function is used to determine if the code view window is currently showing the source code of the document.

Arguments

None.

Returns

A Boolean: true if the code view window is displaying the source code for the document. False will be returned if a related file live code is open in the code view window.

document.getRelatedFiles()

Availability

Dreamweaver CS5.

Description

This function is used to retrieve the list of the files related to the document.

Arguments

filtered

A Boolean: true to apply the filter selected in the Related Files bar to the result. Use false to get all the related files of the document. This argument is optional. The default value is false.

type

An optional string that represents the type of the related files. It can be an empty string or a string with one of the following values:

  • SOURCE_HTML - Retrieves the source HTML document, which is the top most document.

  • GENERATED_HTML - Retrieves the live generated HTML document. This option is applicable only when the Live Code feature is enabled.

  • CHILD_DOC - Retrieves the list of static path related documents.

  • PROCESSED_CHILD_DOC - Retrieves the list of related documents processed by the server. This option is applicable only if the dynamically-related files have been discovered and the server generated result references the child documents that were not already found as static path related documents when opening the document.

  • LIVE_VIEW_CHILD - Retrieves the list of Live View related child documents. This option is applicable only when the document is opened in Live View and the server generated source references the child documents that were not already found as static path related documents when opening the document

  • LIVE_VIEW_XHR_CHILD - Retrieves the list of Live View referenced resource documents. This option is applicable only when the document is opened in Live View.

  • DYNAMIC_PATH_CHILD_DOC - Retrieves the list of dynamic path related files. This option is applicable only if the dynamically-related files have been discovered and the dynamic related child documents were found in the discovery process.

  • USER_DEFINED_CHILD_DOC - Retrieves the list of user defined dynamic path related files. This option is applicable only when an extension has added user defined related files after calling the addRelatedFile() function. For more information on the addRelatedFile() function, see document.addRelatedFile().

  • ALL_TYPES - Retrieves all the related files. This is the default value.

Returns

An array of related file objects. Each object has the following properties:

  • uri - A DWUri object representing the URI of the related document.

  • type - A string of one of the types mentioned in the Arguments section and also an UNKNOWN_TYPE if the type is not known.

  • document - A document object of the related document. If there is no related document, this property will be NULL.

  • isChildDocType - A Boolean value. True, if the related document is a child document (not the source or the generated source document).

  • isSelectedDoc- A Boolean value. True, if the document is selected.

document.addRelatedFile()

Availability

Dreamweaver CS5.

Description

This function is used to add an extension-defined related file.

If you are an extension developer, make sure that you invoke the refreshRelatedFiles() function after invoking the addRelatedFile() function. For more information on the refreshRelatedFiles() function, see dreamweaver.refreshRelatedFiles().

Arguments

  • uri - A DWUri object representing the related file object. This argument is required.

  • persistent - A Boolean value. True, if the related file object will persist when the top level document is re-scanned. This is an optional argument.

  • type - A optional string specified in the document.getRelatedFiles() function. Callers who omit this parameter will insert a related file of type USER_DEFINED_CHILD_DOC.

Returns

None.

document.removeRelatedFile()

Availability

Dreamweaver CS5.

Description

This function is used to remove an extension-defined related file.

Related document objects of only type CHILD_DOC can be removed using this function. Related document objects with the type SOURCE_HTML or GENERATED_HTML cannot be removed using this function.

Arguments

uri - A DWUri object representing the related file object. This argument is required.

Returns

None.

document.getDependentFiles()

Availability

Dreamweaver CS5.

Description

This function is used to retrieve the dependent files of the document object.

The dependent files list is the list of files that are pushed to the server if they are modified for Preview In Browser, Live View, or when getting the document from the server or version control.

Arguments

None.

Returns

An array of DWUri objects representing the dependent file list.

DWFilenameFilter reference

The objects of type DWFilenameFilter are new to Dreamweaver CS5 and are used to restrict the files displayed in the Related Files bar. To manipulate the related Files bar filter, extension developers can create a new DWFilenameFilter object and change the behavior of the filter using the functions described in the following sections.

For example,

var filter = new DWFilenameFilter;
filter.setExpression(‘*.js’);
dw.setRelatedFilesFilter(filter);

Extension developers can also manipulate the current filter applied to the Related Files bar by invoking the dreamweaver.getRelatedFilesFilter() function (see dreamweaver.getRelatedFilesFilter() )and then changing the behavior of the filter using the other functions.

For instance,

var filter = dw.getRelatedFilesFilter();
filter.addExtensionToExclusionExpression(‘.js’);
dw.setRelatedFilesFilter(filter);

DWFilenameFilter.isValidFilterExpression()

Availability

Dreamweaver CS5.

Description

This function is used to determine if an expression is a valid filter expression.

Arguments

expression - A string that represents a filter expression.

Returns

A Boolean: true if the expression is valid.

DWFilenameFilter.isEmpty()

Availability

Dreamweaver CS5.

Description

This function is used to determine if a filter object is empty.

Arguments

None.

Returns

A Boolean: true if the filter object is empty.

DWFilenameFilter.doesExcludeExtension()

Availability

Dreamweaver CS5.

Description

This function is used to determine if an extension is excluded by the filter object.

Filters use an exclusive test to determine if a file extension is excluded using the exclusion expression. Use this function to determine if a file extension has been previously added to the exclusion list using the DWFilenameFilter.addExtensionToExclusionExpression() function. For more information, see DWFilenameFilter.addExtensionToExclusionExpression().

Arguments

extension - A string that represents a extension.

Returns

A Boolean: true if the extension is excluded by the filter.

DWFilenameFilter.isAdvancedFilter()

Availability

Dreamweaver CS5.

Description

This function is used to determine if the filter object is an advanced filter.

Advanced filter results when the user selects “Advanced...” menu item from the Filter menu.

Arguments

None.

Returns

A Boolean: true if the filter is an advanced filter.

DWFilenameFilter.willMatchAnyFile()

Availability

Dreamweaver CS5.

Description

This function is used to determine if the filter object will match any file. A filter that matches any file results in all files being displayed in the Related Files Bar.

To match any file, the filter object should be empty or should have an advanced filter with “*.*” as the expression.

Arguments

None.

Returns

A Boolean: true if the filter matches any file.

DWFilenameFilter.getExpression()

Availability

Dreamweaver CS5.

Description

This function is used to retrieve the filter expression.

Arguments

None.

Returns

A string that represents the filter expression.

An empty string is returned if the filter that matches any file is empty.

DWFilenameFilter.setExpression()

Availability

Dreamweaver CS5.

Description

This function is used to set the filter expression.

Arguments

expression - A string that represents a filter expression.

This argument is one or more wildcard filters separated by semicolons. For example, “*.css;help*.js”.

Setting the filter object to an empty string will set the filter so that the filter matches any file.

Returns

None.

DWFilenameFilter.getExcludedExtensions()

Availability

Dreamweaver CS5.

Description

This function is used to retrieve the list of all the excluded file extensions.

Arguments

None.

Returns

An array of string objects representing the extensions that are to be excluded by the filter. See also the DWFilenameFilter.addExtensionToExclusionExpression() function.

For example, {“.php”, “.css”, “.engine”}

DWFilenameFilter.getExclusionExpression()

Availability

Dreamweaver CS5.

Description

This function is used to retrieve the exclusion expression.

Arguments

None.

Returns

A string containing semicolon separated values that represents the list of extensions that are excluded.

For example, “.php;.css;.engine”

DWFilenameFilter.getAdvancedExpression()

Availability

Dreamweaver CS5.

Description

This function is used to retrieve the advanced expression.

The filter can either be an advanced filter containing other wildcard inclusion filters or can be a simple filter containing a list of file extensions to exclude.

Arguments

None.

Returns

A string containing semicolon separated values that represents the list of filters in the advanced expression.

For example, “*.css;help*.js”

DWFilenameFilter.addExtensionToExclusionExpression()

Availability

Dreamweaver CS5.

Description

This function is used to add an extension to the filter object’s exclusion list.

Arguments

extension - A string or a DWUri object.

This argument represents the file name or the extension that needs to be added to the filter.

The argument can be an extension or a fully qualified local filename or remote URL as a string or a valid DWUri object.

Returns

A string containing semicolon separated values that represents the list of filters in the advanced expression.

For example, “*.css;help*.js”

DWFilenameFilter.removeExtensionFromExclusionExpression()

Availability

Dreamweaver CS5.

Description

This function is used to remove an extension from the filter object’s exclusion list.

Arguments

extension - A string or a DWUri object.

This argument represents the file name or the extension that needs to be removed from the filter.

The argument can be an extension or a fully qualified local filename or remote URL as a string or a valid DWUri object.

Returns

None.

DWFilenameFilter.empty()

Availability

Dreamweaver CS5.

Description

This function is used to clear the filter.

An empty filter will match all the files.

Arguments

None.

Returns

None.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy