Using the Organizer

The Xcode Organizer allows you to access frequently used directories (containing projects or other resources) from a single window, which reduces the amount of Finder-based navigation you need to perform to get to those files. The Organizer also streamlines your development workflow by letting you assign tasks to the directories it displays. To build a product, you don’t have to open the corresponding project in an Xcode project window. And you can manage directories containing Xcode projects as well as directories with projects that use other build systems in the Organizer.

You use the Organizer by adding Organizer items to it. An Organizer item represents a directory in your file system (you can think of these items as symbolic links or folder references). You can perform many of the functions the Finder provides, such as moving or deleting files and directories. However, the real power of the Organizer comes from its support of Organizer actions. An Organizer action is a predefined or custom task that Xcode performs on a directory. See Using Organizer Actions for details.

To open the Organizer, shown in Figure 7-1, choose Window > Organizer.

Figure 7-1  The Organizer
The Organizer

The Organizer can work with projects that use any build system that can be operated through shell scripts, including Xcode projects, and Make-based and Ant-based projects.

To add an item to the Organizer, perform any of these actions:

To remove an item from the Organizer:

  1. Select the item in the Organizer.

  2. Choose Remove From Organizer from the Action menu.

To change the directory to which an Organizer item points:

  1. Select the item in the Organizer.

  2. Choose Assign New Location from the Action menu.

To create a snapshot of an Organizer item:

  1. Select the item in the Organizer.

  2. Choose Make Snapshot from the Action menu.

Using Organizer Actions

In addition to providing a single place from which to access projects and other resources that you use often, the Organizer allows you to assign actions to the directories it displays. For example, to build a product needed by your project, you can create an Organizer item that points to its project directory. When you need a fresh copy of the product, you can build it from the Organizer. This allows you to get what you want, the product, with minimal distractions. That is, for Xcode projects, you don’t have to open the project in a project window and build it; and, for other types of project, you don’t have to use legacy targets in Xcode, or issue commands in a Terminal window to execute build scripts.

The Organizer supports four types of actions: build, clean, run, and general. These actions are accessible through four Organizer-action toolbar items with pop-up menus: Build, Clean, Run, and Action.

To perform an Organizer action, you select the object on which you want to perform the action (the action object) and choose the action from one of the Organizer-action pop-up menus. Although the Organizer provides actions for directories that use build systems it recognizes, you may have to edit those actions or define custom actions to build a product correctly. Managing Organizer Actions explains how to implement custom actions.

Managing Organizer Actions

Organizer actions have two main attributes: a defining directory and a root directory specifier. The defining directory is the directory upon which the action is “attached.“ The root directory specifier represents the desired directory for the action.

To define an Organizer action:

  1. Select the directory in the Organizer to which you want to attach the action.

  2. Choose Edit Actions from the appropriate Organizer-action pop-up menu.

    The Organizer action editor (Figure 7-2) appears.

  3. Add and implement the action in the action editor.

    To implement actions, you can use shell scripts, AppleScript scripts, or Automator workflows.

Figure 7-2  The Organizer action editor
The Organizer action editor

The Directory pop-up menu in the action editor contains several options for designating the action’s root directory. Table 7-1 lists the available action directory choices and the corresponding action root directory when the action is invoked.

Table 7-1  Root-directory-specifier choices and resulting root directories

Root directory specifier

Root directory

Selection

The directory selected in the Organizer.

Top Level Organizer Item

The directory pointed to by the enclosing Organizer item.

Defining Organizer Item

The directory that defines the action.

Home Directory

The user’s home directory.

File System Root

The system root (/) directory.

Searching Organizer Items

The Organizer allows you to search individual Organizer items. Xcode displays the search results in a window similar to the Project Find window. You can perform textual searches and regular expression searches.

Editing Text Files in the Organizer

The Organizer lets you edit text files using the Xcode text editor. You can display or hide the editor pane by clicking the text editor toggle button in the bottom-left corner of the Organizer.