Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Delete Saved Perspective
Delete Saved Perspective [message #1018834] Thu, 14 March 2013 14:51 Go to next message
Luc Brunet is currently offline Luc BrunetFriend
Messages: 2
Registered: March 2013
Junior Member
Hi, I am developing an RCP (3.7) application and have enabled the org.eclipse.ui.window.savePerspective command as a menu option so users can create their own perspectives and save them. However, I cannot seem to find an equivalent delete command to add as a menu option so that users can delete perspectives that they no longer need or want. Does anyone know how or even if this can be done?

Thanks,

Luc
Re: Delete Saved Perspective [message #1021908 is a reply to message #1018834] Wed, 20 March 2013 23:00 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 418
Registered: July 2009
Senior Member
Hi Luc,

You can delete perspectives in the Preferences/General/Perspectives. I don't
know how this can be done programmatically but it should now not be hard to
find out. ;)

Best regards,

Wim


> Hi, I am developing an RCP (3.7) application and have enabled the
org.eclipse.ui.window.savePerspective command as a menu option so users can
create their own perspectives and save them. However, I cannot seem to find
an equivalent delete command to add as a menu option so that users can delete
perspectives that they no longer need or want. Does anyone know how or even
if this can be done?
>
> Thanks,
>
> Luc
Re: Delete Saved Perspective [message #1144312 is a reply to message #1021908] Fri, 18 October 2013 20:03 Go to previous message
Luc Brunet is currently offline Luc BrunetFriend
Messages: 2
Registered: March 2013
Junior Member
Thanks Wim. I realize this is a little late, but this is how I solved it ... I created a command with the following class handler:

@SuppressWarnings("restriction")
public class DeletePerspectiveHandler implements IHandler {

@Override
public void addHandlerListener(IHandlerListener handlerListener)
{
//
}

@Override
public void dispose()
{
//
}

@Override
public Object execute(ExecutionEvent event) throws ExecutionException
{
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
IPerspectiveDescriptor perspective = page.getPerspective();

PerspectiveRegistry perspRegistry = (PerspectiveRegistry) WorkbenchPlugin.getDefault().getPerspectiveRegistry();

page.closePerspective(perspRegistry.findPerspectiveWithId(perspective.getId()), false, false);
perspRegistry.deletePerspective(perspRegistry.findPerspectiveWithId(perspective.getId()));

return null;
}

@Override
public boolean isEnabled()
{
return true;
}

@Override
public boolean isHandled()
{
return true;
}

@Override
public void removeHandlerListener(IHandlerListener handlerListener)
{
//
}
}


If anyone knows a better way, please let me know.

Thanks,

Luc
Previous Topic:Using other JVM language than Java possile?
Next Topic:tags allowed in description (context help)
Goto Forum:
  


Current Time: Thu Dec 18 00:50:17 GMT 2014

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

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