Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » It seems a Bug when calling "WorkbenchPage.resetPerspective"
It seems a Bug when calling "WorkbenchPage.resetPerspective" [message #520081] Thu, 11 March 2010 06:02 Go to next message
wayne  is currently offline wayne Friend
Messages: 13
Registered: March 2010
Junior Member
My Env: Eclipse 3.5 RAP 1.3M4

Please consider this scenario: custom define PresentationFactory, don't show CoolBar in ApplicationWorkbenchWindowAdvisor
In this case, when calling resetPerspective, as per the code in WorkbenchPage.resetPerspective()

public void resetPerspective() {
// Run op in busy cursor.
// Use set redraw to eliminate the "flash" that can occur in the
// coolbar as the perspective is reset.
ICoolBarManager2 mgr = (ICoolBarManager2) window.getCoolBarManager2();
try {
mgr.getControl2().setRedraw(false);
BusyIndicator.showWhile(null, new Runnable() {
public void run() {
busyResetPerspective();
}
});
} finally {
mgr.getControl2().setRedraw(true);
}
}

mgr.getControl2() will be null because we setShowCoolBar(false);
Then an exception will be throw.

Isn't is a bug?

Re: It seems a Bug when calling "WorkbenchPage.resetPerspective" [message #520115 is a reply to message #520081] Thu, 11 March 2010 03:54 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Wayne,

have you tried the same code in RCP? The rule of thumb is: if it works
in RCP, but fails in RAP, then it's likely to be a bug in RAP.

Did you change the workbench layout by overriding
ApplicationWorkbenchAdvisor#createWindowContents? I remember that it's
easy to screw things up there....

Ralf

wayne wrote:
> My Env: Eclipse 3.5 RAP 1.3M4
>
> Please consider this scenario: custom define PresentationFactory, don't
> show CoolBar in ApplicationWorkbenchWindowAdvisor
> In this case, when calling resetPerspective, as per the code in
> WorkbenchPage.resetPerspective()
>
> public void resetPerspective() {
> // Run op in busy cursor.
> // Use set redraw to eliminate the "flash" that can occur in the
> // coolbar as the perspective is reset.
> ICoolBarManager2 mgr = (ICoolBarManager2)
> window.getCoolBarManager2();
> try {
> mgr.getControl2().setRedraw(false);
> BusyIndicator.showWhile(null, new Runnable() {
> public void run() {
> busyResetPerspective();
> }
> });
> } finally {
> mgr.getControl2().setRedraw(true);
> }
> }
>
> mgr.getControl2() will be null because we setShowCoolBar(false); Then an
> exception will be throw.
> Isn't is a bug?
>
>
Re: It seems a Bug when calling "WorkbenchPage.resetPerspective" [message #520134 is a reply to message #520115] Thu, 11 March 2010 09:29 Go to previous messageGo to next message
wayne  is currently offline wayne Friend
Messages: 13
Registered: March 2010
Junior Member
Hi Ralf,

Because I am working on a very big project, so it's very hard for me to change my project now to RCP.

But i think it might be a easy way to reproduce it if you have the first example of RAP on website (I think you have Razz ). The link is:

http://www.eclipse.org/rap/demos.php


In it, there is a customer-defined presentation factory, you only need to add a editor, and NOT show the CoolBar. Then if you open the editor and close it AND in editor's dispose method call that reset method, then the Exception will be thrown.

I didn't change the workbench layout.
Re: It seems a Bug when calling "WorkbenchPage.resetPerspective" [message #520151 is a reply to message #520134] Thu, 11 March 2010 11:07 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
This is a RCP issue.

You would have to do something like this:

public void preWindowOpen() {
super.preWindowOpen();

IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.setShowCoolBar( true );
}

public void postWindowCreate() {
super.postWindowCreate();
((WorkbenchWindow) getWindowConfigurer().getWindow()).toggleToolbarVisibility() ;
}

The same is valid for the perspective bar...
Re: It seems a Bug when calling "WorkbenchPage.resetPerspective" [message #520157 is a reply to message #520151] Thu, 11 March 2010 11:39 Go to previous message
wayne  is currently offline wayne Friend
Messages: 13
Registered: March 2010
Junior Member
Actually I am not quite sure about that.

But just from the simple logic, I guess. if we don't show CoolBar, then the CoolBar will not create its Control2, when getting Control2.xxxx() will throw an Exception.

And when I use default Presentation Factory, I found that it does create a Control2, so it works.

Maybe we could refer to the implementation of default Presentation Factory.
Previous Topic:Icons initially not visible in perspective
Next Topic:Could someone check the RAP example, I guess there might be an error
Goto Forum:
  


Current Time: Sun Oct 06 20:03:27 GMT 2024

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

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

Back to the top