Home » Eclipse Projects » Rich Client Platform (RCP) » perspective createInitialLayout never called
perspective createInitialLayout never called [message #443398] |
Fri, 27 January 2006 22:16 |
Eclipse User |
|
|
|
Originally posted by: grimicus.portalofevil.com
So, I was following the 3 tutorials for RCP I found on the eclipse site.
The last one shows you how to add a view to the perspective and make
it the default and so on:
http://www.eclipse.org/articles/Article-RCP-3/tutorial3.html
However, when I do this, my createInitialLayout is never called and my
application window is never populated with my custom view. As far as I
can tell, neither my custom view nor my custom perspective is being
created by RCP code. I have put breakpoints into the constructors of
both and neither get hit.
I've compared my RCP app to the example app and I can find nothing
wrong. I've also tested the the example RCP app, and despite showing
the view 'properly', my breakpoint in that application's
createInitialLayout is never hit either. I am highly confused. Is
there some new way to set this up in eclipse 3.1.x? I noticed that
those tutorials were somewhat out of date as now there are the Window
and ActionBar advisor classes. I've looked for some similar change in
3.1 for this problem, but I cannot locate it. I was using 3.1.1, but I
downloaded 3.1.2 today and still get the same results.
If anyone can point me in the right direction, that would be great.
Basically, all I want is an RCP app where I have 1 perspective and 1
view. The view will be a simple form with a canvas and a properties
window. I know I can just make an SWT app doing this most likely, but
I was trying to give RCP a whirl :-)
Thanks,
Dan
|
|
|
Re: perspective createInitialLayout never called [message #443400 is a reply to message #443398] |
Fri, 27 January 2006 23:35 |
Haris Peco Messages: 1072 Registered: July 2009 |
Senior Member |
|
|
Dan,
add you perspective id in
your WorkbenchWindowAdvisor#getInitialWindowPerspectiveId
Dan Tomalesky wrote:
> So, I was following the 3 tutorials for RCP I found on the eclipse site.
> The last one shows you how to add a view to the perspective and make
> it the default and so on:
> http://www.eclipse.org/articles/Article-RCP-3/tutorial3.html
>
> However, when I do this, my createInitialLayout is never called and my
> application window is never populated with my custom view. As far as I
> can tell, neither my custom view nor my custom perspective is being
> created by RCP code. I have put breakpoints into the constructors of
> both and neither get hit.
>
> I've compared my RCP app to the example app and I can find nothing
> wrong. I've also tested the the example RCP app, and despite showing
> the view 'properly', my breakpoint in that application's
> createInitialLayout is never hit either. I am highly confused. Is
> there some new way to set this up in eclipse 3.1.x? I noticed that
> those tutorials were somewhat out of date as now there are the Window
> and ActionBar advisor classes. I've looked for some similar change in
> 3.1 for this problem, but I cannot locate it. I was using 3.1.1, but I
> downloaded 3.1.2 today and still get the same results.
>
> If anyone can point me in the right direction, that would be great.
> Basically, all I want is an RCP app where I have 1 perspective and 1
> view. The view will be a simple form with a canvas and a properties
> window. I know I can just make an SWT app doing this most likely, but
> I was trying to give RCP a whirl :-)
>
> Thanks,
> Dan
|
|
|
Re: perspective createInitialLayout never called [message #443403 is a reply to message #443400] |
Fri, 27 January 2006 22:51 |
Eclipse User |
|
|
|
Originally posted by: grimicus.portalofevil.com
Haris Peco wrote:
> Dan,
> add you perspective id in
> your WorkbenchWindowAdvisor#getInitialWindowPerspectiveId
I don't see getInitialWindowPerspectiveId in WorkbenchWindowAdvisor's
class definition, but I know that I have this in my WorkbenchAdvisor
subclass. I reference my perspective's ID there just as it is written
in the plugin.xml file. That function does get called, that is one of
my break points.
However, my perspective is still never created as far as I can tell. My
experience with the tutorial's code is that it's perspective is also not
created, but when you run the application, it does show the view. There
is very little difference between it and my own code, hence my confusion.
Thanks,
Dan
|
|
| |
Re: perspective createInitialLayout never called [message #443412 is a reply to message #443405] |
Sat, 28 January 2006 01:37 |
Eclipse User |
|
|
|
Originally posted by: grimicus.portalofevil.com
Seems that I must have had some bad data in my .metadata folder. I
deleted it and now it works as expected.
Thanks,
Dan
Haris Peco wrote:
> Dan Tomalesky wrote:
>
>
>>Haris Peco wrote:
>>
>>
>>>Dan,
>>> add you perspective id in
>>>your WorkbenchWindowAdvisor#getInitialWindowPerspectiveId
>>
>>I don't see getInitialWindowPerspectiveId in WorkbenchWindowAdvisor's
>>class definition, but I know that I have this in my WorkbenchAdvisor
>>subclass. I reference my perspective's ID there just as it is written
>>in the plugin.xml file. That function does get called, that is one of
>>my break points.
>>
>
> sorry.it is WorkbenchAdvisor
>
>>However, my perspective is still never created as far as I can tell. My
>>experience with the tutorial's code is that it's perspective is also not
>>created, but when you run the application, it does show the view. There
>>is very little difference between it and my own code, hence my confusion.
>>
>
> i don't know what is your tutorial, but it is better that start with eclipse
> 3.1.x wizard
> do you have perspective extension point
> double check perspective id in getInitialPerspectiveId and extension point
> id
|
|
| |
Re: perspective createInitialLayout never called [message #453372 is a reply to message #443413] |
Thu, 27 July 2006 18:51 |
Chris Gage Messages: 74 Registered: July 2009 |
Member |
|
|
On Sat, 28 Jan 2006 10:36:28 +0530, Amit Rana <amit.rana@gmail.com>
wrote:
>I had similar problem and figured out problem was
>"configurer.setSaveAndRestore(true);" in initilize method of the
>workbench advisor
>
>I started from a blank "Hello World RCP" template.
>step 1: app runs
>step 2: add new view
>step 3: run it view never comes, control never goes to the Perspective
>createaInitialLayout.
>
>I removed the setSaveAndRestore(true) and it got working.
>
>My guess is that it reinstate applications state when closed which is
>the one without the view.
>
>when you deleted your .metadata you basically removed its previous state.
>
>my 2 cents.
>
>Amit.
>
>Dan Tomalesky wrote:
>> Seems that I must have had some bad data in my .metadata folder. I
>> deleted it and now it works as expected.
>>
>> Thanks,
>> Dan
>>
>> Haris Peco wrote:
There must be some way to circumvent this, unless it's a bug. In the
Addison-Wesley Eclipse Series book "Eclipse Rich Client Platform" by
McAffer/Lemieux, on page 63, it _explicitly_ tells you to override the
initialize() method in the ApplicationWorkbenchAdvisor class, and to
put
configurer.setSaveAndRestore(true);
in the method. This is the first actual source code change the book
asks you to make after running the Hello RCP wizard, so the following
described behavior is very easy to reproduce.
When I do this (I'm using Eclipse 3.2) it _does_ enable the saving and
restoring of the window size and position, but it also disables the
createInitialLayout() method of the perspective, and my perspective is
not executed. I have a System.out.println() at the start of the
createInitialLayout() method which does not get written to the
console, whereas it did before I overrode the
ApplicationWorkbenchAdvisor initialize() method.
If I comment out the overridden initialize() method again, the
perspective is executed, so I see the sop() in the console, but it no
longer saves my window size and position.
Chris
|
|
|
Re: perspective createInitialLayout never called [message #453378 is a reply to message #453372] |
Thu, 27 July 2006 19:34 |
|
Chris Gage wrote:
>
> When I do this (I'm using Eclipse 3.2) it _does_ enable the saving and
> restoring of the window size and position, but it also disables the
> createInitialLayout() method of the perspective, and my perspective is
> not executed. I have a System.out.println() at the start of the
> createInitialLayout() method which does not get written to the
> console, whereas it did before I overrode the
> ApplicationWorkbenchAdvisor initialize() method.
When you first create a perspective is the only time that
createInitialLayout(*) is run (or a reset perspective).
So if you have activated save and restore and you restart your app, your
perspective should be restored from the workbench settings. It's not
creating a new perspective, just restoring your current one.
But your perspective should have been called once, at some point.
Later,
PW
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: perspective createInitialLayout never called [message #453384 is a reply to message #453378] |
Fri, 28 July 2006 00:31 |
Eclipse User |
|
|
|
Originally posted by: wegener.cboenospam.com
Paul Webster wrote:
> Chris Gage wrote:
>>
>> When I do this (I'm using Eclipse 3.2) it _does_ enable the saving and
>> restoring of the window size and position, but it also disables the
>> createInitialLayout() method of the perspective, and my perspective is
>> not executed. I have a System.out.println() at the start of the
>> createInitialLayout() method which does not get written to the
>> console, whereas it did before I overrode the
>> ApplicationWorkbenchAdvisor initialize() method.
>
> When you first create a perspective is the only time that
> createInitialLayout(*) is run (or a reset perspective).
>
> So if you have activated save and restore and you restart your app, your
> perspective should be restored from the workbench settings. It's not
> creating a new perspective, just restoring your current one.
>
> But your perspective should have been called once, at some point.
>
> Later,
> PW
This is the expected behavior. If your createInitialLayout method were
called, it would wipe out the saved state of the perspective.
If you have setSaveAndRestore true and you make code changes in your
createInitialLayout() method, you have to clear out your workspace upon
launching. In the launch config, check the Clear workspace before
launching on the Main tab. If you leave the Ask for confirmation before
clearing checked, you will be asked whether you want to clear on each
launch.
|
|
|
Goto Forum:
Current Time: Sat Dec 21 16:05:33 GMT 2024
Powered by FUDForum. Page generated in 0.04355 seconds
|