Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF Parsley » Define a ViewerContentProvider for each TreeFormView
Define a ViewerContentProvider for each TreeFormView [message #1838019] Sat, 13 February 2021 09:24 Go to next message
Jean-Baptiste Meyer is currently offline Jean-Baptiste MeyerFriend
Messages: 16
Registered: February 2021
Junior Member
Hello,

I'm discovering Parsley which is a very good project.
I setuped a project with RAP, and I created several entry points to display different perspectives and views.
I'm loading the same object from an xmi in a configurator defined in an EmfParsleyGuiceModule.

What I would like to to is to filter this big EObject depending the TreeFormView.
My problem is that ViewerContentProvider that I defined is defined in my EmfParsleyGuiceModule which is project wide so, I cannot make my filtering on views like I want.
Is there a solution to have a different content provider for each TreeFormView I defined ?
I'm attaching a schema of the architecture I would like to reach.

Thank you
Re: Define a ViewerContentProvider for each TreeFormView [message #1838063 is a reply to message #1838019] Mon, 15 February 2021 07:39 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi
if you need different customizations, then you need different Guice Modules.
You can have another Guice Module in the same project. If you use the DSL you can have several DSL files in the same project. When you specify something like a content provider, you can specify that it extends an existing one, in case you want to reuse something.
Is that what you meant?
cheers
Lorenzo


Re: Define a ViewerContentProvider for each TreeFormView [message #1838073 is a reply to message #1838063] Mon, 15 February 2021 12:25 Go to previous messageGo to next message
Jean-Baptiste Meyer is currently offline Jean-Baptiste MeyerFriend
Messages: 16
Registered: February 2021
Junior Member
Hello Lorenzo,

Thanks for your fast answer. This is exactly what I want. But how to use the other Guice Module for a given SaveableTreeFormView ? Shall we inject it in the TreeFormView like the following code ? Is there another way to map the Guice Module to use and the given view ?
import com.google.inject.Inject;

public class Example1SaveableTreeFormView extends org.eclipse.emf.parsley.views.SaveableTreeFormView {
	@Inject
	private EmfParsleyGuiceModule1 module;
}
import com.google.inject.Inject;

public class Example2SaveableTreeFormView extends org.eclipse.emf.parsley.views.SaveableTreeFormView {

	@Inject
	private EmfParsleyGuiceModule2 module;
}




Thanks a lot


[Updated on: Mon, 15 February 2021 12:26]

Report message to a moderator

Re: Define a ViewerContentProvider for each TreeFormView [message #1838082 is a reply to message #1838073] Mon, 15 February 2021 14:52 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
No, you should not inject a Guice Module: you should create an injector from a Guice Module and then create your components with that injector. (please, make sure you also read the section "Dependency Injection With Google Guice" in the documentation, https://www.eclipse.org/emf-parsley/documentation.html).
The easiest thing to do is to create a DSL file, where you also define your view; similar to the one you created with the wizard (assuming you have already started with a wizard).


Re: Define a ViewerContentProvider for each TreeFormView [message #1838083 is a reply to message #1838082] Mon, 15 February 2021 14:53 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
I mean that by using the DSL you get for free all the infrastructure that creates an Eclipse view via injection and using all the customizations specified in that specific DSL file.

Re: Define a ViewerContentProvider for each TreeFormView [message #1838084 is a reply to message #1838083] Mon, 15 February 2021 15:07 Go to previous messageGo to next message
Jean-Baptiste Meyer is currently offline Jean-Baptiste MeyerFriend
Messages: 16
Registered: February 2021
Junior Member
Hello, yes I was going to reply when you provided additional input.
I created several dsl *.parsley files with the different configuration needed and it works like a charm !
Thanks a lot for your help. EMF Parsley is really great !
Re: Define a ViewerContentProvider for each TreeFormView [message #1838113 is a reply to message #1838084] Tue, 16 February 2021 10:14 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Thank you for the feedback! :)

Previous Topic:Parsley Editor Example/Tutorial
Next Topic:ChangeRecorder cannot be found by org.eclipse.emf.edit
Goto Forum:
  


Current Time: Thu Mar 28 15:32:34 GMT 2024

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

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

Back to the top