Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » workbench layout
workbench layout [message #45862] Mon, 10 September 2007 14:21 Go to next message
Tiago is currently offline TiagoFriend
Messages: 55
Registered: July 2009
Member
Hi,
I'm trying to customize the layout of a workbench to include an image and
other stuff. So far I managed to override the method
"createWindowContents(Shell)" from the WorkbenchWindowAdvisor class and had
success in changing the place of the toolbar and create a label with an
image. Now I'm trying to place the PerspectiveBar but without success it
always gives me the following exception:

java.lang.NullPointerException
at
org.eclipse.ui.internal.PerspectiveSwitcher.createControlFor Location(Unknown
Source)
at
org.eclipse.ui.internal.PerspectiveSwitcher.setPerspectiveBa rLocation(Unknown
Source)
at org.eclipse.ui.internal.PerspectiveSwitcher.createControl(Un known Source)

Here is part of my code:

@Override
public void createWindowContents(final Shell shell) {
final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
final WorkbenchWindow window = (WorkbenchWindow) configurer.getWindow();
final Workbench workbench = (Workbench) window.getWorkbench();
shell.setLayout(new GridLayout(2, false));
...
CBanner pbar = new CBanner(shell, SWT.NONE);
pbar.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2,
1));

PerspectiveSwitcher perspectiveSwitcher = new PerspectiveSwitcher(window,
pbar, SWT.FLAT | SWT.WRAP | SWT.RIGHT | SWT.HORIZONTAL);
perspectiveSwitcher.createControl(shell);
...
}

If anyone can help me out I would apreciate. Thanks

Tiago
Re: workbench layout [message #45983 is a reply to message #45862] Mon, 10 September 2007 17:43 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: b.muskalla.gmx.net

Hi Tiago,

first: Use internal stuff at your own risk. Neither Workbench,
WorkbenchWindow nor PerspectiveSwitcher are API (as in RCP).

The NPE is caused as you are calling methods without setting up the
enviroment correctly first. Please take a look at the workbench code
(WorkbenchWindowAdvisor etc) how this is done.

In RCP you will get the same exception with your code. Normally you
would set the according preference to modify location of the perspective
switcher which is (sorry) not yet possible with RAP.


Greets
Benny

Tiago wrote:
> Hi,
> I'm trying to customize the layout of a workbench to include an image and
> other stuff. So far I managed to override the method
> "createWindowContents(Shell)" from the WorkbenchWindowAdvisor class and had
> success in changing the place of the toolbar and create a label with an
> image. Now I'm trying to place the PerspectiveBar but without success it
> always gives me the following exception:
>
> java.lang.NullPointerException
> at
> org.eclipse.ui.internal.PerspectiveSwitcher.createControlFor Location(Unknown
> Source)
> at
> org.eclipse.ui.internal.PerspectiveSwitcher.setPerspectiveBa rLocation(Unknown
> Source)
> at org.eclipse.ui.internal.PerspectiveSwitcher.createControl(Un known Source)
>
> Here is part of my code:
>
> @Override
> public void createWindowContents(final Shell shell) {
> final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
> final WorkbenchWindow window = (WorkbenchWindow) configurer.getWindow();
> final Workbench workbench = (Workbench) window.getWorkbench();
> shell.setLayout(new GridLayout(2, false));
> ...
> CBanner pbar = new CBanner(shell, SWT.NONE);
> pbar.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2,
> 1));
>
> PerspectiveSwitcher perspectiveSwitcher = new PerspectiveSwitcher(window,
> pbar, SWT.FLAT | SWT.WRAP | SWT.RIGHT | SWT.HORIZONTAL);
> perspectiveSwitcher.createControl(shell);
> ...
> }
>
> If anyone can help me out I would apreciate. Thanks
>
> Tiago
>
>
Re: workbench layout [message #46061 is a reply to message #45983] Tue, 11 September 2007 09:31 Go to previous message
Tiago is currently offline TiagoFriend
Messages: 55
Registered: July 2009
Member
Hi,

Thanks for your reply. I'm going to do a little more investigation on the
workbench code. Meanwhile I got around the problem by implementing my own
toolbar and populating it with entries in the perspective registry.

Thanks.

Tiago

"Benjamin Muskalla" <b.muskalla@gmx.net> wrote in message
news:fc3vn8$sib$1@build.eclipse.org...
> Hi Tiago,
>
> first: Use internal stuff at your own risk. Neither Workbench,
> WorkbenchWindow nor PerspectiveSwitcher are API (as in RCP).
>
> The NPE is caused as you are calling methods without setting up the
> enviroment correctly first. Please take a look at the workbench code
> (WorkbenchWindowAdvisor etc) how this is done.
>
> In RCP you will get the same exception with your code. Normally you would
> set the according preference to modify location of the perspective
> switcher which is (sorry) not yet possible with RAP.
>
>
> Greets
> Benny
>
> Tiago wrote:
>> Hi,
>> I'm trying to customize the layout of a workbench to include an image and
>> other stuff. So far I managed to override the method
>> "createWindowContents(Shell)" from the WorkbenchWindowAdvisor class and
>> had success in changing the place of the toolbar and create a label with
>> an image. Now I'm trying to place the PerspectiveBar but without success
>> it always gives me the following exception:
>>
>> java.lang.NullPointerException
>> at
>> org.eclipse.ui.internal.PerspectiveSwitcher.createControlFor Location(Unknown
>> Source)
>> at
>> org.eclipse.ui.internal.PerspectiveSwitcher.setPerspectiveBa rLocation(Unknown
>> Source)
>> at org.eclipse.ui.internal.PerspectiveSwitcher.createControl(Un known
>> Source)
>>
>> Here is part of my code:
>>
>> @Override
>> public void createWindowContents(final Shell shell) {
>> final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
>> final WorkbenchWindow window = (WorkbenchWindow)
>> configurer.getWindow();
>> final Workbench workbench = (Workbench) window.getWorkbench();
>> shell.setLayout(new GridLayout(2, false));
>> ...
>> CBanner pbar = new CBanner(shell, SWT.NONE);
>> pbar.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2,
>> 1));
>>
>> PerspectiveSwitcher perspectiveSwitcher = new
>> PerspectiveSwitcher(window, pbar, SWT.FLAT | SWT.WRAP | SWT.RIGHT |
>> SWT.HORIZONTAL);
>> perspectiveSwitcher.createControl(shell);
>> ...
>> }
>>
>> If anyone can help me out I would apreciate. Thanks
>>
>> Tiago
Previous Topic:Demo M6 Startup Problem
Next Topic:Theme
Goto Forum:
  


Current Time: Fri Apr 19 12:22:14 GMT 2024

Powered by FUDForum. Page generated in 0.01517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top