Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Recovering from bogus perspective
Recovering from bogus perspective [message #328845] Wed, 04 June 2008 21:55 Go to next message
Mark Melvin is currently offline Mark MelvinFriend
Messages: 118
Registered: July 2009
Senior Member
Hi There,

We have recently gone through a massive re-naming process and I am trying
to auto-migrate a whole whack of stuff present in old customer
workspaces. I have written an extensible migration wizard that seems to
work for everything except the fact that our old perspective ids no longer
exist and Eclipse does not handle it well at all. Basically I have
renamed a perspective from 'a.id' to 'b.id'. The problem is, 99.9% of our
users will be in the old 'a.id' perspective when the new product initially
starts up (using their old workspace). Eclipse complains about views and
things, and then seems to run with no notion of a proper current
perspective. There is no icon shown for the current (non-existent)
perspective in the perspective bar, and I cannot close it from the
perspective bar (probably a bug). If I right-click the placeholder icon
for my missing perspective and click "close", nothing happens.

My questions are as follows:

1) Is there any way to find out what the "current" perspective is? I
can't seem to see this anywhere in the various interfaces.
2) How can I remove a bogus perspective shortcut from the perspective
bar? This doesn't appear to be possible either.

Now I know I could probably go and define dummy perspectives using the old
ids, but my plugin names have also changed and I have found out the hard
way that you can't always force a namespace on an extension to a value
that does not match your plugin id. I also would like to migrate rather
than "work around" the issue with a fake id.

Thanks in advance,
Mark.
Re: Recovering from bogus perspective [message #328858 is a reply to message #328845] Thu, 05 June 2008 04:17 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
> 1) Is there any way to find out what the "current" perspective is? I
> can't seem to see this anywhere in the various interfaces.

Perspective is set on the workbench page. You can get the currently
active perspective by:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getPerspective();


> 2) How can I remove a bogus perspective shortcut from the perspective
> bar? This doesn't appear to be possible either.

Closing the perspective should work.


> Now I know I could probably go and define dummy perspectives using the
> old ids, but my plugin names have also changed and I have found out the
> hard way that you can't always force a namespace on an extension to a
> value that does not match your plugin id.


Say if you have defined your perspective id as zzz in your a.b.c
plugin and your new plugin is is p.q.r Create a perspective in your new
plugin and set the id as a.b.c.zzz. That should work

> I also would like to migrate
> rather than "work around" the issue with a fake id.

When Eclipse quits, it stores the state of the workbench in the
workspace and then restores when its launched again. So quit your
application, open
..metadata/.plugins/org.eclipse.ui.workbench/workbench.xml and remove the
references to the old perspective. If you have any trouble, simple
alternative could be to just delete the whole file. Next time you start
your app, your workbench should reset itself to the defaults.

--

- Prakash

www.eclipse-tips.com

