Some Perspective Management Techniques

来源:互联网 发布:java数据挖掘 编辑:程序博客网 时间:2024/05/16 05:41

Perspectives in Eclipse are a very powerful tool. I spent a lot of time today at my day job walking around and working in pairs with other developers. Inevitably, I've learned that there are three buckets people can be put in when it comes to perspectives in Eclipse.

  1. Those who don't understand perspectives in Eclipse, but let Eclipse push them around.
  2. Those who configure their Eclipse to prevent perspective switching altogether (by making their Java perspective the 'uber' perspective).
  3. Those who get Eclipse perspectives, and use them proactively.

The first two categories are in a much greater abundance. For that reason, even though it's a relatively simple perspective management in Eclipse is something a lot of users just haven't swallowed - and I think a lot of it comes with the fact they don't know how to flip around their perspectives easily.

The central part of perspective switching for most users is the 'Perspective Bar' - or as I've heard it called, "that obnoxious swoosh toolbar thing". Here is what the perspective bar in Eclipse 3.0 and beyond commonly looks like:

This isn't particularly useful if you ask me; most users don't realize however that you can change the size so that it is a little more useful:

That may not be good enough for some (frankly, it's not for me) - so, instead you can right-click on it and move the perspective bar to the top left.

One of the nice things about perspectives is that they have these fancy unique icons; so, maybe you don't need the text. You can turn it off:

Lastly, you can also put it on the left (ala Eclipse 2.1) as you can see here:

These various settings can all be controlled by the Eclipse preferences as well (at Preferences->General[+]->Appearance ):

I personally like to use keystrokes whenever possible however (and avoid the mouse *whenever* I can) - because of that I use the keystroke Ctrl+F8 (Default mapping for 'Next Perspective') and the keystroke Ctrl+Shift+F8 (Default mapping for 'Previous Perspective'). This will open an 'in-place' dialog that puts you on eithe the 'previous' or 'next' perspective. The concept of previous or next is defined in such a way that you often can just go to the 'next' - Eclipse by default will swap the perspectives so that the 'next' perspective it highlights by default will happen to be the perspective you left the *last* time you switched perspectives. This sounds nice and complicated, so take a look at these next two pictures:

Notice how the SVN Repository Explorer perspective and the Java perspective have simply switched places.

Eclipse will try to automate the manuvering to various perspectives for you, and if you've committed yourself to the perspective idea this is usually ok. That being said, everyone has a different idea of how to organize their workspace, and that's really the beauty of the Eclipse workspace (it does make writing tips difficult though!)

There are a few places you can go to manage this. First, the General[+]->Perspectives preference node defines the general behavior of perspective management that Eclipse will perform. Here are some of the options:

In addition, various behaviors (such as synchronizing and debugging) will have the side-effect of Eclipse wanting to take you to another perspective. For synchronization go to the Team node where you will see these options:

For debugging, go to the Run/Debug node where you will see these options:

Just a reminder too that I discussed previously (in an old Javalobby article) how to create a custom perspective in Eclipse in case you have a better idea about organizing views for your use:

Eclipse: Create Your Own Perspective .

Until next time,

R.J. Lorimer
Contributing Editor - rj -at- javalobby.org
Author - http://www.coffee-bytes.com
Software Consultant - http://www.crosslogic.com

原创粉丝点击