Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357289 - Cannot disable detached views or parts
Summary: Cannot disable detached views or parts
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.8 M6   Edit
Assignee: Alex Say CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 562663
  Show dependency tree
 
Reported: 2011-09-09 17:27 EDT by Ben Roling CLA
Modified: 2020-04-30 08:57 EDT (History)
8 users (show)

See Also:


Attachments
patch with an example of how this issue might be fixed (3.74 KB, patch)
2011-09-09 17:35 EDT, Ben Roling CLA
no flags Details | Diff
fix bug through adding tag (1.92 KB, patch)
2017-12-14 03:30 EST, Alex Say CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Roling CLA 2011-09-09 17:27:16 EDT
Build Identifier: I20110620-1631

I have an Eclipse 3.6 based RCP app that is being uplifted to E4.  This app used the IWorkbenchPreferenceConstants.ENABLE_DETACHED_VIEWS preference to disable detached views, but this preference doesn't appear to be read in Eclipse 4.1.

I asked a question about this in the forums but got no response.  See http://www.eclipse.org/forums/index.php/t/234263/

I think this would be an easy to fix with a simple patch to the DnDAddon to read a property that could be configured in the application e4xmi.  That doesn't directly address the problem of the old ENABLE_DETACHED_VIEWS preference not being honored but it provides a workaround that would be suitable at least for my own needs.  I assume it may be suitable for others as well.

I will attach an example patch shortly.  If there is a better way to do it I am happy to hear that as well.

Reproducible: Always
Comment 1 Remy Suen CLA 2011-09-09 17:30:28 EDT
I'm wondering would it be possible for you to just not include the addon in your RCP application?
Comment 2 Ben Roling CLA 2011-09-09 17:35:06 EDT
Created attachment 203094 [details]
patch with an example of how this issue might be fixed
Comment 3 Ben Roling CLA 2011-09-09 17:36:01 EDT
I don't want to disallow drag and drop altogether.  I just don't want dropping things off into detached windows.
Comment 4 Alex Say CLA 2017-12-14 02:07:11 EST
I suggest adding a new tag for MPart, following the example of "NoMove", and calling it "NoDetach" for example. Perhaps it will be enough to change the method org.eclipse.e4.ui.workbench.addons.dndaddon.DetaghedDropAgent.canDrop ():

@override
public boolean canDrop (MUIElement dragElement, DnDInfo info) {
if (info.curElement! = null) {
return false;
}

if (dragElement instanceof MPart || dragElement instanceof MPlaceholder
|| dragElement instanceof MPartStack) {
<b>return! dragElement.getTags (). contains ("NoDetach");</b>
}

return false;
}
Comment 5 Andrey Loskutov CLA 2017-12-14 02:15:27 EST
(In reply to Alex Say from comment #4)
> I suggest adding a new tag for MPart, following the example of "NoMove", and
> calling it "NoDetach" for example. Perhaps it will be enough to change the

Please push a good patch to Gerrit.
Comment 6 Alex Say CLA 2017-12-14 03:30:43 EST
Created attachment 271901 [details]
fix bug through adding tag
Comment 7 Andrey Loskutov CLA 2017-12-14 03:37:23 EST
(In reply to Alex Say from comment #6)
> Created attachment 271901 [details]
> fix bug through adding tag

Please use Gerrit for patches, see https://wiki.eclipse.org/Platform_UI/How_to_Contribute
Comment 8 Eclipse Genie CLA 2017-12-15 04:38:30 EST
New Gerrit change created: https://git.eclipse.org/r/113462
Comment 10 Mickael Istria CLA 2018-02-01 08:27:31 EST
Good patch merged. Thank you very much for your contribution Alex!
Comment 11 Eclipse Genie CLA 2018-02-06 05:36:15 EST
New Gerrit change created: https://git.eclipse.org/r/116766
Comment 13 Noopur Gupta CLA 2018-02-06 05:42:00 EST
(In reply to Eclipse Genie from comment #12)
> Gerrit change https://git.eclipse.org/r/116766 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=545fdb70afdc5660d658c92c2f7692852f6c99e0

Fixed the API tools error due to missing @since tag.
Comment 14 Andrew Thomas CLA 2019-06-20 16:31:15 EDT
Does this just address *dragging* a part out of the workbench?

Or does it also address the "Detach" context menu item on parts?
Comment 15 Dominik Gabriel CLA 2020-04-30 07:50:15 EDT
it seems that the context menu would not be fixed by that for me