Bug 378298 - [EditorMgmt] [Split editor] Allow nesting of Sash/Stack in a Stack
Summary: [EditorMgmt] [Split editor] Allow nesting of Sash/Stack in a Stack
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: All All
: P3 enhancement with 4 votes (vote)
Target Milestone: 4.4 M4   Edit
Assignee: Eric Moffatt CLA
QA Contact: Eric Moffatt CLA
URL:
Whiteboard:
Keywords:
: 400979 (view as bug list)
Depends on:
Blocks: 420972
  Show dependency tree
 
Reported: 2012-05-02 15:29 EDT by Thomas Schindl CLA
Modified: 2014-04-02 13:48 EDT (History)
22 users (show)

See Also:


Attachments
extension bundle for split-editors (96.25 KB, application/zip)
2012-05-02 15:35 EDT, Thomas Schindl CLA
no flags Details
screenshot of the feature in action (239.57 KB, image/png)
2012-05-02 16:17 EDT, Thomas Schindl CLA
no flags Details
Exceptions when trying with RC4 (76.12 KB, text/plain)
2012-06-19 10:31 EDT, Dani Megert CLA
no flags Details
Enhancement (5.87 KB, patch)
2012-06-20 10:35 EDT, Nobody - feel free to take it CLA
no flags Details | Diff
Enhancement (6.35 KB, patch)
2012-06-20 16:04 EDT, Nobody - feel free to take it CLA
no flags Details | Diff
ZIP of project to demonstrate the splitter (14.28 KB, application/x-zip-compressed)
2013-10-27 14:55 EDT, Eric Moffatt CLA
no flags Details
Screenshot for split editor (11.77 KB, image/png)
2013-12-12 06:52 EST, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schindl CLA 2012-05-02 15:29:57 EDT
* Allowing to have a Sash inside the Stack would allow to implement split-editors
* Allowing to have a Stack inside the Stack is way to implement multi-part 
  editors reusing existing ones
Comment 1 Thomas Schindl CLA 2012-05-02 15:35:39 EDT
Created attachment 214947 [details]
extension bundle for split-editors

This holds bundles which bring split-editors to an *unmodified* Eclipse 4.2 application.

To work is based on the stuff Remy showed at EclipseCon NA 2012
Comment 2 Thomas Schindl CLA 2012-05-02 15:43:41 EDT
This is work in progress. 

Following is not working yet:
* Closing is not working
* Active tab coloring is not correct (Editor TabFolder appears none focused)
Comment 3 Thomas Schindl CLA 2012-05-02 16:05:23 EDT
This first implementation could fix bug 8009 once all remaining problems are solved
Comment 4 Thomas Schindl CLA 2012-05-02 16:17:25 EDT
Created attachment 214959 [details]
screenshot of the feature in action
Comment 5 Markus Keller CLA 2012-05-10 11:22:19 EDT
Hey Tom, that looks really cool!

(I was first worried about seeing this huge patch in the master branch, but then I realized it's only an example and not an RC1 feature.)
Comment 6 Thomas Schindl CLA 2012-05-10 11:40:37 EDT
Yeah it was discussed on the mailing list - and so I went ahead and committed it so that I can work on polishing (others are free to join :-).

We thought that if we move the code base in 4.3 (and really publish this feature) we won't loose the history and hence added it to the platform.ui repo (i could have used a feature-branch).

For all others worried like you. This does not affect any production code! It's only some bundles in the example-dir who implement this feature.

Once we flashed out some minor problems - I think we can go public (pinging bug 8009) and see hell break loose.

I think this is one of the most impressive examples what the new platform has to offer
Comment 7 Remy Suen CLA 2012-05-10 11:55:29 EDT
Ah, I see you introduced a new renderer to get around the need to modify StackRenderer directly. Very clever, Tom. :)

