Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Saving perspective programmatic
Saving perspective programmatic [message #525648] Wed, 07 April 2010 07:02 Go to next message
Eclipse UserFriend
Hi all,

I want to save a perspective (save perspective as) programmatic. if I use the command, the perspective dialog comes up to give the perspective name. The perspective name will be created automatically so i dont need this dialog. Is there a ways without breaking internal dependencies?

Regards,
Mark
Re: Saving perspective programmatic [message #525706 is a reply to message #525648] Wed, 07 April 2010 10:08 Go to previous message
Eclipse UserFriend
Hi again,
after some looking in the forum I have found a similar posting.
And it seems, that its not possible to save a perspective without importing internal dependencies. The SavePerspectiveAction is internal, so I tried something like this in an Handler:
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
final IWorkbenchPage page = window.getActivePage();
IPerspectiveDescriptor perspDesc = new IPerspectiveDescriptor() {
			
			@Override
			public String getLabel() {
				return page.getPerspective().getLabel() + " - " + UserSingleton.getUser();
			}
			
			@Override
			public ImageDescriptor getImageDescriptor() {
				return page.getPerspective().getImageDescriptor();
			}
			
			@Override
			public String getId() {
				return page.getPerspective().getId() + "." + UserSingleton.getUser();
			}
			
			@Override
			public String getDescription() {
				// TODO Auto-generated method stub
				return page.getPerspective().getDescription() + " (for User " + UserSingleton.getUser() + ")";
			}
		};
		window.getActivePage().savePerspectiveAs(perspDesc);

But it doesnt work because of a class cast exception. The expected class is the PerspectiveDescriptor, which is internal.

I create a multiuser client, where user should switch between their logins, without restarting the client. So the workbench should be saved and restored for each user.

Other ideas to solve this task? There is an command for saving the perspective. Is it possible to attach the name of the new perspective as command parameter? I dont need the Dialog for giving the new perspective a name, because the will be given from the client not the user.

Mark
Previous Topic:how to update the eclipse crossing-version?
Next Topic:Adding session management to perspectives...
Goto Forum:
  


Current Time: Mon Mar 24 10:16:20 EDT 2025

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

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

Back to the top