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 |
Mateusz Malinowski Messages: 36 Registered: March 2013 Location: Bristol |
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 |
Mateusz Malinowski Messages: 36 Registered: March 2013 Location: Bristol |
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 #1085827 is a reply to message #1021734] |
Tue, 13 August 2013 12:34 |
Mateusz Malinowski Messages: 36 Registered: March 2013 Location: Bristol |
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?
|
|
| | | | | |
Goto Forum:
Current Time: Wed Sep 25 23:46:20 GMT 2024
Powered by FUDForum. Page generated in 0.04173 seconds
|