### Worksets

Worksets allow you to organize files you are working on into groups for easy access. Worksets also allow you to generate makefiles, use source control commands, etc. Furthermore, worksets define a search path for commands like Open Selection (Alt-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 can write your own).

#### Creating a workset

To create a new workset, choose the New Workset menu item in the File Menu.

You may then drag&drop files into the new window from the Tracker.

When you drag the file CDEngine.cpp into the Workset window, an New Group is automatically created and the file is added to it.

You may alternatively drag an entire folder into the workset window:

##### Add as group dialog

After you drag an entire folder to the worksets window, you are presented with a dialog in which 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. By default the group will be named identically to the name of the folder you dragged into the window.

In our example we choose to only add .cpp files to the first group and we leave the group named CDButton. All of the .cpp files from the folder get added.

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.

Next we will add the .rsrc file, into a separate group. We can create a new empty group by using the New group menu item in the Workset window File menu:

Rename the new group Resources and drag the CDButton.rsrc file into it. We can then add yet another group, this time we call it Misc and add some header files that are not really part of the application we are trying to build, but we use them often and it will be convenient to have them as a reference. Also, we can add the makefile for the application if we already have one.

##### Edit group name dialog

The Edit group name dialog in the above example can be opened by selecting the group and using the Alt-E shortcut or by selecting it from the group context menu. Note that 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.

Also, you may choose the directory the group belongs to. If you add the group by dragging a folder into the workset window, the folder automatically becomes the group's directory. If you create a new group using the New group menu item, the group has no directory associated with it. If a group has a directory associated, you may double click the group item and the directory will open in the Tracker. 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.

Also, note that the Dragger.h and View.h files have a lock icon - they are read-only. You may use the context menu to make them writable or to check them out if you are using a source control system. If your source control system locks files that you do not have checked out, the lock icon is a conveninet way of finding out which files are checked out at a glance.

#### Info panel

If you click on a file or a group with the middle mouse button or if you hold down the Control key while clicking, you get an info panel:

#### File context menu

If you click on a file or a group with the right mouse button or if you hold down the Alt key while clicking, you get the context menu:

Open (also hitting Return or double-clicking a file) will open the selected files in a document window. If the files are not text files, they get opened by their preferred application (resource files in FileTypes, etc.). Remove (also Alt-T and Backspace) will remove them 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, turn the writable bit on and off by using chmod and touching 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' 'cho $SELECTED_DOCUMENTS' -worksheet -appendToEnd
    AddToWorksetsFileContextMenu -name 'Cancel check out' 'chcan $SELECTED_DOCUMENTS' -worksheet -appendToEnd
    AddToWorksetsFileContextMenu -name 'Make read only' 'chmod -w $SELECTED_DOCUMENTS'
    AddToWorksetsContextMenu -name 'Paste path' '$SELECTED_DOCUMENTS' -worksheet -pasteOnly

The AddToWorksetsFileContextMenu, AddToWorksetsGroupContextMenu and AddToWorksetsContextMenu commands work much like the commands in the Execute command dialog. The syntax is similar:

    AddToWorksetsFileContextMenu [-name <commandName>] '<someCommand>' [-worksheet] [-appendToEnd] [-pasteOnly]

AddToWorksetsFileContextMenu adds items only to the file context menu, AddToWorksetsGropuContextMenu adds items only to the group context menu, AddToWorksetsContextMenu adds items both to the group and the file context menu. `-worksheet` is used to specify that the command gets executed in the worksheet rather than in the background. `-appendToEnd` is used in conjunction with the `-worksheet` command and ensures that the command gets pasted to the end of the worksheet, rather than into the current selection. `-pasteOnly` causes the command to not get executed - the user has to hit return to get it executed.

The following variables are currently supported by the execute dialog syntax:

$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

#### Group context menu

Group context menu works like the file context menu - you may open it by selecting a group and right-clicking or Alt-clicking on the item. If a group has a directory associated with it, Open (also hitting Return) will open the corresponding folder in the Tracker. Edit name (Alt-E) will bring up the Edit group name dialog.

Generating makefiles from a workset

##### Editing a workset as text

A 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 dragging a workset file onto an open Eddie window and holding down the Alt and Win keys.

#### Workset window keyboard shortcuts

Alt-T, Backspace | Remove item from workset
Tab | Select next item using alphabetical order
Shift-Tab | Select previous item using alphabetical order
Alt-E | Group item only - show the edit group dialog
type several letters | Select the item, starting with the letters typed