Update the model view after model changes [message #1731726] |
Mon, 09 May 2016 10:53  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.30968 seconds