Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Content of TrimmedWindow gets MainWindow added when adding it to Application
Content of TrimmedWindow gets MainWindow added when adding it to Application [message #1836254] Sat, 26 December 2020 17:05 Go to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1583
Registered: January 2014
Senior Member

I think before explaining my problem I should point out my use case. And I guess I most probably I'm doing something wrong or solving my problem with the wrong tools.

What I want to do is that I have an Eclipse RCP (4diac IDE on the compatibility layer, 2020-12) and I want to have a separate window. In this separate window there should be a few forms and the console view. So far I have solved the problem with an own perspective and opening a second workbench window with that perspective. While this was a quick solution it feels not good. The biggest problem is that the perspective is also available in the main workbench window, which is what we want to forbid.

After some research and lots of reading I found that my problem could be nicely solved with an E4 snippet. So I created an model fragment, created a snippet there with my parts and also was able to get the console view in. I also managed to open that window from an handlers.

So far so good.

However my problem now is that after I clone the snippet in my handler I have to add it to my Application. During the add process my correct TrimmWindow is now extended with the elements from the already running main workbench window. I'm expecting that I have an issue in my model fragment (see below). But I have no clue what it could be. Therefore I would be very happy for any tips to get me back on track.

Alois

<fragment:ModelFragments xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmi:id="_yi6ZoEdmEeuRhIOBaMMvFw">
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_1n-tIEdmEeuRhIOBaMMvFw" featurename="snippets" parentElementId="org.eclipse.e4.legacy.ide.application">
    <elements xsi:type="basic:TrimmedWindow" xmi:id="_8runQEdnEeuRhIOBaMMvFw" elementId="org.eclipse.fordiac.ide.runtime.trimmedwindow.simulateddevicesmanager" visible="false" selectedElement="_9hMaMEdoEeuRhIOBaMMvFw" label="Simulated Devices Manager">
      <children xsi:type="basic:PartSashContainer" xmi:id="_9hMaMEdoEeuRhIOBaMMvFw" elementId="org.eclipse.fordiac.ide.runtime.partsashcontainer.0">
        <children xsi:type="basic:Part" xmi:id="_VWyWUEdpEeuRhIOBaMMvFw" elementId="org.eclipse.fordiac.ide.runtime.part.launchsimulateddevices" contributionURI="bundleclass://org.eclipse.fordiac.ide.runtime/org.eclipse.fordiac.ide.runtime.views.RuntimeLauncherViewPart" label="Launch Simulated Devices"/>
        <children xsi:type="basic:PartSashContainer" xmi:id="_FjHpQEdpEeuRhIOBaMMvFw" elementId="org.eclipse.fordiac.ide.runtime.partsashcontainer.1" accessibilityPhrase="bottom" horizontal="true">
          <children xsi:type="basic:Part" xmi:id="_NKVSQEdpEeuRhIOBaMMvFw" elementId="org.eclipse.fordiac.ide.runtime.part.startedsimulateddevices" contributionURI="bundleclass://org.eclipse.fordiac.ide.runtime/org.eclipse.fordiac.ide.runtime.views.RuntimesView" label="Started Simulated Devices"/>
          <children xsi:type="basic:PartStack" xmi:id="_1dPNAEd3EeuRhIOBaMMvFw" elementId="org.eclipse.fordiac.ide.runtime.consoleContainer" accessibilityPhrase="consoleContainer">
            <children xsi:type="advanced:Placeholder" xmi:id="_8gn4kEdpEeuRhIOBaMMvFw" elementId="org.eclipse.ui.console.ConsoleView" ref="_DHSpoBkCEea2ENFkqfwc7g"/>
          </children>
        </children>
      </children>
    </elements>
  </fragments>
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_gg_gwEdwEeuRhIOBaMMvFw" featurename="sharedElements" parentElementId="IDEWindow">
    <elements xsi:type="basic:Part" xmi:id="_DHSpoBkCEea2ENFkqfwc7g" elementId="org.eclipse.ui.console.ConsoleView" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" label="Console" iconURI="platform:/plugin/org.eclipse.ui.console/icons/full/cview16/console_view.png"/>
  </fragments>
</fragment:ModelFragments>



Re: Content of TrimmedWindow gets MainWindow added when adding it to Application [message #1836266 is a reply to message #1836254] Sun, 27 December 2020 12:28 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 260
Registered: April 2012
Senior Member
Probably you have triggered a feature/bug in Eclipse. I just created a new toplevel Trimmed Window with the model spy in Eclipse, when this windows gains focus it is populated as a Eclipse window.

Instead of creating another top-level window, you can add a child-window to the existing top-level trimmed window. Similarly to how you add the part to the 'sharedElements' attribute of the IDEWindow, you can add the new trimmed window to the 'windows' attribute of the top-level window.
Re: Content of TrimmedWindow gets MainWindow added when adding it to Application [message #1836299 is a reply to message #1836266] Mon, 28 December 2020 17:39 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1583
Registered: January 2014
Senior Member

Thanks for pointing me to the to add the new window as child of the windows of our main window. While this first of all works now perfectly it also better resembles the intention I had in mind with this code snippet.
Previous Topic:[SOLVED] - Eclipse 4 product migration from Oxygen to Eclipse 2020-06 : ClassNotFoundException
Next Topic:Main toolbar enable state is not updating
Goto Forum:
  


Current Time: Sat Apr 20 03:19:42 GMT 2024

Powered by FUDForum. Page generated in 0.02983 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top