Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » [JEM] EMF Workbench
[JEM] EMF Workbench [message #82874] Wed, 09 March 2005 11:19
Eclipse UserFriend
Originally posted by: daniel.rohe.stud.tu-ilmenau.de

In the EMF Workbench (plugin org.eclipse.jem.util) a synchronizer
(org.eclipse.jem.util.emf.workbench.ResourceSetWorkbenchSync hronizer) is
used to react on project changes. Extensions could be added to the
synchronizer programmatically. This extensions then are informed about
changes to the project which is synchronized with the ResourceSet of the
project. Currently the synchronizer only supports notification for project
closing. Notification for changes in a project (moving, creating, deleting,
changing of files) is also provided but never gets called by the
synchronizer.
Isn't it better to also inform extenders about changes in the project, so
they can react on that and for example reload the changed resource in the
ResourceSet?

Code snippet from ResourceSetWorkbenchSynchronizer containing the required
changes.
/*
* @see IResourceChangeListener#resourceChanged(IResourceChangeEvent )
*/
public void resourceChanged(IResourceChangeEvent event) {
currentEventType = event.getType();
currentProjectDelta = null;
if ((currentEventType == IResourceChangeEvent.PRE_CLOSE ||
currentEventType == IResourceChangeEvent.PRE_DELETE)
&& event.getResource().equals(getProject())) {
release();
notifyExtendersOfClose();
} else if (currentEventType == IResourceChangeEvent.POST_CHANGE) {
IResource resource = currentProjectDelta.getResource();

if (resource.getType() == IResource.ROOT) {
IResourceDelta[] projectDelta =
currentProjectDelta.getAffectedChildren();
for (int i = 0; i < projectDelta.length; i++) {
IResource res = projectDelta[i].getResource();
if (resource.getType() == IResource.PROJECT &&
resource.equals(getProject())) {
currentProjectDelta = projectDelta[i];
notifyExtendersIfNecessary();
} else {
currentProjectDelta = null;
}
}

} else if (resource.getType() == IResource.PROJECT) {
if (resource.equals(getProject())) {
notifyExtendersIfNecessary();
}
}
}
currentProjectDelta = null;
}

Greetings
Daniel
Previous Topic:VE null pointer when creating a Visual Class
Next Topic:[JEM] EMF Workbench
Goto Forum:
  


Current Time: Fri Sep 20 22:40:25 GMT 2024

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

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

Back to the top