Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Phantom sticky shells
Phantom sticky shells [message #664969] Tue, 12 April 2011 16:09 Go to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
I open some views as a floating (detached) view.
So, it has its own shell.
I've declared the view as being not restorable.
Now I restart my app, and the shells appear empty.
I close them manually, but when I switch to another perspective and come back to the current perspective again, they reappear again. That's why I call them sticky.
How can I get rid of them forever?

I have tried this:

class MyWorkbenchAdvisor extends WorkbenchAdvisor {
    @Override
    public void postStartup() {
        Shell[] shells = Display.getCurrent().get Shells();
        IWorkbenchWindow[] windows = PlatformUI.g etWorkbench().getWorkbenchWindows();
        nextShell:
        for (Shell s: shells) {
            if (s.isVisible()) {
                for (IWorkbenchWindow win:  windows) {
                    if (win.getShell()
Re: Phantom sticky shells [message #665123 is a reply to message #664969] Wed, 13 April 2011 11:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/12/2011 12:10 PM, David Pérez wrote:
> I open some views as a floating (detached) view.
> So, it has its own shell.

Your best bet is to close those non-persistent views in your RCP app
workbench advisor preShutdown() method.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Phantom sticky shells [message #665197 is a reply to message #665123] Wed, 13 April 2011 15:45 Go to previous messageGo to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
Thanks Paul, you're right, it's better to fix the mess before saving, than in the restore phase.

Empirically, I've discovered that there is only on IWorkbenchPage that contains all views of the current perspective, even floating views.

In this way I can close all non-restorable views of the CURRENT perspective.
But what about the other perspectives?

I promise to publish a working code to fix this (it could even be be used to patch Eclipse, as I consider this a bug).

David

Paul Webster wrote on Wed, 13 April 2011 07:19
On 04/12/2011 12:10 PM, David Pérez wrote:
> I open some views as a floating (detached) view.
> So, it has its own shell.

Your best bet is to close those non-persistent views in your RCP app
workbench advisor preShutdown() method.

PW
[/url]

Re: Phantom sticky shells [message #665203 is a reply to message #665197] Wed, 13 April 2011 16:15 Go to previous messageGo to next message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
Here is some working code for the current perspective only:

    @Override
    public boolean preShutdown() {
        IViewRegistry reg = PlatformUI.getWorkben ch().getViewRegistry();
        for (IWorkbenchWindow win : PlatformUI.g etWorkbench().getWorkbenchWindows()) {
            for (IWorkbenchPage page : win.g etPages()) {
                for (IViewReference ref:  page.getViewReferences()) {
                    IViewDescriptor des cr = reg.find(ref.getId());
                    if (descr != null  && !descr.isRestorable()) {
                        page.hideVie w(ref);
                    }
                }
            }
        }
        return true;
    }

I hope to be useful to someone else.
David Pérez wrote on Wed, 13 April 2011 11:45
Thanks Paul, you're right, it's better to fix the mess before saving, than in the restore phase.

Empirically, I've discovered that there is only on IWorkbenchPage that contains all views of the current perspective, even floating views.

In this way I can close all non-restorable views of the CURRENT perspective.
But what about the other perspectives?

I promise to publish a working code to fix this (it could even be be used to patch Eclipse, as I consider this a bug).


Re: Phantom sticky shells [message #665361 is a reply to message #665203] Thu, 14 April 2011 12:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/13/2011 12:15 PM, David Pérez wrote:
> Here is some working code for the current perspective only:
>
> @Override
> public boolean preShutdown() {
> IViewRegistry reg = PlatformUI.getWorkben ch().getViewRegistry();
> for (IWorkbenchWindow win : PlatformUI.g
> etWorkbench().getWorkbenchWindows()) {
> for (IWorkbenchPage page : win.g etPages()) {
> for (IViewReference ref: page.getViewReferences()) {
> IViewDescriptor des cr = reg.find(ref.getId());
> if (descr != null && !descr.isRestorable()) {
> page.hideVie w(ref);
> }
> }
> }
> }
> return true;
> }


There's no way to effect the the views in the non-active perspective,
unfortunately.

So even a
org.eclipse.ui.application.WorkbenchWindowAdvisor.postWindow Restore()
doesn't look like it would help much, because you still couldn't access
the non-active perspective.

You should open a bug about it at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

If the detached window is empty, it should not be shown.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Phantom sticky shells [message #665620 is a reply to message #665361] Fri, 15 April 2011 09:43 Go to previous message
David  Pérez is currently offline David PérezFriend
Messages: 228
Registered: July 2009
Senior Member
Here is the bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=342940

I think this should be very easy to fix.

Paul Webster wrote on Thu, 14 April 2011 08:35

You should open a bug about it at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=UI

If the detached window is empty, it should not be shown.


Previous Topic:Is there an example of pulldown behaviour of a command
Next Topic:Programmatically add submenu
Goto Forum:
  


Current Time: Wed Apr 24 23:01:02 GMT 2024

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

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

Back to the top