Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Undocking all parts results in deleting the perspective.
Undocking all parts results in deleting the perspective. [message #1021734] Wed, 20 March 2013 15:44 Go to next message
Mateusz Malinowski is currently offline Mateusz Malinowski
Messages: 20
Registered: March 2013
Junior Member
Hi,

I just encountered some weird bug. When I remove all parts (or placeholders) from my main window to some separate ones, the whole perspective is deleted from the perspective stack (literally). When I leave in the perspective at least one part and close it, then I can still add parts and perspective exists (probably, because we technically don't close the part, just not render it, so it still exist out there).

My question is: is there any way to add a listener to perspective, which would trigger a handler when the perspective would like to close itself? Or perhaps I'm doing something terribly, terribly wrong (I wouldn't be that surprised)?

I would appreciate any help,
Mateusz

edit: If it may be helpful, I'm running Eclipse 4.2.2 on 64-bit W7

[Updated on: Wed, 20 March 2013 16:01]

Report message to a moderator

Re: Undocking all parts results in deleting the perspective. [message #1082660 is a reply to message #1021734] Thu, 08 August 2013 22:16 Go to previous messageGo to next message
Mateusz Malinowski is currently offline Mateusz Malinowski
Messages: 20
Registered: March 2013
Junior Member
Knock, knock, any ideas?

I spotted also some funny thing. If I create my own perspective, by extending PerspectiveImpl and add it to the E4 model, and override setToBeRendered() to send to super.setToBeRendered always true, after undocking all parts, the perspective is again removed from the model (even when I setParent to perspective stack, when getParent returns null), but undocked parts remain in their windows. Moreover, I can close those parts, but I can't close their windows.

Any clues? This perspective still exists, but it doesn't have eContainer and I don't know how to place it back to the main perspective stack.

The behaviour which I would expect, would be that I can undock all parts and my main window will remain empty. Later I should be able to dock those parts back to it. Just like the Eclipse IDE works (btw, even in Eclipse, if we undock a part from separate window, to put it to new one, the part closes). Maybe in Eclipse 4.3 are new functionalities which may help to find, at least, a workaround? I'm quite curious:)
Re: Undocking all parts results in deleting the perspective. [message #1085300 is a reply to message #1082660] Mon, 12 August 2013 18:32 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

Mateusz, this is almost certainly a result of the CleanupAddon being somewhat over aggressive. The purpose of the addon is to listen on model changes and to keep the presentation 'clean' by tearing down empty stacks...

Try an experiment; add the IPresentationEngine#NO_AUTO_COLLAPSE tag to the perspective: this should inform the cleanup addon to *not* tear down the perspective.

You can also open a defect if you want since in reality a perspective isn't really empty unless it has no non-empty detached windows...
Re: Undocking all parts results in deleting the perspective. [message #1085827 is a reply to message #1021734] Tue, 13 August 2013 12:34 Go to previous messageGo to next message
Mateusz Malinowski is currently offline Mateusz Malinowski
Messages: 20
Registered: March 2013
Junior Member
Eric,

This tag helps a lot! The only disadvantage is that when I undock all parts, perspective still doesn't have any "default" par stack inside, so it doesn't allow to dock those parts back inside the main window.

It works, if I manually create a part stack, without any children, and add it into the perspective, but this requires either to listen on the number of perspective's children, when those children are being detached (which I don't know how to achieve easily), or to have my own implementation of MPerspective, which will automatically add this part stack if getChildren is null.
Is there any other way to add a dummy part stack for this case?

...

Ok, I just found an easy solution. I created a method that injects active MPart and active MPerspective. If perspective doesn't have children, the dummy MPartStack is being created. I inject MPart only to active this method whenever I select a part that is already outside the main window.
Nevertheless, it doesn't sound as a nice and clean solution. So, might there be anything better?
Re: Undocking all parts results in deleting the perspective. [message #1092447 is a reply to message #1085827] Thu, 22 August 2013 20:18 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member

I'm just curious as to what kind of UI would use an empty main window and a bunch of detached windows...Wink. While this *is* a defect it's not high pri since I don't expect that many people would condider doing this...

BTW, what purpose does the 'dummy' stack serve ?
Re: Undocking all parts results in deleting the perspective. [message #1110369 is a reply to message #1092447] Mon, 16 September 2013 19:56 Go to previous messageGo to next message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member
I've opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=417367 to track these issues. The inability to drag stuff back into the presentation is just what they mean by 'unintended consequence'...Wink.
Re: Undocking all parts results in deleting the perspective. [message #1110856 is a reply to message #1110369] Tue, 17 September 2013 12:14 Go to previous messageGo to next message
Mateusz Malinowski is currently offline Mateusz Malinowski
Messages: 20
Registered: March 2013
Junior Member
Hi Eric,

Good to know, I'll be checking the status of this bug, thanks!Smile

Sorry, I just saw that I haven't answer your previous question.
This 'dummy' stack is just empty stack, but it allows to attach parts from detached windows back to the main window.

I agree with you totally that it's not a high priority. I was just playing a bit with eclipse and rcp. I also try to be sure that the end products will be as fool-proof as possible Wink
Re: Undocking all parts results in deleting the perspective. [message #1115927 is a reply to message #1110856] Tue, 24 September 2013 19:41 Go to previous message
Eric Moffatt is currently offline Eric Moffatt
Messages: 118
Registered: July 2009
Senior Member
+1 for that Smile
Previous Topic:Testing my RCP app on Eclipse 4.3 - unwanted progress bar is showing
Next Topic:Auto adjust of toolbar item
Goto Forum:
  


Current Time: Wed Oct 22 14:04:28 GMT 2014

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

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