Stefan Steiniger wrote: Hi,
finally I'm getting back to this. > playing save is what we should do. > For creating new layers I am most often using context.addLayer() - so > why not adding the flagging there instead of changing all plugins? > An option would be to create a second addLayer() method with a boolean > parameter for flagging if the new layer is "modified". > > However, this wouldn't work for > context.getLayerManager().addLayerable(..) - which is used for > (Sextante) Rasters. I.e. needs changes there too. ok. I've attached patch which changes the following: * new feature collections are again unmodified by default * PlugInContext has an added addLayer method taking a featureCollectionModified parameter for convenience * when OpenJUMP is closed, and no layers have been modified, it still asks whether you want to really exit the workbench What are the opinions on this? Thanks, Andreas -- l a t / l o n GmbH Aennchenstrasse 19 53177 Bonn, Germany phone ++49 +228 18496-0 fax ++49 +228 1849629 http://www.lat-lon.de http://www.deegree.org Follow deegree on Twitter: http://twitter.com/deegree_org
Index: src/language/jump.properties =================================================================== --- src/language/jump.properties (revision 1994) +++ src/language/jump.properties (working copy) @@ -1701,6 +1701,7 @@ ui.WorkbenchFrame.committed-memory = Committed Memory ui.WorkbenchFrame.continue = Continue ui.WorkbenchFrame.dataset = Dataset +ui.WorkbenchFramw.do-you-really-want-to-close-openjump = Do you really want to close OpenJUMP? ui.WorkbenchFrame.do-you-want-to-close-them-also = Do you want to close them also ? ui.WorkbenchFrame.exit = Exit ui.WorkbenchFrame.exit-jump = Exit OpenJUMP Index: src/language/jump_en.properties =================================================================== --- src/language/jump_en.properties (revision 1994) +++ src/language/jump_en.properties (working copy) @@ -1663,6 +1663,7 @@ ui.WorkbenchFrame.committed-memory = Committed Memory ui.WorkbenchFrame.continue = Continue ui.WorkbenchFrame.dataset = Dataset +ui.WorkbenchFramw.do-you-really-want-to-close-openjump = Do you really want to close OpenJUMP? ui.WorkbenchFrame.do-you-want-to-close-them-also = Do you want to close them also ? ui.WorkbenchFrame.exit = Exit ui.WorkbenchFrame.exit-jump = Exit OpenJUMP Index: src/language/jump_de.properties =================================================================== --- src/language/jump_de.properties (revision 1994) +++ src/language/jump_de.properties (working copy) @@ -1664,6 +1664,7 @@ ui.WorkbenchFrame.committed-memory = Verwendeter Speicher ui.WorkbenchFrame.continue = Weiter ui.WorkbenchFrame.dataset = Datensatz +ui.WorkbenchFramw.do-you-really-want-to-close-openjump = Wollen Sie OpenJUMP wirklich beenden? ui.WorkbenchFrame.do-you-want-to-close-them-also = Wollen Sie diese ebenfalls schliessen? ui.WorkbenchFrame.exit = OpenJUMP beenden ui.WorkbenchFrame.exit-jump = JUMP Beenden Index: src/com/vividsolutions/jump/workbench/plugin/PlugInContext.java =================================================================== --- src/com/vividsolutions/jump/workbench/plugin/PlugInContext.java (revision 1994) +++ src/com/vividsolutions/jump/workbench/plugin/PlugInContext.java (working copy) @@ -155,6 +155,16 @@ return getLayerManager().addLayer(categoryName, layerName, featureCollection); } + public Layer addLayer( + String categoryName, + String layerName, + FeatureCollection featureCollection, + boolean featureCollectionModified) { + Layer l = getLayerManager().addLayer(categoryName, layerName, featureCollection); + l.setFeatureCollectionModified(featureCollectionModified); + return l; +} + public void addLayerSextanteRaster( String categoryName, RasterImageLayer raster) { Index: src/com/vividsolutions/jump/workbench/model/Layer.java =================================================================== --- src/com/vividsolutions/jump/workbench/model/Layer.java (revision 1994) +++ src/com/vividsolutions/jump/workbench/model/Layer.java (working copy) @@ -115,9 +115,6 @@ getBasicStyle().setLineColor(defaultLineColor(fillColor)); getBasicStyle().setAlpha(150); setFeatureCollection(featureCollection); - // michaelm [2009-02-20] consider that a new layer is modified - // so that a confirmation is asked before application closing - featureCollectionModified = true; } /** Index: src/com/vividsolutions/jump/workbench/ui/WorkbenchFrame.java =================================================================== --- src/com/vividsolutions/jump/workbench/ui/WorkbenchFrame.java (revision 1994) +++ src/com/vividsolutions/jump/workbench/ui/WorkbenchFrame.java (working copy) @@ -1270,9 +1270,15 @@ } private boolean confirmClose(String action, Collection modifiedLayers) { - if (modifiedLayers.isEmpty()) { - return true; - } + if (modifiedLayers.isEmpty()) { + JOptionPane pane = new JOptionPane(I18N.get("ui.WorkbenchFramw.do-you-really-want-to-close-openjump"), + JOptionPane.QUESTION_MESSAGE); + pane.setOptions(new String[] { + action, I18N.get("ui.WorkbenchFrame.cancel") + }); + pane.createDialog(this, "JUMP").setVisible(true); + return pane.getValue().equals(action); + } JOptionPane pane = new JOptionPane( StringUtil.split( modifiedLayers.size()
signature.asc
Description: Digital signature
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel