문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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).

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top