While we’re putting the finishing touches on the May release for Oxygene, due some time next week, i wanted to share a first peek at what’s in the works for the release after that:

The Project Switcher

If you have ever worked on a solution where one source file was shared between multiple projects, you probably have seen Visual Studio pop up this little dialog:

![](http://blogs.remobjects.com/wp-content/uploads/2012/05/This-document-is-opened-by-another-project.png)
What happens essentially is that you have your file, say Foo.pas, already open from “Project B”, and now you double-clicked Foo.pas in “Project A” or clicked an error message from that project. And up comes this dialog. If you dismiss it, the file shows just fine, but it shows in the context of the *wrong* project, so your conditional defines, if any, are off; CC might not show you the items you are looking for, etc.

Annoying, right?

Well, say good-bye to this dialog once and for all, because we thought so too, and for the June release, it’s going to go away: we are introducing the Project Switcher (a.k.a. the Project Indicator).

In the following screenshot, you see a side project i’m working on right now. There are different projects in the solution that contain (more or less) the exact same code files. One is for Echoes (a.k.a. Oxygene for .NET) and one is for Cooper (a.k.a. Oxygene for Java). There are conditional defines all over the source files.

![](http://blogs.remobjects.com/wp-content/uploads/2012/05/Editor-With-Switcher.png)
But take a closer look a the top right corner of the Editor. What’s that? That’s the Project Switcher, and it shows you two pieces of information:

For one it shows you the name of the project the current file is in (“RemObjects.Sugar.Cooper”, in this case). For another, it indicates the platform for the project, using the background color (yellow if for Cooper/Java; Blue is for Echoes/.NET).

So far so good,but note there’s also a little disclosure triangle next to the name. Click that, and you get a list of all the projects this file is part of. Select a different one, and not only does the Project Switcher change its display, all conditional defines and other IDE smarts for this file change to match the new project:

![](http://blogs.remobjects.com/wp-content/uploads/2012/05/Switcher.png)
This allows you to seamlessly switch the “context” in which you are working. In this case, i might write a few lines of code for the .NET version of the 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.

By default, this new UI only shows for files shared between two or more projects, 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.

That’s Not All Folks

But that’s not all. Remember the annoying dialog we talked about at the beginning of the post, and how i said it was gone? It is. If you double-click a file in Solution Explorer, instead of popping up the dialog, we just open the file and switch it over to the right project.

The same goes for clicking on messages in the error list. Not only will you see the file in the context of the right project immediately — the IDE will also narrow down any inline errors it displays, so you can focus on the errors from the right project. So whenif your code fails to compile and you get errors from both projects, it’s now even easier to keep them apart.

What’s Sugar?

“Never mind all that”, you ask, “what’s Sugar”? Ah well. Sugar is a small library that we have been working on as a side project, and it aims at making it really easy to share low-level business logic code between Oxygene projects on different platforms. I don’t really want to go into more detail just yet, but suffice to say it will have a rather unique and cool approach at the problem. It will be open source, and part of a future Oxygene release.

Summary

So there you have it: the Project Switcher/Project Indicator — one of many features where Oxygene takes the general Visual Studio code editing experience to the next level. You should find a preview of this in the next beta drop and, as indicated above, this feature is planned to ship in the June 2012 update.

Let me know what you think!

marc