Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Detaching a View Programatically

Hi Emily,

> I came across the need to have a view detached by default. Some
> investigation lead me to this code which allows me to detach the view. I am
> running this code when the tool that requires the view makes the view
> visible (if it's not currently visible).
>
> IViewReference ref = page.findViewReference(VIEW_ID);
> ((WorkbenchPage)page).detachView(ref);
>
> However there are couple issues with this:
> 1) This line "((WorkbenchPage)page).detachView(ref);" results in the
> following warning:
> Discouraged access:  The type WorkbenchPage is not accessible due to the
> restriction on required library
> org.eclipse.ui.workbench_3.3.2.M20080207-0800.jar
>
> Can anyone point out to me the implications of this message?

It's an internal method, so there's no gaurantee that it'll stay in
that class. But it seems the only way to do it, so use it just keeping
that in mind.

In fact I found this code around:

IViewReference ref = getSite().getPage().
	findViewReference(yourViewIdHere);
((WorkbenchPage)getSite().getPage()).getActivePerspective().
	getPresentation().detachPart(ref);
getViewSite().getShell().setLocation(someX, someY);

Not tried if it works though.

> 2) If you close the view and re-open it again the view slowly moves down &
> to the right.  As well there seems to be a lot of flickering in the screen.
>  This is not a big problem; just rather annoying.

wasn't ble to try that out, sorry,

Ciao
Andrea


>
> I'm curious to know if anyone has a better way to automatically detach
> views.
>
> Emily
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>


Back to the top