Just had a look at MapEditor and the dispose() method. I guess it looks
like the answer for my question:

// Save a project
Project p = getMap().getProjectInternal();

if (p != null) {

if (p.eResource() != null && p.eResource().isModified()) {


p.eResource().save(ProjectPlugin.getPlugin().saveOptions);

          }
// and save map
          final Resource resource = getMap().eResource();
          resource.save(ProjectPlugin.getPlugin().saveOptions);

// need to kick the Project so viewers will update
          p.eNotify(new ENotificationImpl((InternalEObject) p,
Notification.SET,
                        ProjectPackage.PROJECT__ELEMENTS_INTERNAL,
          null, null));
} else {
// just save the map resources
          final Resource resource = getMap().eResource();
          if (resource != null)
                    resource.save(ProjectPlugin.getPlugin().saveOptions);
}

I guess it would be great to have a PreferencePage checkbox to allow
"autosave" for Project/Map configurations. Is there a hidden configuration
area I haven't seen so far? What do you think about this use case?

Cheers,
-Frank

2011/11/15 Frank Gasdorf <[email protected]>

> Hallo List,
>
> I'm wondering if there is a way to configure uDig (config.ini or 
> programmatically)
> to force autosave of maps/projects if any layer was added/removed or
> rearranged. How can I achieve this?
>
> The reason why I ask is : If the application will be killed (however), the
> maps and projects files should be consisted and should reflect the last
> edit state after the user has changed anything. I know that its quite
> limited and it would fail if the crash occurs before the models got saved.
>
> Any suggestions?
>
> - Frank
>
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to