title: Eclipse RCP - Open a View in the Editor Area (3.8/e4 hybrid)
body: <p>I'm working on a 3.8-e4 hybrid (i.e we have the Luna dependencies, but we <b>do not</b> use the <em>Application.e4xmi</em>, yet). So we're basically running the compact layer.</p>
  
  <p>With that being said, it would be nice to find an e4 programmatic way to stack these nasty views onto the editor folder.</p>
  
  <hr>
  
  <h2>1.) Problem</h2>
  
  <p>I want to place a generic view folder in the editor area, so that each view which is opened at runtime will be opened there. </p>
  
  <p><img src="https://i.stack.imgur.com/zHcn8.png" alt="View in editor folder"></p>
  
  <p><i>(pic stolen from <a href="https://stackoverflow.com/questions/2758642/eclipse-rcp-stacking-a-view-with-the-editor-area">this question</a>)</i></p>
  
  <hr>
  
  <h2>2.1) Possible fix no.1: Using plugin.xml</h2>
  
  <p>Create a perspective extension, and add each possible view to that extension, with <b>relationship stack</b> over <b>relative org.eclipse.ui.editorss</b>. This is a bit inconvenient if you have too many views awating to be opened, and if the project scales quickly. I also noticed that wildcard view IDs do not work here.</p>
  
  <p><img src="https://i.stack.imgur.com/veJDE.png" alt="SS of the plugin.xml with perspective extensions"></p>
  
  <p>If you find yourself the time to add each possible view to the perspective extension, that would work. Although, IF you open a view which is not added here (ie: opens in a different folder), then each subsequent opened view will be opened in the previous folder, and NOT in the editor area (inquire further explanation if you don't get it).</p>
  
  <hr>
  
  <h2>2.2) Possible fix no.2: Using code in the perspective factory</h2>
  
  <p>In the <code>IPerspectiveFactory</code>, we do have access to the <code>IPageLayout</code>, which happens to be <code>org.eclipse.ui.internal.e4.compatibility.ModeledPageLayout</code> (e4 stuff). </p>
  
  <p>Now, this <code>ModeledPageLayout</code> implementation is reasonable, but also no documentation and weird public APIs. This one gives the possibility to stack a view over any other relative</p>
  
  <pre><code>modeledPageLayout.stackView("newView0", IPageLayout.ID_EDITOR_AREA);
  </code></pre>
  
  <p>This would be the programmatic version of <b>2.1</b>. Also, the same problem appears here. If a view is opened somewhere else, the code above becomes useless.</p>
  
  <p>Interesting enough, the <code>stackView</code> API does not support wildcards (while others such as <code>addView</code> do).</p>
  
  <hr>
  
  <h2>2.3) Possible fix no.3: Workarounds yaaay!</h2>
  
  <p>I have a lot of perspectives, and a lot of different folders in each one. Everything is precisely placed. </p>
  
  <p>Since Eclipse offers the APIs to get all the view IDs from everywhere around the system, I want to do the following, per perspective: <b>each view ID which wasn't added to a specific folder will be appended to the editor area (ie editor folder, editor stack)</b>. </p>
  
  <p>This would be my last resort, unless someone offers a more convenient and timesaving solution.</p>
  
  <p>Remember, an e4 programmatic alternative is more flexible!</p>
  
  <hr>
  
  <h2>3.) Related questions</h2>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/21382848/eclipse-rcp-open-view-in-editor-folder">Eclipse RCP -- Open View in Editor folder</a></li>
  <li><a href="https://stackoverflow.com/questions/2758642/eclipse-rcp-stacking-a-view-with-the-editor-area">Eclipse  RCP - Stacking a view with the editor area? </a></li>
  <li><a href="https://stackoverflow.com/questions/22921306/custom-eclipse-perspective-with-initially-invisble-view-stacked-to-editor-area">Custom Eclipse perspective, with initially invisble view stacked to editor area</a></li>
  <li><a href="https://groups.google.com/forum/#!topic/vogella/_2yEZMg8epk" rel="noreferrer">Google question, Lars answer</a></li>
  </ul>
  
  <p>These would be rendered deprecated for the e4 release.</p>
  
  <hr>
  
  <h2>4.) Related Bug on Eclipse's Bugzilla:</h2>
  
  <p><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=450854" rel="noreferrer">This recent bug opened by myself</a> has an attachment with a small SSCCE. The steps to reproduce this are described in <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=450854#c2" rel="noreferrer">this comment</a>, so I'm not going to copy-paste them here.</p>