Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » ViewModelFileExtensionsManager singleton
ViewModelFileExtensionsManager singleton [message #1427226] Fri, 19 September 2014 22:40 Go to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hey,

is there a reason why the ViewModelFileExtensionsManager is a singelton instance? Is there another possibility to change a viewmodel (.view) dynamic or live at runtime. Would the extension manager no singleton then you can change the view live at runtime.
public final class ViewModelFileExtensionsManager {
	private static ViewModelFileExtensionsManager instance;

	public static ViewModelFileExtensionsManager getInstance() {
		if (instance == null) {
			instance = new ViewModelFileExtensionsManager();
			instance.init();
		}
		return instance;
	}


Thanks Smile
Re: ViewModelFileExtensionsManager singleton [message #1428211 is a reply to message #1427226] Sun, 21 September 2014 13:08 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

the view model file extension manager is just one mechnism to retrieve
view models. You can also directly pas them to the renderer
(#render(Composite parent, EObject domainObject, VView viewModel))
Therefore you can pick up any view model you want. Does this solve your
use case?

Best regards

Jonas

Am 20.09.2014 00:40, schrieb Sir Wayne:
> Hey,
>
> is there a reason why the ViewModelFileExtensionsManager is a singelton
> instance? Is there another possibility to change a viewmodel (.view)
> dynamic or live at runtime. Would the extension manager no singleton
> then you can change the view live at runtime.
>
> public final class ViewModelFileExtensionsManager {
> private static ViewModelFileExtensionsManager instance;
>
> public static ViewModelFileExtensionsManager getInstance() {
> if (instance == null) {
> instance = new ViewModelFileExtensionsManager();
> instance.init();
> }
> return instance;
> }
>
>
> Thanks :)
Re: ViewModelFileExtensionsManager singleton [message #1428892 is a reply to message #1428211] Mon, 22 September 2014 14:11 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hi Jonas,

thanks for the quick reply.
I change the viewmodel and save the xmi file at runtime. I rerender the ui e.g. close the view and reopen it, but the "old" model view is rendered. I want the similar behavior like the refresh action in the view editor preview.
Re: ViewModelFileExtensionsManager singleton [message #1429327 is a reply to message #1428892] Tue, 23 September 2014 05:02 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

if you want to save the view model at runtime, the original location (in
the bundle) is probably not a good place anyway. You should rather save
it somewhere in the workspace. Therefore, I suggest you use the
signature to pass the view model explicitly and load the view model
yourself.
Would that be a suitable solution?

Best regards

Jonas

Am 22.09.2014 16:11, schrieb Sir Wayne:
> Hi Jonas,
>
> thanks for the quick reply.
> I change the viewmodel and save the xmi file at runtime. I rerender the
> ui e.g. close the view and reopen it, but the "old" model view is
> rendered. I want the similar behavior like the refresh action in the
> view editor preview.
Re: ViewModelFileExtensionsManager singleton [message #1429433 is a reply to message #1429327] Tue, 23 September 2014 08:17 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Ok i'll try it, but what is the difference: I load the view model myself or i remove the singelton manager? If I remove the singelton instance, i can save and load the model at runtime.
This works well
Re: ViewModelFileExtensionsManager singleton [message #1430325 is a reply to message #1429433] Wed, 24 September 2014 08:54 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Hi,

sorry, I think I understand now, what you mean. AFAIK, the Manager
caches loaded view models. This would not be possible, if we reload it
everytime, we retrieve a view model. I think loading the same view
models is the default case, so I would like to keep that. But there
could be an option to turn the caching of.

Best regards

Jonas

Am 23.09.2014 10:17, schrieb Sir Wayne:
> Ok i'll try it, but what is the difference: I load the view model myself
> or i remove the singelton manager? If I remove the singelton instance, i
> can save and load the model at runtime. This works well
Re: ViewModelFileExtensionsManager singleton [message #1430657 is a reply to message #1430325] Wed, 24 September 2014 16:14 Go to previous messageGo to next message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
Hi,

this option would be perfect Cool

Re: ViewModelFileExtensionsManager singleton [message #1431109 is a reply to message #1430657] Thu, 25 September 2014 08:09 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
Could you open a BR for this?


Am 24.09.2014 18:14, schrieb Sir Wayne:
> Hi,
>
> this option would be perfect 8)
>
>
Re: ViewModelFileExtensionsManager singleton [message #1431845 is a reply to message #1431109] Fri, 26 September 2014 08:12 Go to previous message
Dennis Melzer is currently offline Dennis MelzerFriend
Messages: 244
Registered: July 2009
Senior Member
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=445172
Previous Topic:[TEXO] Memory management
Next Topic:Use of EMF Model code in J2EE
Goto Forum:
  


Current Time: Tue Mar 19 08:33:14 GMT 2024

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

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

Back to the top