Worksets allow you to organize files you are working on into groups for easy access.
Worksets also allow you to generate makefiles (if you are so inclined),
use source control commands, etc.
Furthermore, worksets define a search path for commands like
Open Selection (Command-D),
multi-file search, etc.
Worksets are implemented as a plugin, using the public plugin API (in other words, if
you don't like the way they work, you could actually write your own version).
Alternately you may add files through the Open panel brought up by clicking the plus button.
When you drag the file "main.g" into the empty Workset window, a New Group is automatically created and the file is added it.
Instead of dragging individual files to the Workset, you may drag an entire folder into the Workset window:
After you drag the folder "testproj" to the Workset window, you may name the new group that gets created and you may choose which types of files in the dropped folders to add to the new group in the workset.
We will start by adding just the .cpp files:
Besides allowing you to automatically add files to a group, dragging a folder into the workset window associates the pathname of the folder with the group. This is useful for opening the folder of the group later — double clicking the group in the Workset window will open the corresponding folder in the Finder.
Next we will add the .nib files, into a separate group. We can create a new empty group by using the New group menu item in the Workset menu:
Control-Click on the new group name to bring up the "Edit group..." dialog and change the group to "Resources"
Drag the .nib files into the new group.
We can then add yet another group, this time we call it "Misc" and add some header files and the makefile for the application if we already have one.
Note that in the "Edit group..." dialog you may choose whether a given group gets included in a makefile. Since none of the files in the "Misc" group are source files used to build our example binary, we select not to include them here. The previously created groups "testproj" and "Resources" contain source files and the "Include in make" checkbox would be checked for these.
Also, you may choose the directory the group belongs to. We already dragged a folder into the workset which automatically makes the folder the group's directory, at the same time as the files get added. If you create a new group using the New group menu item, the group has no directory associated with it, the "Edit group..." dialog let's you assign one after the fact. Also, you may update the contents of a group by hitting the Update button - you will get the Add group dialog and will be able to select which types of files you want to add - .c/.cpp files, headers, makefiles, etc. This way you may easily add files to a group that were added to a folder after you created the group.
If you Option-click on a file or a group with the you get an info popup displaying the full file path:
If you click on a file or a group with the right mouse button or if you hold down the Command key while clicking, you get the context menu:
Open (or double-click) will open the selected files in a
document window. If the files are not text files, they get opened by their preferred
application (.nibs in Xcode, etc.). Remove will remove selected files from the Workset.
The rest of the commands in the context menu are completely configurable. Included are
commands that allow you to check the selected files in and out using a source control
system, lock/unlock files and touch the files to force a recompile.
To edit the items or add new ones, open your UserStartup
file and edit the lines that
contain AddToWorksetsFileContextMenu, AddToWorksetsGroupContextMenu and AddToWorksetsContextMenu:
AddToWorksetsFileContextMenu -name 'Check out (p4 edit)' 'p4 edit $SELECTED_DOCUMENTS -worksheet -appendToEnd
AddToWorksetsFileContextMenu -name 'Cancel check out (p4 revert)' 'p4 revert $SELECTED_DOCUMENTS' -worksheet -appendToEnd
...
AddToWorksetsFileContextMenu -name 'Lock' '/Developer/Tools/SetFile -a L $SELECTED_DOCUMENTS'
AddToWorksetsFileContextMenu -name 'Unlock' '/Developer/Tools/SetFile -a l $SELECTED_DOCUMENTS'
The syntax of the AddToWorksetsFileContextMenu, AddToWorksetsGroupContextMenu and AddToWorksetsContextMenu commands is:
AddToWorksetsFileContextMenu [-name <Menu item label>] '<someCommand>' [-worksheet] [-appendToEnd] [-pasteOnly]
AddToWorksetsFileContextMenu adds items only to the file context menu,
AddToWorksetsGroupContextMenu adds items only to the group context menu,
AddToWorksetsContextMenu adds items both to the group and the file context menu.The following built-in variables are available in the AddToWorksets... menu commands:
$SELECTED_DOCUMENTS | get the paths to all the selected documents/groups |
$WORKSHEET $WORKSHEET_DIR | get the worksheet path and the worksheet parent path |
$EDDIE $EDDIE_HOME | get the Eddie app path and the Eddie app parent path |
Control-clicking on a group brings up the Group context menu works much like the file context menu.
If a group has a directory associated with it, "Open" will open the corresponding folder in Finder. "Edit group..." will bring up the Edit group name dialog. The AddToWorksetsGroupContextMenu allows defining custom menu commands, specific to groups.
Generating makefiles from a worksetA workset is stored internally as a text file. While you should be able to do any alterations to the workset by using the workset UI, you may edit the workset as text. You may force Eddie to open a workset as a text file by holding down the the Command and Option keys while dragging a workset file onto Eddie (window, icon, etc.).