Creating a Virtual File Manager
From Aptana Development
Below is a short list of the classes and extension points that need to be implemented to add a custom virtual file manager to Aptana Studio's File Explorer View.
Contents |
Classes
ProtocolManager
- At the top of the object tree, you will need to create a subclass of ProtocolManager. Typically, the protocol starts the class name followed by ProtocolManager. For example, the FTP protocol manager is called FtpProtocolManager. ProtocolManager takes care of most of the housekeeping, but you need to override methods for things that are specific to your protocol.
- createFileManager - This is used to create instances of file managers for your protocol. Each file manager corresponds to each child node under the protocol in the file explorer view. Note that one override includes a boolean which can be used to prevent auto-adding the file manager to the file explorer view.
- getImage - Returns the 16x16 icon you wish to use to represent this protocol in the file explorer view
- getStaticInstance - This is used to get the singleton protocol manager for this protocol. Note that most protocol managers include a static getInstance() method that this override calls.
IVirtualFileManager (VirtualManagerBase)
- Next, you need to implement an instance of IVirtualFileManager. Much of the housekeeping needed for this interface is defined in VirtualManagerBase, so you may want to use that as your starting point.
- nickName - The name used when displaying this protocol manager in the file explorer
- id - A unique ID for this file manager
- hidden - A flag indicating whether this file manager should appear in the file explorer or not
- transient - By default file managers are serialized to disk so they will reappear on startup. However, some file managers need to be created dynamically (for example the Desktop file manager). This flag allows you to prevent your file manager from being serialized at shutdown
- cloakedFiles - A list of files that should be excluded when syncing
- cloakedFileExpressions - A list of patterns of files and directories to exclude when performing a sync.
- Note that the file managers in Aptana perform most (if not all) of the interaction with the file system it represents. Specifically, you will see a number of methods in IVirtualFileManager and IVirtualFile that look similar. Our pattern has IVirtualFile delegate to IVirtualFileManager to perform most operations. Simple state (name, path, permissions, etc.) can be handle by the IVirtualFile, but actual interactions with the remote system should be performed by the IVirtualFileManager.
IVirtualFile (VirtualFile)
- Next, you need to implement and instance of IVirtualFile. Much of the basic work needed is implemented in VirtualFile. As mentioned above, you'll want to delegate interactions with the remote file system through the IVirtualFile's owning IVirtualFileManager.
IVirtualFileManagerDialog (VirtualFileManagerLocationDialog)
- You can create a subclass of VirtualFileManagerLocationDialog to allow the user to specify all required (and optional) settings needed to configure a connection for your protocol. An instance of this class needs to be returned from createPropertyDialog in your protocol manager class.
Extension Point
You will need to define an instance of the com.aptana.ide.core.protocols extension. Below is a brief summary of each protocol element defined in that extension point.
- name - The name of this protocol manager
- id - A unique id used to identify this protocol manager
- class - The protocol manager class that knows how to create protocol managers for this protocol. This should be a subclass of com.aptana.ide.core.io.ProtocolManager.
- displayName - This is the name of the entry that will appear for this protocol in the File Explorer View
- fileManangerName - This is the default name of a new virtual file manager for this protocol. You will see this in the "Add New ... " menu item when you right-click the protocol manager in the file explorer view. This will also be used as the default name when creating a new virtual file manager.
- hidden - This is a boolean flag that can be used to prevent this protocol from appearing in the file explorer view.
- remote - This flag indicates if the protocol is used to access remote or local hosts
- priority - This value allows one protocol manager to override another manager for the same protocol. Higher values win over lower values.