I'm not sure if we'll ever be able to get singleton views to split. Perhaps we can make it so that the handler is only enabled for multi-instance views I guess.
Comment 8 Dani Megert CLA 2012-06-19 10:31:13 EDT
(In reply to comment #1)
> Created attachment 214947 [details]
> extension bundle for split-editors
> 
> This holds bundles which bring split-editors to an *unmodified* Eclipse 4.2
> application.

I wanted to try this with
http://download.eclipse.org/eclipse/downloads/drops4/S-4.2RC4-201206081400/
but I get lots of exceptions`when pressing Ctrl+6 or Ctrl+9. Did I miss something?
Comment 9 Dani Megert CLA 2012-06-19 10:31:47 EDT
Created attachment 217550 [details]
Exceptions when trying with RC4
Comment 10 Paul Webster CLA 2012-06-19 10:35:45 EDT
I think the latest source has been checked into master in http://git.eclipse.org/c/platform/eclipse.platform.ui.git/tree/examples

org.eclipse.e4.demo.split.*

PW
Comment 11 Thomas Schindl CLA 2012-06-19 10:38:28 EDT
... and you need to launch your inner with "-rendererFactoryUri bundleclass://org.eclipse.e4.demo.split.renderer.swt/org.eclipse.e4.demo.split.renderer.swt.SplitRendererFactory"
Comment 12 Thomas Schindl CLA 2012-06-19 11:08:54 EDT
Dani, I've just tried:
a) Download RC4
b) Import:
   - org.eclipse.e4.demo.split.feature
   - org.eclipse.e4.demo.split.model
   - org.eclipse.e4.demo.split.renderer.swt
   - org.eclipse.e4.demo.split.renderer.wb
c) Create an inner launch config and pass
   -rendererFactoryUri
bundleclass://org.eclipse.e4.demo.split.renderer.swt/org.eclipse.e4.demo.split.renderer.swt.SplitRendererFactory
   as part of the Program Arguments

Did you tried it in an inner eclipse?
Comment 13 Dani Megert CLA 2012-06-19 11:18:04 EDT
(In reply to comment #12)
> Dani, I've just tried:
> a) Download RC4
> b) Import:
>    - org.eclipse.e4.demo.split.feature
>    - org.eclipse.e4.demo.split.model
>    - org.eclipse.e4.demo.split.renderer.swt
>    - org.eclipse.e4.demo.split.renderer.wb
> c) Create an inner launch config and pass
>    -rendererFactoryUri
> bundleclass://org.eclipse.e4.demo.split.renderer.swt/org.eclipse.e4.demo.split.renderer.swt.SplitRendererFactory
>    as part of the Program Arguments
> 
> Did you tried it in an inner eclipse?

I'll try that. I interpreted comment 1:
"This holds bundles which bring split-editors to an *unmodified* Eclipse 4.2
application."
as being able to just install the bundles into my host and go.
Comment 14 Thomas Schindl CLA 2012-06-19 11:34:08 EDT
Some useability notes:
* Closing of editors should be done using CTRL+W
* Dirty state marker on Tab is missing but CTRL+S works as expected
* Active Tab coloring not correct
Comment 15 Thomas Schindl CLA 2012-06-19 11:35:34 EDT
(In reply to comment #13)
> (In reply to comment #12)
> > Dani, I've just tried:
> > a) Download RC4
> > b) Import:
> >    - org.eclipse.e4.demo.split.feature
> >    - org.eclipse.e4.demo.split.model
> >    - org.eclipse.e4.demo.split.renderer.swt
> >    - org.eclipse.e4.demo.split.renderer.wb
> > c) Create an inner launch config and pass
> >    -rendererFactoryUri
> > bundleclass://org.eclipse.e4.demo.split.renderer.swt/org.eclipse.e4.demo.split.renderer.swt.SplitRendererFactory
> >    as part of the Program Arguments
> > 
> > Did you tried it in an inner eclipse?
> 
> I'll try that. I interpreted comment 1:
> "This holds bundles which bring split-editors to an *unmodified* Eclipse 4.2
> application."
> as being able to just install the bundles into my host and go.

Yeah it should but maybe the export was incorrect, ... - what you always have to do is to exchange the rendererFactoryUri until we merge those changes back into the main model and rendering framework.
Comment 16 Dani Megert CLA 2012-06-20 05:28:27 EDT
Works for me if launched from the dev workspace.

Pretty cool stuff!
Comment 17 Nobody - feel free to take it CLA 2012-06-20 10:35:30 EDT
Created attachment 217633 [details]
Enhancement

Proposes fixes two problems.

1. closing the part 
2. Also the context menus didn't appear when the tab header was clicked.

Issues:
Closing doesn't yet support multiple separations (divided in 3 or more parts). You have to click twice or more until I implement a better recursive algo.

Any feedback would be greatly appreciated.
Comment 18 Nobody - feel free to take it CLA 2012-06-20 16:04:56 EDT
Created attachment 217654 [details]
Enhancement

I see I had left something out (MPlacehoder check). This one is the patch I was talking about.
Comment 19 Eric Moffatt CLA 2012-07-09 13:51:58 EDT
Tom, we could augment the model to better support this don't you think ?

The simplest seems to me to be creating a new subclass of MPart, MCompositePart, which is also an MPartSashContainer. One thing we'll have to figure out is what 'active part' means when there can now be an 'active' *sub*-part.

Now that I'm back at it we should get together and see what other model improvements we can see.
Comment 20 Lars Vogel CLA 2013-01-24 02:49:13 EST
Changing the bug title to be a little more descriptive.
Comment 21 Lars Vogel CLA 2013-02-16 18:13:44 EST
*** Bug 400979 has been marked as a duplicate of this bug. ***
Comment 22 Eric Moffatt CLA 2013-06-17 14:20:08 EDT
Moving into Luna's bucket...
Comment 23 Eric Moffatt CLA 2013-07-29 13:54:51 EDT
Committed

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b92d880107a79f7a0c1bb0bc311e9ac3dfea2952

This adds MCompositePart to the model. It inherits from both MPart and MPartSashContainer.

Now we have to work out how nested parts work with our current 'active part' concept.
Comment 24 Eric Moffatt CLA 2013-07-29 15:00:23 EDT
BTW, the previous commit also updates the version to 1.1 from 1.0 in both the manifest & pom files...
Comment 25 Eric Moffatt CLA 2013-08-02 12:54:58 EDT
Committed

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=ac4572d1c89b229bf6354cf199cd49372b7e7ebe

This adds a new extension 'e4view' to the org.eclipse.ui.views extension point and changes the ViewRegistry code to recognize that the 'class' should be used as the contributionURI in the model (rather than CompatibilityView).

This is the first step but there is still work to do so I won't close this one yet...
Comment 26 Lars Vogel CLA 2013-08-04 17:47:40 EDT
Eric, great news, thank you. As a remark, I think your comment and commit is related to Bug 356511 and not this bug.
Comment 27 Eric Moffatt CLA 2013-08-07 10:52:00 EDT
Thanks Lars !
Comment 28 Eric Moffatt CLA 2013-08-07 10:52:36 EDT
Changing to 4.4 M2 to keep it on the radar...
Comment 29 Eric Moffatt CLA 2013-09-13 13:54:14 EDT
Moving to M3 where we should be able to scrounge up the time to work on this for Luna...
Comment 30 Eric Moffatt CLA 2013-10-23 15:52:04 EDT
Committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=dd1eb23f7a495613ae8b04a910b496900b0eca3b

This implements some of the tweaks needed to support the new model shapes introduced by add MCompositePart.

It also contains some work to support making e4 parts available in the IDE (i.e. by creating a ViewReference for it...).

While I do have a naive implementation of split editors (I'll attach a project containing the logic tomorrow) this doesn't mean that I"m ignoring Tom's implementation, it should be reviewed though to see if it can be simplified now...
Comment 31 Eric Moffatt CLA 2013-10-27 14:55:59 EDT
Created attachment 236938 [details]
ZIP of project to demonstrate the splitter


This works OK but is still somewhat flakey, don't be too hard on me...;-).

To use:

Import this ZIP as an existing project, run an inner
In the inner create a project so that you have editors to work with
Activate an editor

You'll see a new button that is white and looks like a stack (sort of)
Hitting it once will split the editor vertically, second hit will unsplit the editor and change the orientation of the split (i.e. it'll split the other way if you hit the button again).

Problems:

This seems to actually work better on non-recent builds; I tried it on 4.4.0.I20131001-0800 and had some issues where on unsplit the area would look empty...re-select the tab and everything comes back ok (this didn't happen on last week's build).

There are more issues with splitting views that have something to do with the placeholder rendering. When you split a view the initial display only shows the right / bottom view and the other is empty (a restart will show that the model is working).

You can minimize the stack containing the split part and it'll work as will re-opening a split editor (if it's already open and split it'll activate).
Comment 32 Lars Vogel CLA 2013-11-25 18:00:38 EST
(In reply to Eric Moffatt from comment #31)
> Created attachment 236938 [details]
> ZIP of project to demonstrate the splitter
> 
> 
> This works OK but is still somewhat flakey, don't be too hard on me...;-).
> 
> To use:
> 
> Import this ZIP as an existing project, run an inner
> In the inner create a project so that you have editors to work with
> Activate an editor
> 
> You'll see a new button that is white and looks like a stack (sort of)
> Hitting it once will split the editor vertically, second hit will unsplit
> the editor and change the orientation of the split (i.e. it'll split the
> other way if you hit the button again).

Shall this bug be marked as duplicate of Bug 8009? I assume the people in this bug will be happy to hear that the bug is planned to get addressed?
Comment 33 Dani Megert CLA 2013-11-26 08:51:26 EST
(In reply to Lars Vogel from comment #32)
> Shall this bug be marked as duplicate of Bug 8009? I assume the people in
> this bug will be happy to hear that the bug is planned to get addressed?

This bug describes a more general feature. Let's see how it helps to fix bug 8009 and only then we can mark bug 8009 as duplicate of this one here.
Comment 34 Eric Moffatt CLA 2013-12-02 11:06:51 EST
+1 for Dani's comment. I'm in the act of updating the project to fit it into the correct API / UI code slots, something like this:

For this pass the split behavior is a toggle; split if the tag is set, otherwise unsplit:

1) Move the code to change the model into the EModelService as 'splitPart' API

2) Add a new SplitPartAddon that listens for a new tag "Split" being added / removed and calls the new EMS API.

3) Add a new parameterized command so that we can provide key bindings...if they're available I'd love to provide an initial binding of '_' (split vertically) and '|' (split horizintally).

Not sure if this feature would be used often enough to warrant having its own tool items on the top toolbar ??
Comment 35 Eric Moffatt CLA 2013-12-09 15:12:20 EST
Ok then...committed:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=08bf5891e0cee093e0c47da2f16c2d0886faf9a8

This does pretty much what my previous comment says; adds a new addon to manage splitting and then adds the IDE command hooks necessary to invoke it within Eclipse.

For now there are only key bindings; 
  Ctrl + '_' is split horizontally and Ctrl + '{' is split vertically

Just as a side note does anybody know why trying to use Ctrl + '|' fails ? I tried to use it for the vertical split but it never gets executed...

I'm going to mark this one as FIXED. We should open new defects for further work (like having the MCompositePart adopt the original part's menu / tb definitions so that split parts still have their menu/tb in the stack (I didn't need this immediately since editors never have these but we'll need them for a proper e4 'split part' story).
Comment 36 Eric Moffatt CLA 2013-12-09 15:17:28 EST
BTW, its possible to style the color of the splitter (sash) inside the split editor just by styling the MCompositePart:

.MCompositePart {
    background-color: #888888; 
}

While this works OK for most editors the PDE form based editors unfortunately also show this color on the inactive tabs. We might want to look at how to properly style here since there are no stack borders to indicate where the sashes are they're hard to locate with just white on white...
Comment 37 Paul Webster CLA 2013-12-10 09:08:44 EST
Added http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=d22d938623588b5da861bf7a2bc803399a66d0c9 to export the new package and add upversion the bundle

PW
Comment 38 Lars Vogel CLA 2013-12-12 06:50:48 EST
The editor shortcuts do not seem to work always. If I create a new Class and change the name in the editor, e.g. from Test to "Tesst" I cannot involve Ctrl+1 directly. I need to set focus on another part and select the splitted editor again to make shortcuts work again.
Comment 39 Lars Vogel CLA 2013-12-12 06:52:04 EST
Created attachment 238285 [details]
Screenshot for split editor
Comment 40 Paul Webster CLA 2013-12-12 06:52:54 EST
Markus already opened bug 423894
Comment 41 Lars Vogel CLA 2013-12-12 07:00:11 EST
(In reply to Paul Webster from comment #40)
> Markus already opened bug 423894

Thanks Paul. Other than the issues reported in the new bug, split editor works for me. Verified in Build id: I20131211-2000
Comment 42 Lars Vogel CLA 2013-12-12 08:51:36 EST
(In reply to Paul Webster from comment #40)
> BTW, its possible to style the color of the splitter (sash) inside the split
> editor just by styling the MCompositePart:
> 
> .MCompositePart {
>     background-color: #888888; 
> }
> 
> While this works OK for most editors the PDE form based editors
> unfortunately also show this color on the inactive tabs. We might want to
> look at how to properly style here since there are no stack borders to
> indicate where the sashes are they're hard to locate with just white on
> white...

Opened Bug 423918 for that.
Comment 43 Lars Vogel CLA 2013-12-12 09:26:45 EST
*** Bug 8009 has been marked as a duplicate of this bug. ***
Comment 44 Paul Verest CLA 2014-02-07 09:04:22 EST
(In reply to Eric Moffatt from comment #35)
... 
> For now there are only key bindings; 
>   Ctrl + '_' is split horizontally and Ctrl + '{' is split vertically
> 
> Just as a side note does anybody know why trying to use Ctrl + '|' fails ? I
> tried to use it for the vertical split but it never gets executed...

up. Ctrl + '{' has no association with vertical.
Ctrl + '{' and Ctrl + '}' should be used for searching matching brackets or similar. Raise an issue ?

And of course thanks so much for making it.
Comment 45 Markus Keller CLA 2014-02-07 11:15:39 EST
> Just as a side note does anybody know why trying to use Ctrl + '|' fails ? I
> tried to use it for the vertical split but it never gets executed...

On Windows with a US keyboard layout, "Ctrl+|" is actually "Ctrl+Shift+\".
But in a Java editor, this is already bound to "Source > Remove Block Comment". This action just does nothing if the caret is not inside a /*block comment*/. In plain text editors, "Ctrl+Shift+\" does split the editor for me.

In JDT, the "Add/Remove Block Comment" commands have been mapped to "Ctrl+Shift+/" and "Ctrl+Shift+\" forever. I would not remove/change the latter lightly. And I actually like that the two Split Editor commands use adjacent keys.
Comment 46 Paul Verest CLA 2014-02-13 10:40:29 EST
(In reply to Markus Keller from comment #45)
> > Just as a side note does anybody know why trying to use Ctrl + '|' fails ? I
> > tried to use it for the vertical split but it never gets executed...
> 
> On Windows with a US keyboard layout, "Ctrl+|" is actually "Ctrl+Shift+\".
> But in a Java editor, this is already bound to "Source > Remove Block
> Comment". This action just does nothing if the caret is not inside a /*block
> comment*/. In plain text editors, "Ctrl+Shift+\" does split the editor for
> me.
> 
> In JDT, the "Add/Remove Block Comment" commands have been mapped to
> "Ctrl+Shift+/" and "Ctrl+Shift+\" forever. I would not remove/change the
> latter lightly. And I actually like that the two Split Editor commands use
> adjacent keys.

Thank you Markus. Now it can be understood.
Never used "Ctrl+Shift+\" before (but "Ctrl+Shift+/").