Community
Participate
Working Groups
The dragOver() method for a custom presentation is not called when an entire stack (i.e. ViewStack) is being dragged. Thus, you cannot prevent a ViewStack from being dropped onto another ViewStack. The offending code seems to be in PartStack.getDropTarget(). I'm trying to code my presentation such that views can be dragged around and repositioned, but views cannot be combined with other views.
IMHO, decisions like this should not be made by the presentation. Whether or not views can be stacked or dragged should be a property of the perspective. If each presentation were to make assumptions about the behavior of its containing perspective, then different presentations would not be interchangable. You can prevent a view from being stacked by flagging it as standalone in the perspective. It should be possible to make all your views both standalone and moveable, which gives you the behavior you desire. If not, please reopen.
If I create a view as standalone, then move it, its recreated in a normal (non- standalone) view stack. Then any other view can be dropped onto that view. It doesn't seem that I can accomplish a presentation or perspective or anything that will prevent users from combining views. Regarding who's responbility it is, it seems like these are responsibilities are mixed already. A presentation is responsible for implementing (or choosing not to implement) whatever was set by the perspective (standalone,moveable,closeable). Because of this, it would seem to me that what a perspective sets should be interpreted as hints for the presentation. If the presentation can or wants to support the given attribute it may. It would feel more fitting if the standalone view support was implemented fully by the presentation and not by workbench internals. Meaning that the presentation prevents the dropping on standalone views by an appropriate callback (i.e. dragOver) rather workbench internals preventing the drop. Reopening because I don't have a solution to my root issue: preventing views from combining in the same site, while still being moveable.
Okay... IMHO, the first issue is a bug: if you flagged a view as standalone+movable, then moving it shouldn't cause the standalone flag to be lost. RCP apps may choose to implement a subset of the presentation features, but this would be an intentional decision to be incompatible with other Eclipse presentations. The author of the Java perspective would not want a presentation to prevent stacking or moving of views. Similarly, you probably would not want users to be able to stack stuff together in your perspective if it was rendered with a different presentation. StackPresentation is only supposed to control stuff that goes on within a single stack. Decisions about what goes into each stack, where the stacks are located, etc. are the domain of the perspective. If there has been some blurring of responsibility, we should not blur it further. Renaming and reclassifying bug.
Along the same lines a standalone + moveable stack should not be allowed to be dragged into any other stack.
Created attachment 21798 [details] patch to fix both issues here PartSashContainer now creates the new stack as standalone if the dropped object came from a standalone stack. It also prevents standalone stacks/views from standalone stacks from being dragged into other stacks.
Will inspect patch for 3.2.
I realize that 3.1 is targeted for a next month release, however this bug prevents RCP developers from usgin standalone views in their apps. I currently have a view that needs to be visible at all times, if a user is allowed to redock it or move it into another stack it defeats the purpose of the standalone stack. This impacts my entire application design, as we are targeting 3.1 this is really a blocker for us. The patch is relatively minor (I added 5 lines of code and modified 2 others) and should be added for 3.1 or at least looked at.
I've looked at the patch, and it looks pretty low risk for 3.1.1 (with one minor change). I'll try to write a test for it on Tuesday, then it can be submitted. PW
Created attachment 26852 [details] Test that drags a standalone view onto a standalone view Test that standalone views cannot be combined after dragging them around. PW
Created attachment 26853 [details] Slightly updated patch for submission to 3.1.1 Slightly updated patch, it's ready to go for 3.1.1 and 3.2 PW
patches applied to 3.1.1
still need to apply something for 3.2
fixed in HEAD, had to move some of the code around, Paul please double check
verified on 3.2
Standalone views can still lose this property when they are detached. See Bug 110634 [DetachedViews] Standalone views lose their standalone property when detached
(my previous comment applies to 3.1.1 RC2, I haven't tested this with a recent 3.2 build.)
Also filed bug 111634 -- a stack containing a non-moveable view can still be moved.