|
Re: programatically detach a view in 4.2 [message #895441 is a reply to message #895411] |
Thu, 12 July 2012 22:22 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
I can't tell you which API but a good start is EModelService#detach
which allows to detach a complete stack.
Tom
Am 12.07.12 20:44, schrieb Mark Fishman:
> So I want to switch my RCP application from 3.7.2 to 4.2 to take
> advantage of some of the nice new features that it has but one of my
> hacks is coming back to haunt me.
>
> In the 3.7.2 implementation of my application, I needed an ability to
> allow a user to, upon request, launch a view either attached as a tab in
> my main window or else detached in its own window. Further, if the user
> launched the view detached, I wanted them to be able to grab the tab for
> it and drag it back into the main window to attach it there.
>
> In 3.7, I was able to meet this goal by using the internal APIs to make
> a call like:
>
> ((WorkbenchPage)getSite().getPage()).getActivePerspective().getPresentation(
> )
> detachPart(ref);
>
>
> to launch the view detached. Since it was still associated with the
> main window, I could then drag it back in and attach it like I wanted.
>
> Those APIs are now gone in 4.2. I can't complain too much because I
> know that I was using internal APIs but my question is, is there a
> similar way to get the same sort of functionality in 4.2?
> Thanks.
|
|
|
Re: programatically detach a view in 4.2 [message #895442 is a reply to message #895441] |
Thu, 12 July 2012 22:25 |
Thomas Schindl Messages: 6651 Registered: July 2009 |
Senior Member |
|
|
It is used by DetachedDropAgent and my initial comment was wrong one can
detach any MPartSashContainerElement which is a part or a complete stack.
Tom
Am 13.07.12 00:22, schrieb Tom Schindl:
> I can't tell you which API but a good start is EModelService#detach
> which allows to detach a complete stack.
>
> Tom
>
> Am 12.07.12 20:44, schrieb Mark Fishman:
>> So I want to switch my RCP application from 3.7.2 to 4.2 to take
>> advantage of some of the nice new features that it has but one of my
>> hacks is coming back to haunt me.
>>
>> In the 3.7.2 implementation of my application, I needed an ability to
>> allow a user to, upon request, launch a view either attached as a tab in
>> my main window or else detached in its own window. Further, if the user
>> launched the view detached, I wanted them to be able to grab the tab for
>> it and drag it back into the main window to attach it there.
>>
>> In 3.7, I was able to meet this goal by using the internal APIs to make
>> a call like:
>>
>> ((WorkbenchPage)getSite().getPage()).getActivePerspective().getPresentation(
>> )
>> detachPart(ref);
>>
>>
>> to launch the view detached. Since it was still associated with the
>> main window, I could then drag it back in and attach it like I wanted.
>>
>> Those APIs are now gone in 4.2. I can't complain too much because I
>> know that I was using internal APIs but my question is, is there a
>> similar way to get the same sort of functionality in 4.2?
>> Thanks.
>
>
|
|
|
|
|
|
Re: programatically detach a view in 4.2 [message #895631 is a reply to message #895616] |
Fri, 13 July 2012 21:04 |
|
I manage to detach my view. My code isn't 100% ok, but it's a start. I placed a button on my view, and on its widgedSelected listener method, I did this:
EPartService ePartService = (EPartService)PlatformUI.getWorkbench().getService( EPartService.class );
MPart mPart = ePartService.findPart( VIEW_ID ); // This is a const of mine.
EModelService eModelService = (EModelService)PlatformUI.getWorkbench().getService( EModelService.class );
MPlaceholder placeHolder = mPart.getCurSharedRef();
eModelService.detach( placeHolder, 50, 50, 100, 100 ); // Gotta compute correct bounds.
Mário Marinato
From Brazil
|
|
|
|
Powered by
FUDForum. Page generated in 0.03041 seconds