Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Adding 3.x ViewParts to E4XMI
Adding 3.x ViewParts to E4XMI [message #881270] Mon, 04 June 2012 08:56 Go to next message
Philipp Arnold is currently offline Philipp ArnoldFriend
Messages: 2
Registered: June 2012
Junior Member
Hi Everybody,

this is just a quick and possibly easy to answer question, unfortunately I wasn't able to find much about this.

Is there an easy and straight forward way to add 3.x ViewParts to the E4XMI application model, while using the compatibility layer (especially using the E4 Workbench Model Editor)?

Thank you very much for your help!
Re: Adding 3.x ViewParts to E4XMI [message #881274 is a reply to message #881270] Mon, 04 June 2012 09:09 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6254
Registered: July 2009
Senior Member
You could try (but I never tried this myself) and take a look how the
XMI-Elements produced by the compat layer look like when a view is
opened through it.

An important fact is that e3 views are stored in the shared elements of
your window and then then linked into a perspective using Placeholders!

Tom

Am 04.06.12 10:56, schrieb Philipp Arnold:
> Hi Everybody,
>
> this is just a quick and possibly easy to answer question, unfortunately
> I wasn't able to find much about this.
>
> Is there an easy and straight forward way to add 3.x ViewParts to the
> E4XMI application model, while using the compatibility layer (especially
> using the E4 Workbench Model Editor)?
>
> Thank you very much for your help!
Re: Adding 3.x ViewParts to E4XMI [message #881287 is a reply to message #881270] Mon, 04 June 2012 09:34 Go to previous messageGo to next message
Philipp Arnold is currently offline Philipp ArnoldFriend
Messages: 2
Registered: June 2012
Junior Member
Hi Thomas,

thanks for your help. That indeed did the trick.

I just created a new shared element, using "bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" as class URI while referencing the unique ID of the 3.x ViewParts class. I then used that shared element as reference for a placeholder which I put in place of the original part and everything works as expected.

Again, thank you very much for your quick reply. I really appreciate it.

Cheers Philipp.
Re: Adding 3.x ViewParts to E4XMI [message #932491 is a reply to message #881287] Thu, 04 October 2012 06:33 Go to previous messageGo to next message
Georges Bachelier is currently offline Georges BachelierFriend
Messages: 29
Registered: May 2010
Junior Member
Hi Philipp and Thomas !

I am writing an E4 RCP application in which I want to add regular Eclipse views such as Console and Error Log. I did the following in the Application.e4xmi file:

1 - Add a PartDescriptor to the Part Descriptors section with:
Id = org.eclipse.ui.console.ConsoleView
Label = Console
Class URI = bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView


2 - Add a Part to the Shared Elements section with the same parameters as above.

3 - Add a Placeholder in the Perspective section with:
Id = org.eclipse.ui.console.ConsoleView
Reference = Part - Console


Things seem to be declared like they appear in the model editor of Juno itself.
But, when I launch my application, I get the following error messages:
!ENTRY org.eclipse.e4.ui.workbench 4 0 2012-10-04 08:10:01.167
!MESSAGE Unable to create class 'org.eclipse.ui.internal.e4.compatibility.CompatibilityView' from bundle '229'
!STACK 0
org.eclipse.e4.core.di.InjectionException: Could not find satisfiable constructor in org.eclipse.ui.internal.e4.compatibility.CompatibilityView
	at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:327)


Can you help me to fix this, please ?

Georges
Re: Adding 3.x ViewParts to E4XMI [message #972206 is a reply to message #932491] Mon, 05 November 2012 12:45 Go to previous messageGo to next message
Philipp M. Fischer is currently offline Philipp M. FischerFriend
Messages: 66
Registered: November 2010
Location: Germany
Member
Hi Georges,

I do have the same problem. I started by using the wizard to create a simple E4-Application example. I then tried to add an old Eclipse3 view to. Im failing with the same error messages you got. Do you have any solution to that issue?

Cheers

Phil
Re: Adding 3.x ViewParts to E4XMI [message #972343 is a reply to message #972206] Mon, 05 November 2012 14:55 Go to previous messageGo to next message
Philipp M. Fischer is currently offline Philipp M. FischerFriend
Messages: 66
Registered: November 2010
Location: Germany
Member
Allright.... I found some answer by myself. Instead of creating an E4 RCP Application using an E3 RCP APplication it works. I just defined the E3 App to use the e4xmi model. Still I am not sure about the implications doing it this way :-/

Cheers

Phil
Re: Adding 3.x ViewParts to E4XMI [message #1732196 is a reply to message #972343] Fri, 13 May 2016 11:41 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 480
Registered: July 2009
Location: Germany ✈ Vancouver
Senior Member

Quick questions, has anyone tried this using a fragment?

I'm trying to contribute a perspective as fragment to the 'org.eclipse.e4.legacy.ide.application'. I do get the empty perspective to show up. I also do get to add parts to it. However, I'm sort of stuck adding placeholders for things like the editor area and existing views. It doesn't even work for views contributed as e4 fragment as well. The trouble seems to be the references. The fragment model does not have any visibility to shared elements. Thus, I'm unable to select any reference in the e4 model editor.

Does anyone have any tips how to add the editor area and other views to such a contributed perspective? Is placeholders the right approach or should I add parts and area directly?
Re: Adding 3.x ViewParts to E4XMI [message #1732200 is a reply to message #1732196] Fri, 13 May 2016 11:48 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2274
Registered: July 2012
Senior Member
Do you know this: https://dirksmetric.wordpress.com/2012/08/01/tutorial-eclipse-rcp-e4-with-3-x-views-like-project-explorer-properties-etc/

Are you aware that you need to contribute a perspective to a compat layer via snippet instead of a perspective to the perspective stack?
Re: Adding 3.x ViewParts to E4XMI [message #1732204 is a reply to message #1732200] Fri, 13 May 2016 12:25 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 480
Registered: July 2009
Location: Germany ✈ Vancouver
Senior Member

Thanks, I figured that out earlier today through various postings. However, the part that's also not document is how to get placeholders working. Thanks to the link you provided, I now made a bit more progress.

That's what I have in my fragment which sort of works:
<?xml version="1.0" encoding="ASCII"?>
<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/descriptor/basic" xmlns:basic_1="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:fragment="http://www.eclipse.org/ui/2010/UIModel/fragment" xmi:id="_BxaXACerEeWxCPrV0pAZQQ">
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_EI7oACerEeWxCPrV0pAZQQ" featurename="descriptors" parentElementId="xpath:/">
    <elements xsi:type="basic:PartDescriptor" xmi:id="_KMklcCerEeWxCPrV0pAZQQ" elementId="gunnars.ide.views.toolbelt" label="Toolbelt Commands" iconURI="platform:/plugin/gunnars.ide/icon16.png" tooltip="" category="Gunnar" contributionURI="bundleclass://gunnars.ide/gunnars.ide.cli.parts.ToolbeltView">
      <tags>View</tags>
      <tags>categoryTag:Gunnar</tags>
    </elements>
  </fragments>
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_fqQIEBjnEeaRNZC3Vs8uvw" featurename="snippets" parentElementId="org.eclipse.e4.legacy.ide.application" positionInList="">
    <elements xsi:type="advanced:Perspective" xmi:id="_guJ1EBjnEeaRNZC3Vs8uvw" elementId="gunnars.ide.perspective.appcloud" label="Gunnar's View" iconURI="platform:/plugin/gunnars.ide/icon16.png">
      <children xsi:type="basic_1:PartSashContainer" xmi:id="_jJuvkBj7Eea2ENFkqfwc7g" elementId="gunnars.ide.partsashcontainer.0">
        <children xsi:type="basic_1:PartSashContainer" xmi:id="_xRfUcBj7Eea2ENFkqfwc7g" elementId="top" containerData="75" horizontal="true">
          <children xsi:type="basic_1:PartStack" xmi:id="_zrPaEBj7Eea2ENFkqfwc7g" elementId="gunnars.ide.partstack.0" containerData="26">
            <children xsi:type="advanced:Placeholder" xmi:id="_sDtHUBkDEea2ENFkqfwc7g" elementId="org.eclipse.ui.navigator.ProjectExplorer" ref="_Ww7GMBkDEea2ENFkqfwc7g"/>
            <children xsi:type="advanced:Placeholder" xmi:id="_ydjI0BkEEea2ENFkqfwc7g" elementId="org.eclipse.egit.ui.RepositoriesView" ref="_cVUtcBkEEea2ENFkqfwc7g"/>
          </children>
          <children xsi:type="advanced:Placeholder" xmi:id="_m8LewBkBEea2ENFkqfwc7g" elementId="org.eclipse.ui.editorss" containerData="74" ref="_S91hABkBEea2ENFkqfwc7g"/>
        </children>
        <children xsi:type="basic_1:PartSashContainer" xmi:id="_orGtcBj7Eea2ENFkqfwc7g" elementId="bottom" containerData="25" horizontal="true">
          <children xsi:type="advanced:Placeholder" xmi:id="_Biv4QBkDEea2ENFkqfwc7g" elementId="gunnars.ide.part.toolbelt" containerData="26" ref="_yWl3IBkCEea2ENFkqfwc7g"/>
          <children xsi:type="advanced:Placeholder" xmi:id="_J0-poBkCEea2ENFkqfwc7g" elementId="org.eclipse.ui.console.ConsoleView" containerData="74" ref="_DHSpoBkCEea2ENFkqfwc7g"/>
        </children>
      </children>
    </elements>
  </fragments>
  <fragments xsi:type="fragment:StringModelFragment" xmi:id="_zLGvMBkAEea2ENFkqfwc7g" featurename="sharedElements" parentElementId="IDEWindow">
    <elements xsi:type="advanced:Area" xmi:id="_S91hABkBEea2ENFkqfwc7g" elementId="org.eclipse.ui.editorss" label="Editor Area">
      <children xsi:type="basic_1:PartStack" xmi:id="_asB7wBkBEea2ENFkqfwc7g" elementId="org.eclipse.e4.primaryDataStack">
        <tags>org.eclipse.e4.primaryDataStack</tags>
        <tags>EditorStack</tags>
      </children>
    </elements>
    <elements xsi:type="basic_1: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"/>
    <elements xsi:type="basic_1:Part" xmi:id="_yWl3IBkCEea2ENFkqfwc7g" elementId="gunnars.ide.part.toolbelt" contributionURI="bundleclass://gunnars.ide/gunnars.ide.cli.parts.ToolbeltView" label="Toolbelt Commands" iconURI="platform:/plugin/gunnars.ide/icon16.png"/>
    <elements xsi:type="basic_1:Part" xmi:id="_Ww7GMBkDEea2ENFkqfwc7g" elementId="org.eclipse.ui.navigator.ProjectExplorer" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" label="Project Explorer" iconURI="platform:/plugin/org.eclipse.ui.ide.application/icons/full/eview16/resource_persp.png"/>
    <elements xsi:type="basic_1:Part" xmi:id="_cVUtcBkEEea2ENFkqfwc7g" elementId="org.eclipse.egit.ui.RepositoriesView" contributionURI="bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" label="Git Repositories" iconURI="platform:/plugin/org.eclipse.egit.ui/icons/eview16/repo_rep.gif"/>
  </fragments>
</fragment:ModelFragments>



The trick is to define a fragment which adds things to the "sharedElements" of "IDEWindow". However, I'm unsure if this approach is sane, i.e. will it create duplicate shared elements?
Re: Adding 3.x ViewParts to E4XMI [message #1732205 is a reply to message #1732204] Fri, 13 May 2016 12:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2274
Registered: July 2012
Senior Member
Could you import shared elements?
Re: Adding 3.x ViewParts to E4XMI [message #1732208 is a reply to message #1732205] Fri, 13 May 2016 12:56 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 480
Registered: July 2009
Location: Germany ✈ Vancouver
Senior Member

Dirk Fauth wrote on Fri, 13 May 2016 12:28
Could you import shared elements?


I don't know. The model editor in Neon does not give me an option in the drop-down to import a shared element.

Importing a "Part" does not work. There are none and/or the ones created by the compatibility layer are not visible to the model editor. I'm also not sure if the compatibility layer uses stable xmi ids that would work as stable references.

index.php/fa/25902/0/

[Updated on: Fri, 13 May 2016 13:06]

Report message to a moderator

Re: Adding 3.x ViewParts to E4XMI [message #1740537 is a reply to message #881287] Mon, 15 August 2016 14:06 Go to previous message
Jason Trinidad is currently offline Jason TrinidadFriend
Messages: 3
Registered: August 2016
Junior Member
Quote:

I just created a new shared element, using "bundleclass://org.eclipse.ui.workbench/org.eclipse.ui.internal.e4.compatibility.CompatibilityView" as class URI while referencing the unique ID of the 3.x ViewParts class. I then used that shared element as reference for a placeholder which I put in place of the original part and everything works as expected.


How did you do this? Did you right click on the project, then New -> Other... then what did you choose? Thanks. IS Eclipse supposed to generate an e4xmi for you?
Previous Topic:Persisted object when closing MPart ?
Next Topic:Styling tabs of MParts
Goto Forum:
  


Current Time: Thu Sep 29 20:48:56 GMT 2016

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

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