Project Switcher

The Project Switcher is a small but nifty enhancement to the code editor that makes it easier to work with files that are shared between multiple projects within the same solution.

Different projects might have different Conditional Defines or References, or might even be targeting different Platforms, so when you are writing code, it is important that the source file is seen in the context of the right project, so that the editor can highlight and gray out the right sections of \$IF'ed code, and show the proper elements in Code Completion.

Project Switcher helps with this in two ways:

Project Indicator

Project Switcher can show an indicator in the top right corner of the editor, letting you know which project the current source file is in.

The project indicator shows you two pieces of information:

  • The name of the project the current file is in (RemObjects.Sugar.Cooper, in the example above).

  • The platform the project uses, using the background color (Blue is for .NET, Green for Cocoa and Yellow for Java. This also matches the color of the icons in your Solution).

Project Switcher

For files that actually are part of multiple open projects, there is also a little disclosure triangle shown next to the name. Clicking that, you will get a list of all the projects this file is part of. If you select a different one, not only does the Project Switcher change its display, but all conditional defines and other code editor smarts for this file change to match the new project:

This allows you to seamlessly switch the "context" in which you are working. You might write a few lines of code for the .NET version of your project, then switch over, and write a few lines for the Java version. But this is similarly useful if you have several projects for the same platform that share source code.

Options

By default, the Project Switcher UI only shows for files shared between two or more projects or in a shared project, but if you like, you can also enable to show the Project Indicator (minus the switcher triangle) for any file in a multi-project solution, or even when only a single project is open.

You can configure Project Switcher in the "Tools|Options" Dialog under "Text Editor|Oxygene|Miscellaneous":