Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » set the default perspective even with user's preferences
set the default perspective even with user's preferences [message #509807] Mon, 25 January 2010 13:31 Go to next message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
Hi,
I've got an RCP application with the following advisor:

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {

    /**
     * The default perspective ID to load on the application startup.
     */
    private static final String DEFAULT_PERSPECTIVE_ID = "hrpm.rcp.gui.perspective.WelcomePerspective";

    /**
     * This method is used to create the workbench window advisor, that is the object
     * that can configure the window of the workbench.
     */
    public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
	return new ApplicationWorkbenchWindowAdvisor(configurer);
    }

    public String getInitialWindowPerspectiveId() {
	return DEFAULT_PERSPECTIVE_ID;
    }

    /* (non-Javadoc)
     * @see org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.eclipse.ui.application.IWorkbenchConfigurer)
     */
    @Override
    public void initialize(IWorkbenchConfigurer configurer) {
	// configure with the super object
	super.initialize(configurer);

	// set the save-and-restore property, so that the workbench
	// will store the user layout when the application quits
	configurer.setSaveAndRestore( true );
    }

    
	
}



as shown the advisor uses the setSaveAndRestore method to save the user's preferences. However I'd like that the default perspective is always shown on top of the others without any regard to the user preferences. I mean, the user can set the window position, size, and perspective opened at startup, but the default one must always be shown. Is it psssible?
Re: set the default perspective even with user's preferences [message #510260 is a reply to message #509807] Tue, 26 January 2010 19:28 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 418
Registered: July 2009
Senior Member
Hi Luca,

The restorestate methods in the advisors give you early access. Otherwise an
activator would allow you to open the welcome perspective with


PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().setPerspective(ccc)

Best regards,

Wim Jongman




> Hi,
> I've got an RCP application with the following advisor:
>
>
> public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
>
> /**
> * The default perspective ID to load on the application startup.
> */
> private static final String DEFAULT_PERSPECTIVE_ID =
"hrpm.rcp.gui.perspective.WelcomePerspective";
>
> /**
> * This method is used to create the workbench window advisor, that is the
object
> * that can configure the window of the workbench.
> */
> public WorkbenchWindowAdvisor
createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
> return new ApplicationWorkbenchWindowAdvisor(configurer);
> }
>
> public String getInitialWindowPerspectiveId() {
> return DEFAULT_PERSPECTIVE_ID;
> }
>
> /* (non-Javadoc)
> * @see
org.eclipse.ui.application.WorkbenchAdvisor#initialize(org.e clipse.ui.application.IWorkbenchConfigurer)
> */
> @Override
> public void initialize(IWorkbenchConfigurer configurer) {
> // configure with the super object
> super.initialize(configurer);
>
> // set the save-and-restore property, so that the workbench
> // will store the user layout when the application quits
> configurer.setSaveAndRestore( true );
> }
>
>
>
> }
>
>
>
> as shown the advisor uses the setSaveAndRestore method to save the user's
preferences. However I'd like that the default perspective is always shown on
top of the others without any regard to the user preferences. I mean, the
user can set the window position, size, and perspective opened at startup,
but the default one must always be shown. Is it psssible?
Previous Topic:How to generate RCP application programatically
Next Topic:Is there a view that shows memory consumption per plugin?
Goto Forum:
  


Current Time: Sat Dec 20 21:46:15 GMT 2014

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

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