Thursday, November 4, 2010
Perspective Switcher Plugin for Eclipse / Flash Builder
Update: current version is 0.1.1 - read below
In my projects, I tend to work with more than one language inside Eclipse. Sometimes it's up to four but typically at least two (e.g. Java and Flex). One thing that always annoyed me inside Eclipse is, that it does not automatically switches perspectives based on the current language (or IDE plugin). So I always end up in the wrong perspective, seeking for a certain view or getting nuts because some key bindings overlap and do something different in one perspective than in another one. Know the pain? Here's the meds :)
I'm happy to introduce Perspective Switcher, a simple plugin for Eclipse (3.4 and above) which automatically switches perspectives for you based on the rules you define. It is not specific to Flash Builder at all and should work fine with *any* perspectives inside Eclipse.
Also, as of version 0.1.1, the Plugin will now automatically switch back from a Debug perspective to the previous non-Debug perspective as soon as the Debug session is terminated (yeah!). This feature is enabled by default but can be explicitly switched on and off in the Preferences page (but you don't really want to switch it off I promise) - again, this feature should work with *any* Debuggers inside an Eclipse distro as long they are built around Eclipse's DebugPlugin API.
Essentially, in the preferences page the plugin lists all active perspectives in your distribution and allows to specify which file extensions should be associated to them:
There's no validation on the extensions and you can also assign one extension to more than one perspective but the plugin will only pick the first perspective it finds.
Also, when testing I found that changing perspectives when in a Debug perspective is probably not a good idea, so all Debug perspectives are not shown in the list.
The plugin only switches perspectives when an Editor (e.g. JDT's Java Editor or Flash Builders MXML Editor) gets activated, either by opening a file or by switching from one open editor to another (by whatever means).
To install, simply unzip the ZIP file and copy the JAR into your distributions /plugins /dropins folder. Then restart Eclipse / FB with the -clean switch. You should then see the "Perspective Switcher" entry on the Preferences dialog.
Current version is 0.1.1 - Download the ZIP file here.
Enjoy!
Dirk.
Comments
Really nice and helpful plugin! this is going to save me lots of clicks at the end of the day!
Posted By Xavi Beumala / Posted At 11/11/10 9:33 AM
Hi Xavi,
glad you like it :)
Dirk.
Posted By Dirk / Posted At 11/16/10 8:49 AM
Hi, I tried this out but it's still not switching back to the Java perspective after debugging has terminated. Any ideas? I'm running Eclipse 3.6 if that matters.
Posted By Sean / Posted At 4/27/11 11:10 PM
Hi. Does the plugin preferences page show up when you go to the Eclipse / FB Preferences?
Posted By Dirk / Posted At 4/28/11 8:20 AM
Could you open source the plug-in? Maybe creating a Google Code, Sourceforge, yourfavoriteprojecthostinghere? Thanks
Posted By juchem / Posted At 8/7/11 5:29 AM
Posted By Chris / Posted At 9/22/11 4:25 PM
This is EXACTLY what I was looking for! Many thanks.
Posted By Martin / Posted At 12/8/11 10:49 AM
The download link doesn't work. And I'd reeeeallly like this plugin :)
Posted By Brian Meidell / Posted At 4/20/12 1:34 PM
Thanks for creating and sharing this plugin. It works as advertised for me, and is just what I was looking for. Kudos!
Posted By James Adams / Posted At 9/27/12 5:18 PM
I was really surprised to see that, for a complicated IDE with separate perspectives for Java/C++, it is not smart enough to tell what .java and .cpp means! Working on a Java + C++ project, I constantly had to switch back and forth just to get the "Build" button back for C++. Thanks to you I no longer have to, it's working flawlessly. Thank you very much!!! :)
PS: Perhaps it should have ".c .cpp .h" set as default for the C/C++ perspective?
Posted By dm / Posted At 10/6/12 8:17 AM