Mark Melvin wrote:
> Hi There,
>
> We have recently gone through a massive re-naming process and I am
> trying to auto-migrate a whole whack of stuff present in old customer
> workspaces. I have written an extensible migration wizard that seems to
> work for everything except the fact that our old perspective ids no
> longer exist and Eclipse does not handle it well at all. Basically I
> have renamed a perspective from 'a.id' to 'b.id'. The problem is, 99.9%
> of our users will be in the old 'a.id' perspective when the new product
> initially starts up (using their old workspace). Eclipse complains
> about views and things, and then seems to run with no notion of a proper
> current perspective. There is no icon shown for the current
> (non-existent) perspective in the perspective bar, and I cannot close it
> from the perspective bar (probably a bug). If I right-click the
> placeholder icon for my missing perspective and click "close", nothing
> happens.
>
> My questions are as follows:
>
> 1) Is there any way to find out what the "current" perspective is? I
> can't seem to see this anywhere in the various interfaces.
> 2) How can I remove a bogus perspective shortcut from the perspective
> bar? This doesn't appear to be possible either.
>
> Now I know I could probably go and define dummy perspectives using the
> old ids, but my plugin names have also changed and I have found out the
> hard way that you can't always force a namespace on an extension to a
> value that does not match your plugin id. I also would like to migrate
> rather than "work around" the issue with a fake id.
>
> Thanks in advance,
> Mark.
Re: Recovering from bogus perspective [message #328873 is a reply to message #328858] Thu, 05 June 2008 16:55 Go to previous messageGo to next message
Mark Melvin is currently offline Mark MelvinFriend
Messages: 118
Registered: July 2009
Senior Member
Thanks, Prakash! Your pointer to the active workbench page did the
trick. I was trying to use the perspective registry (and the internal
PerspectiveBarManager) and didn't think about the active page having a
reference to all of this information. I am able to get the current
(non-existing) perspective using:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getPerspective();

And I can also grab a handle to all open perspectives and close down any
deprecated ones (or replace them with the new ones) using:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getOpenPerspectives();
and:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().closePerspective(..);

Closing the perspective programmatically seems to get rid of it. I'll
file a bug for the issue I am seeing where closing a perspective via the
context menu does not work.

Thanks for your help,
Mark.

On Thu, 05 Jun 2008 00:17:17 -0400, Prakash G.R. <grprakash@gmail.com>
wrote:

> > 1) Is there any way to find out what the "current" perspective is? I
> > can't seem to see this anywhere in the various interfaces.
>
> Perspective is set on the workbench page. You can get the currently
> active perspective by:
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().getPerspective();
>
>
> > 2) How can I remove a bogus perspective shortcut from the perspective
> > bar? This doesn't appear to be possible either.
>
> Closing the perspective should work.
>
>
> > Now I know I could probably go and define dummy perspectives using the
> > old ids, but my plugin names have also changed and I have found out
> the
> > hard way that you can't always force a namespace on an extension to a
> > value that does not match your plugin id.
>
>
> Say if you have defined your perspective id as zzz in your a.b.c
> plugin and your new plugin is is p.q.r Create a perspective in your new
> plugin and set the id as a.b.c.zzz. That should work
>
> > I also would like to migrate
> > rather than "work around" the issue with a fake id.
>
> When Eclipse quits, it stores the state of the workbench in the
> workspace and then restores when its launched again. So quit your
> application, open
> .metadata/.plugins/org.eclipse.ui.workbench/workbench.xml and remove the
> references to the old perspective. If you have any trouble, simple
> alternative could be to just delete the whole file. Next time you start
> your app, your workbench should reset itself to the defaults.
>
Re: Recovering from bogus perspective [message #328897 is a reply to message #328845] Fri, 06 June 2008 08:45 Go to previous messageGo to next message
Roman Porotnikov is currently offline Roman PorotnikovFriend
Messages: 18
Registered: July 2009
Junior Member
Mark Melvin wrote:

> 2) How can I remove a bogus perspective shortcut from the perspective
> bar? This doesn't appear to be possible either.

When "Close" does not work on a bogus perspective I usually close
everything with menu "Window" -> "Close all perspectives" and then
re-open perspectives I need.

Ugly but works :-)

Roman
Re: Recovering from bogus perspective [message #328907 is a reply to message #328897] Fri, 06 June 2008 13:57 Go to previous message
Mark Melvin is currently offline Mark MelvinFriend
Messages: 118
Registered: July 2009
Senior Member
Thanks, Roman. I managed to find that workaround as well but you're right
- it is ugly. ;)

M.

On Fri, 06 Jun 2008 04:45:29 -0400, Roman Porotnikov
<roman.porotnikov@gmail.com> wrote:

> Mark Melvin wrote:
>
>> 2) How can I remove a bogus perspective shortcut from the perspective
>> bar? This doesn't appear to be possible either.
>
> When "Close" does not work on a bogus perspective I usually close
> everything with menu "Window" -> "Close all perspectives" and then
> re-open perspectives I need.
>
> Ugly but works :-)
>
> Roman
Previous Topic:Project Management
Next Topic:API for reloading Eclipse target platform
Goto Forum:
  


Current Time: Fri Jul 19 14:29:58 GMT 2024

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

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

Back to the top