How to get or create the PerspectiveSwitcher Bar? [message #115615] |
Sat, 13 December 2008 10:36  |
Eclipse User |
|
|
|
hi, I saw the sample of DemoPresentationWorkbenchWindowAdvisor and found
the method as below:
private void createPerspectiveSwitcher(final Composite banner) {
IAction[] actions = new IAction[] { new Action("Perspective 1") {
public void run() {
switchPerspective(0);
}
}, new Action("Perspective 2") {
public void run() {
switchPerspective(1);
}
} };
ActionBarButton actionBar = new ActionBarButton(banner, SWT.NONE,
actions);
actionBar.pack();
FormData fdActionBar = new FormData();
actionBar.setLayoutData(fdActionBar);
fdActionBar.top = new FormAttachment(0, 44);
fdActionBar.left = new FormAttachment(100, -actionBar.getSize().x);
}
But I hope to know how to create the PerspectiveSwitcher Bar showed as on
the top-right corner of Eclipse? I saw the code that create system cool
bar as below:
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
Composite coolBar = (Composite) configurer.createCoolBarControl(banner);
|
|
|
Re: How to get or create the PerspectiveSwitcher Bar? [message #115864 is a reply to message #115615] |
Tue, 16 December 2008 04:08  |
Eclipse User |
|
|
|
Did you have a look at class PerspectiveSwitcher and its usage in
WorkbenchWindow#addPerspectiveBar() and createDefaultContents()?
HTH
Rüdiger
CAO Dahai wrote:
> hi, I saw the sample of DemoPresentationWorkbenchWindowAdvisor and found
> the method as below: private void createPerspectiveSwitcher(final
> Composite banner) {
> IAction[] actions = new IAction[] { new Action("Perspective 1") {
> public void run() {
> switchPerspective(0);
> }
>
> }, new Action("Perspective 2") {
> public void run() {
> switchPerspective(1);
> }
> } };
>
> ActionBarButton actionBar = new ActionBarButton(banner, SWT.NONE,
> actions);
> actionBar.pack();
>
> FormData fdActionBar = new FormData();
> actionBar.setLayoutData(fdActionBar);
> fdActionBar.top = new FormAttachment(0, 44);
> fdActionBar.left = new FormAttachment(100, -actionBar.getSize().x);
> }
>
> But I hope to know how to create the PerspectiveSwitcher Bar showed as
> on the top-right corner of Eclipse? I saw the code that create system
> cool bar as below:
> IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
> Composite coolBar = (Composite) configurer.createCoolBarControl(banner);
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03361 seconds