Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to load custom perspective from XML Memento
How to load custom perspective from XML Memento [message #651694] Tue, 01 February 2011 10:22 Go to next message
sluettmann  is currently offline sluettmann Friend
Messages: 2
Registered: February 2011
Junior Member
Hi everyone,
I'm new to coding with the RCP Eclipse Framework.

I discovered some problems when trying to load a perspective stored in advance in a XMLMemento file.

I wrote a procedure to store a customized perspective w/ all included views in a given .xml file.

Furthermore I'd like to restore this saved perspective for example on another workstation.

My procedure loads the saved XMLMemento from the xml file by calling the function createReadRoot(reader) from the XMLMemento class.
As far as I can tell this is working correctly since I can access the elements within the xml file (e.g. the descriptor or view tags).

Then I tried to restore the perspective by creating a new instance of it and calling the restoreState(XMLMemento) function. Afterwards I tried to add the just created perpective to the perspective registry and load it over the load perspective dialog provided from the RCP Framework (Menubar->Window->Perspective->Other...).

And now my problem:
======================
The perspective is not being displayed. Something happens within my application and the current perspective changes but it is not my saved perspective which is being displayed.

Is there a proper way to load such a stored perspective from an XMLMemento file?

Thanks in advance for your help
Cheers
Sven
Re: How to load custom perspective from XML Memento [message #651737 is a reply to message #651694] Tue, 01 February 2011 13:06 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 02/01/2011 05:22 AM, sluettmann wrote:
>
> Is there a proper way to load such a stored perspective from an
> XMLMemento file?

There's no API and hence now supported way to do what you want.

You will have to look through the code that saves customized perspective
descriptors (see org.eclipse.ui.internal.SavePerspectiveAction for the
behaviour of "Save Perspective As") and then trick the system into
loading that perspective back.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: How to load custom perspective from XML Memento [message #651760 is a reply to message #651737] Tue, 01 February 2011 13:48 Go to previous messageGo to next message
sluettmann  is currently offline sluettmann Friend
Messages: 2
Registered: February 2011
Junior Member
Thanks for your quick reply.

Am I the first one who tries to save / load perspectives?
There must be something like a structured way to do so.
For example:
1) Load memento
2) create PerspectiveDescriptor and restoreState
3) create Perspective
4) .... a.s.o

I did use that code u mentioned (org.eclipse.ui.internal.SavePerspectiveAction) to save the perspectives but I can't trace the way back of loading it, cause I don't know the function that is called if u open the Dialog (Perspective->Other) and click OK.

Do you got an idea which function is called. Or where to search.

Cheers
Re: How to load custom perspective from XML Memento [message #651854 is a reply to message #651760] Tue, 01 February 2011 19:09 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

See how
org.eclipse.ui.internal.registry.PerspectiveRegistry.loadCus tom() does it.

That's how you would make your custom perspective available to Open
Perspective.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:how to extract additional file types from bundle
Next Topic:Running a RCP plugin dynamically from another project
Goto Forum:
  


Current Time: Sat Apr 20 00:40:48 GMT 2024

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

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

Back to the top