开发者

how to show up the perspective button without click?

I have two perspectives , but to see the second perspective , as you开发者_StackOverflow know have to click button 'open perspective'. Is there way that the second perspective button shown up automatically , when application start up?


This is an old topic, but I thought I would offer a more concrete answer since the accepted one is not the most direct in getting to a solution.

In your ApplicationWorkbenchWindowAdvisor.preWindowOpen() method use the below code to add perspectives to the perspective switcher.

// Get a reference to the preferences store
IPreferenceStore prefStore = PlatformUI.getPreferenceStore();

// Set the value for the perspective bar preference.  Insert your own
// perspective id values.
prefStore.setValue(IWorkbenchPreferenceConstants.PERSPECTIVE_BAR_EXTRAS, "project.perspective.id.1, project.perspective.id.2,...");

There are a number of preference values that you can set through IWorkbenchPreferenceConstants (see api).


It sounds like you want the default size of the perspective switcher (the bar containing the perspective buttons) to be larger than usual. To do that, you could perhaps use an instance of the ActionBarAdvisor class; you'll probably also need a WorkbenchWindowAdvisor class.

I don't see any methods to directly access the switcher object, so I think you'll have to look at the component tree to find it.

Seems like there ought to be an easier way, but I don't see one.


The perspectives show up on a tab. Although it's not clear just from looking at it, the end of the tab can be dragged so it's longer and can display more perspective buttons.


Right click mouse on the perspective toolbar, then select dock it on left or top left. You would see more toolbar items of other perspective, and show more on the toolbar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