ProjectModel
Import :
const ProjectModel = brackets.getModule("project/ProjectModel")
The ProjectModel provides methods for accessing information about the current open project.
It also manages the view model to display a FileTreeView of the project.
Events:
- EVENT_CHANGE (
change
) - Fired when theres a change that should refresh the UI - EVENT_SHOULD_SELECT (
select
) - Fired when a selection has been made in the file tree and the file tree should be selected - EVENT_SHOULD_FOCUS (
focus
) - ERROR_CREATION (
creationError
) - Triggered when theres a problem creating a file Kind: global class
InMemoryFile
Provides the data source for a project and manages the view model for the FileTreeView.
Kind: global variable
EVENT_CHANGE : string
Triggered when change occurs.
Kind: global constant
EVENT_SHOULD_SELECT : string
Triggered when item should be selected.
Kind: global constant
EVENT_SHOULD_FOCUS : string
Triggered when item should receive focus.
Kind: global constant
EVENT_FS_RENAME_STARTED : string
Triggered when file system rename operation starts.
Kind: global constant
EVENT_FS_RENAME_END : string
Triggered when file system rename operation ends.
Kind: global constant
ERROR_CREATION : string
Error during creation.
Kind: global constant
ERROR_INVALID_FILENAME : string
Error because of Invalid filename
Kind: global constant
ERROR_NOT_IN_PROJECT : string
Error when an item is not in a project
Kind: global constant
defaultIgnoreGlobs
Glob definition of files and folders that should be excluded directly inside node domain watching with chokidar
Kind: global constant
FILE_RENAMING : number
File renaming
Kind: global constant
FILE_CREATING : number
File creating
Kind: global constant
RENAME_CANCELLED : number
Rename cancelled
Kind: global constant
isValidFilename(filename) ⇒ boolean
Returns true if this matches valid filename specifications. See http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
TODO: This likely belongs in FileUtils.
Kind: global function
Returns: boolean
- true if the filename is valid
Param | Type | Description |
---|---|---|
filename | string | to check |
isValidPath(path) ⇒ boolean
Returns true if given path is valid.
Kind: global function
Returns: boolean
- true if the filename is valid
Param | Type | Description |
---|---|---|
path | string | to check |
shouldShow(entry) ⇒ boolean
Returns false for files and directories that are not commonly useful to display.
Kind: global function
Returns: boolean
- true if the file should be displayed
Param | Type | Description |
---|---|---|
entry | FileSystemEntry | File or directory to filter |
shouldIndex(entry) ⇒ boolean
Returns false for files and directories that should not be indexed for search or code hints. If the entry is a directory, its children should be indexed too.
Kind: global function
Returns: boolean
- true if the file should be displayed
Param | Type | Description |
---|---|---|
entry | FileSystemEntry | File or directory to filter |
doCreate(path, isFolder) ⇒ $.Promise
Creates a new file or folder at the given path. The returned promise is rejected if the filename is invalid, the new path already exists or some other filesystem error comes up.
Kind: global function
Returns: $.Promise
- resolved when the file or directory has been created.
Param | Type | Description |
---|---|---|
path | string | path to create |
isFolder | boolean | true if the new entry is a folder |