Skip to main content



      Home
Home » Modeling » EMF » Update the model view after model changes
Update the model view after model changes [message #1731726] Mon, 09 May 2016 10:53 Go to next message
Eclipse UserFriend
Hi,

I create my emf project with my ecore metamodel (Lets call it mylanguage.ecore) and It works correctly.
In addition, I add an eclipse plugin that contains events can be triggered by clicking on a mylanguage model element.
These events make changes on my models.
After executing each event, the xmi resource of the model is updated immediately. However, the model, opened with mylanguage model editor, takes a moment (several seconds) to be updated with the newest values.

Does exist a way to ameliorate the behavior of this in order to make the model updated immediately?

best regards

FiFi
Re: Update the model view after model changes [message #1731732 is a reply to message #1731726] Mon, 09 May 2016 11:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I suspect that you are doing a round-trip through the file system.

If you use an EditingDomain you should be able to share the ResourceSet
so that no reload is needed.

You should use IResource.refreshLocal to keep Eclipse and the file
system in sync (if you really need the file system to also track promptly).

Regards

Ed Willink

On 09/05/2016 15:53, Fi Fi wrote:
> Hi,
> I create my emf project with my ecore metamodel (Lets call it
> mylanguage.ecore) and It works correctly.
> In addition, I add an eclipse plugin that contains events can be
> triggered by clicking on a mylanguage model element. These events make
> changes on my models.
> After executing each event, the xmi resource of the model is updated
> immediately. However, the model, opened with mylanguage model editor,
> takes a moment (several seconds) to be updated with the newest values.
>
> Does exist a way to ameliorate the behavior of this in order to make
> the model updated immediately?
>
> best regards
>
> FiFi
Re: Update the model view after model changes [message #1733453 is a reply to message #1731732] Fri, 27 May 2016 12:16 Go to previous message
Eclipse UserFriend
Hi Ed,
Thank you for ur reply.
I add the IResource.refreshLocal juste after saving my resource (see below).
However, the model is still updated after a moment (several seconds) and the issue isn't resolved.

any suggestions ?


	public static void saveResource(Resource resource) {
		try {
			resource.save(Collections.EMPTY_MAP);
		} catch (IOException e) {
			e.printStackTrace();
		}
		//Added code
		URI resolvedFile = CommonPlugin.resolve(resource.getURI());
		IResource dfile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(resolvedFile.toFileString()));
		try {
			dfile.refreshLocal(IResource.DEPTH_INFINITE, null);
		} catch (CoreException e) {
			e.printStackTrace();
		}
	}
Previous Topic:How to retrieve State Machines from the Model object?
Next Topic:[CDO] CDOQuery returns very rarely no object although it exists
Goto Forum:
  


Current Time: Tue Jul 15 07:55:30 EDT 2025

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

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

Back to the top