Revision: 5143
          http://sourceforge.net/p/jump-pilot/code/5143
Author:   michaudm
Date:     2016-11-03 08:22:52 +0000 (Thu, 03 Nov 2016)
Log Message:
-----------
Refactor/clean ReplaceValue and CalculateAreasAndLengths PlugIns

Modified Paths:
--------------
    
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/analysis/CalculateAreasAndLengthsPlugIn.java
    core/trunk/src/language/jump.properties
    core/trunk/src/language/jump_cz.properties
    core/trunk/src/language/jump_de.properties
    core/trunk/src/language/jump_es.properties
    core/trunk/src/language/jump_fi.properties
    core/trunk/src/language/jump_fr.properties
    core/trunk/src/language/jump_hu.properties
    core/trunk/src/language/jump_it.properties
    core/trunk/src/language/jump_ja_JP.properties
    core/trunk/src/language/jump_ml.properties
    core/trunk/src/language/jump_pt.properties
    core/trunk/src/language/jump_pt_BR.properties
    core/trunk/src/language/jump_ta_IN.properties
    core/trunk/src/language/jump_te.properties
    core/trunk/src/language/jump_zh_CN.properties
    core/trunk/src/language/jump_zh_HK.properties
    core/trunk/src/org/openjump/core/ui/plugin/tools/ReplaceValuePlugIn.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/analysis/CalculateAreasAndLengthsPlugIn.java
===================================================================
--- 
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/analysis/CalculateAreasAndLengthsPlugIn.java
     2016-11-02 15:42:27 UTC (rev 5142)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/ui/plugin/analysis/CalculateAreasAndLengthsPlugIn.java
     2016-11-03 08:22:52 UTC (rev 5143)
@@ -67,43 +67,36 @@
 import com.vividsolutions.jump.workbench.plugin.EnableCheckFactory;
 import com.vividsolutions.jump.workbench.plugin.MultiEnableCheck;
 import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.ui.GUIUtil;
-import com.vividsolutions.jump.workbench.ui.LayerNamePanelProxy;
-import com.vividsolutions.jump.workbench.ui.MenuNames;
-import com.vividsolutions.jump.workbench.ui.MultiInputDialog;
-import com.vividsolutions.jump.workbench.ui.WorkbenchFrame;
+import com.vividsolutions.jump.workbench.ui.*;
 import com.vividsolutions.jump.workbench.ui.images.IconLoader;
 import com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller;
 
 /**
-* Calculates areas and lengths from information obtained
-* from the user via a {@link MultiInputDialog}.
-*
-*/
+ * Calculates areas and lengths from information obtained
+ * from the user via a {@link MultiInputDialog}.
+ */
 public class CalculateAreasAndLengthsPlugIn extends AbstractPlugIn {
        
-    private String LAYER_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.layer");
-    private String AREA_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.area-attribute-name");
-    private String LENGTH_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.length-attribute-name");
-    private String LENGTH_CHECK_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-length");
-    private String AREA_CHECK_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-area");
+    private static String LAYER_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.layer");
+    private static String AREA_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.area-attribute-name");
+    private static String LENGTH_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.length-attribute-name");
+    private static String LENGTH_CHECK_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-length");
+    private static String AREA_CHECK_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-area");
 
     public void initialize(PlugInContext context) throws Exception {
         FeatureInstaller featureInstaller = new 
FeatureInstaller(context.getWorkbenchContext());
-        featureInstaller.addMainMenuItem(
+        featureInstaller.addMainMenuPlugin(
             this,
             new String[] {MenuNames.TOOLS, MenuNames.TOOLS_EDIT_ATTRIBUTES},
-            new JMenuItem(this.getName() + "..."),
+            this.getName() + "...", false, null,
             createEnableCheck(context.getWorkbenchContext())); 
     }
+
+    private Layer layer;
+    private boolean setLength, setArea;
+    private String lengthAttribute, areaAttribute;
     
     public boolean execute(PlugInContext context) throws Exception {
-       //[sstein, 16.07.2006] set again to obtain correct language
-        LAYER_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.layer");
-        AREA_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.area-attribute-name");
-        LENGTH_COMBO_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.length-attribute-name");
-        LENGTH_CHECK_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-length");
-        AREA_CHECK_BOX = 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-area");
 
         //<<TODO>> Undo? [Jon Aquino]
         //<<TODO>> Two-phase commit? [Jon Aquino]
@@ -111,82 +104,46 @@
         if (!dialog.wasOKPressed()) {
             return false;
         }
-        if (dialog.getBoolean(AREA_CHECK_BOX)) {
-            updateAreas(dialog.getLayer(LAYER_COMBO_BOX), 
dialog.getText(AREA_COMBO_BOX));
+        getDialogValues(dialog);
+        if (setArea) {
+            updateAreas(layer, areaAttribute);
         }
-        if (dialog.getBoolean(LENGTH_CHECK_BOX)) {
-            updateLengths(
-                dialog.getLayer(LAYER_COMBO_BOX),
-                dialog.getText(LENGTH_COMBO_BOX));
+        if (setLength) {
+            updateLengths(layer, lengthAttribute);
         }
         context.getLayerManager().fireFeaturesChanged(
-            
dialog.getLayer(LAYER_COMBO_BOX).getFeatureCollectionWrapper().getFeatures(),
-            FeatureEventType.ATTRIBUTES_MODIFIED,
-            dialog.getLayer(LAYER_COMBO_BOX));
+            layer.getFeatureCollectionWrapper().getFeatures(),
+            FeatureEventType.ATTRIBUTES_MODIFIED, layer);
         return true;
     }
+
     private MultiInputDialog prompt(PlugInContext context) {
+
         final MultiInputDialog dialog =
             new MultiInputDialog(context.getWorkbenchFrame(), getName(), true);
-        dialog.addEditableLayerComboBox(
-            LAYER_COMBO_BOX,
-            null,
-            null,
-            context.getLayerManager());
-        initFields(dialog, AREA_CHECK_BOX, AREA_COMBO_BOX, 0);
-        initFields(dialog, LENGTH_CHECK_BOX, LENGTH_COMBO_BOX, 1);
+
+        dialog.addLayerComboBox(LAYER_COMBO_BOX,
+                context.getLayerableNamePanel().chooseEditableLayer(), "",
+                context.getLayerManager().getEditableLayers());
+        dialog.addCheckBox(AREA_CHECK_BOX, setArea);
+        dialog.addAttributeComboBox(AREA_COMBO_BOX, LAYER_COMBO_BOX, 
AttributeTypeFilter.NUMSTRING_FILTER,"");
+        dialog.addCheckBox(LENGTH_CHECK_BOX, setLength);
+        dialog.addAttributeComboBox(LENGTH_COMBO_BOX, LAYER_COMBO_BOX, 
AttributeTypeFilter.NUMSTRING_FILTER,"");
+
         initEnableChecks(dialog);
-        loadValues(dialog, context);
         GUIUtil.centreOnWindow(dialog);
         dialog.setVisible(true);
-        if (dialog.wasOKPressed()) {
-            saveValues(dialog, context);
-        }
         return dialog;
     }
-    private void saveValues(MultiInputDialog dialog, PlugInContext context) {
-        Blackboard blackboard = context.getLayerManager().getBlackboard();
-        blackboard.put(namespace() + LAYER_COMBO_BOX, 
dialog.getLayer(LAYER_COMBO_BOX));
-        blackboard.put(
-            namespace() + AREA_CHECK_BOX,
-            dialog.getCheckBox(AREA_CHECK_BOX).isSelected());
-        blackboard.put(
-            namespace() + LENGTH_CHECK_BOX,
-            dialog.getCheckBox(LENGTH_CHECK_BOX).isSelected());
-        blackboard.put(
-            namespace() + AREA_COMBO_BOX,
-            dialog.getComboBox(AREA_COMBO_BOX).getSelectedItem());
-        blackboard.put(
-            namespace() + LENGTH_COMBO_BOX,
-            dialog.getComboBox(LENGTH_COMBO_BOX).getSelectedItem());
+
+    private void getDialogValues(MultiInputDialog dialog) {
+        layer = dialog.getLayer(LAYER_COMBO_BOX);
+        setLength = dialog.getBoolean(LENGTH_CHECK_BOX);
+        lengthAttribute = dialog.getText(LENGTH_COMBO_BOX);
+        setArea = dialog.getBoolean(AREA_CHECK_BOX);
+        areaAttribute = dialog.getText(AREA_COMBO_BOX);
     }
-    private void loadValues(MultiInputDialog dialog, PlugInContext context) {
-        Blackboard blackboard = context.getLayerManager().getBlackboard();
-        dialog.getComboBox(LAYER_COMBO_BOX).setSelectedItem(
-            CollectionUtil.ifNotIn(
-                blackboard.get(namespace() + LAYER_COMBO_BOX),
-                GUIUtil.items(dialog.getComboBox(LAYER_COMBO_BOX)),
-                candidateLayer(context)));
-        GUIUtil.setSelectedWithClick(
-            dialog.getCheckBox(AREA_CHECK_BOX),
-            blackboard.get(namespace() + AREA_CHECK_BOX, true));
-        GUIUtil.setSelectedWithClick(
-            dialog.getCheckBox(LENGTH_CHECK_BOX),
-            blackboard.get(namespace() + LENGTH_CHECK_BOX, true));
-        dialog.getComboBox(AREA_COMBO_BOX).setSelectedItem(
-            CollectionUtil.ifNotIn(
-                blackboard.get(namespace() + AREA_COMBO_BOX),
-                GUIUtil.items(dialog.getComboBox(AREA_COMBO_BOX)),
-                dialog.getComboBox(AREA_COMBO_BOX).getSelectedItem()));
-        dialog.getComboBox(LENGTH_COMBO_BOX).setSelectedItem(
-            CollectionUtil.ifNotIn(
-                blackboard.get(namespace() + LENGTH_COMBO_BOX),
-                GUIUtil.items(dialog.getComboBox(LENGTH_COMBO_BOX)),
-                dialog.getComboBox(LENGTH_COMBO_BOX).getSelectedItem()));
-    }
-    private String namespace() {
-        return getClass().getName() + " - ";
-    }
+
     private void initEnableChecks(final MultiInputDialog dialog) {
         dialog.addEnableChecks(
                 LENGTH_COMBO_BOX, new EnableCheck() {
@@ -201,74 +158,13 @@
             }
         );
     }
-    private String attributeName(List attributeNames, int preferredIndex) {
-        return (String) attributeNames.get(
-            attributeNames.size() > preferredIndex ? preferredIndex : 0);
+
+    private interface Converter {
+        Object convert(double d);
     }
-    private void initFields(
-        final MultiInputDialog dialog,
-        final String checkBoxFieldName,
-        final String comboBoxFieldName,
-        final int preferredCandidateAttributeIndex) {
-        dialog.addCheckBox(checkBoxFieldName, true);
-        dialog.addComboBox(comboBoxFieldName, null, new ArrayList(), null);
-        dialog.getComboBox(LAYER_COMBO_BOX).addActionListener(new 
ActionListener() {
-            private Layer lastLayer = null;
-            public void actionPerformed(ActionEvent e) {
-                Layer newLayer =
-                    (Layer) 
dialog.getComboBox(LAYER_COMBO_BOX).getSelectedItem();
-                if (lastLayer == newLayer) {
-                    return;
-                }
-                lastLayer = newLayer;
-                dialog.getComboBox(comboBoxFieldName).setModel(
-                    new DefaultComboBoxModel(
-                        new Vector(candidateAttributeNames(newLayer))));
-                if (!candidateAttributeNames(newLayer).isEmpty()) {
-                    dialog.getComboBox(comboBoxFieldName).setSelectedItem(
-                        attributeName(
-                            candidateAttributeNames(newLayer),
-                            preferredCandidateAttributeIndex));
-                }
-            }
-        });
-        dialog.getCheckBox(checkBoxFieldName).addActionListener(new 
ActionListener() {
-            public void actionPerformed(ActionEvent e) {
-                dialog.getComboBox(comboBoxFieldName).setEnabled(
-                    dialog.getCheckBox(checkBoxFieldName).isSelected());
-                dialog.getLabel(comboBoxFieldName).setEnabled(
-                    dialog.getCheckBox(checkBoxFieldName).isSelected());
-            }
-        });
-        dialog
-            .addEnableChecks(
-                comboBoxFieldName,
-                    new EnableCheck() {
-                        public String check(JComponent component) {
-                            return dialog.getBoolean(checkBoxFieldName)
-                                    && 
dialog.getComboBox(comboBoxFieldName).getItemCount() == 0
-                                        ? "Layer has no string, integer, or 
double attributes"
-                                        : null;
-                }
-            }
-        );
-        dialog.indentLabel(comboBoxFieldName);
-    }
-    private Layer candidateLayer(PlugInContext context) {
-        if (context.getActiveInternalFrame() instanceof LayerNamePanelProxy) {
-            Layer[] selectedLayers = context.getSelectedLayers();
-            for (int i = 0; i < selectedLayers.length; i++) {
-                if (selectedLayers[i].isEditable()) {
-                    return selectedLayers[i];
-                }
-            }
-        }
-        return (Layer) 
context.getLayerManager().getEditableLayers().iterator().next();
-    }
-    private static interface Converter {
-        public Object convert(double d);
-    }
-    private Map typeToConverterMap = new HashMap() {
+
+    private Map<AttributeType,Converter> typeToConverterMap =
+            new HashMap<AttributeType,Converter>() {
         {
             put(AttributeType.STRING, new Converter() {
                 public Object convert(double d) {
@@ -277,29 +173,26 @@
             });
             put(AttributeType.INTEGER, new Converter() {
                 public Object convert(double d) {
-                    return new Integer((int) d);
+                    return (int)d;
                 }
             });
+            put(AttributeType.LONG, new Converter() {
+                public Object convert(double d) {
+                    return (long)d;
+                }
+            });
             put(AttributeType.DOUBLE, new Converter() {
                 public Object convert(double d) {
-                    return new Double(d);
+                    return d;
                 }
             });
         }
     };
-    private List candidateAttributeNames(Layer layer) {
-        ArrayList candidateAttributeNames = new ArrayList();
-        FeatureSchema schema = 
layer.getFeatureCollectionWrapper().getFeatureSchema();
-        for (int i = 0; i < schema.getAttributeCount(); i++) {
-            if 
(typeToConverterMap.keySet().contains(schema.getAttributeType(i))) {
-                candidateAttributeNames.add(schema.getAttributeName(i));
-            }
-        }
-        return candidateAttributeNames;
+
+    private interface Op {
+        double compute(Geometry g);
     }
-    private static interface Op {
-        public double compute(Geometry g);
-    }
+
     private void updateLengths(Layer layer, String attributeName) {
         update(layer, attributeName, new Op() {
             public double compute(Geometry g) {
@@ -314,18 +207,16 @@
         AttributeType attributeType =
             
layer.getFeatureCollectionWrapper().getFeatureSchema().getAttributeType(
                 attributeIndex);
-        for (Iterator i = 
layer.getFeatureCollectionWrapper().getFeatures().iterator();
-            i.hasNext();
-            ) {
-            Feature feature = (Feature) i.next();
+        for (Feature feature : 
layer.getFeatureCollectionWrapper().getFeatures()) {
             feature.setAttribute(
                 attributeIndex,
                 convert(op.compute(feature.getGeometry()), attributeType));
         }
     }
     private Object convert(double d, AttributeType attributeType) {
-        return ((Converter) typeToConverterMap.get(attributeType)).convert(d);
+        return typeToConverterMap.get(attributeType).convert(d);
     }
+
     private void updateAreas(Layer layer, String attributeName) {
         update(layer, attributeName, new Op() {
             public double compute(Geometry g) {
@@ -333,11 +224,26 @@
             }
         });
     }
-    public MultiEnableCheck createEnableCheck(WorkbenchContext 
workbenchContext) {
+
+    public MultiEnableCheck createEnableCheck(final WorkbenchContext 
workbenchContext) {
         EnableCheckFactory checkFactory = new 
EnableCheckFactory(workbenchContext);
         return new MultiEnableCheck()
             .add(checkFactory.createWindowWithLayerManagerMustBeActiveCheck())
             .add(checkFactory.createAtLeastNLayersMustExistCheck(1))
-            .add(checkFactory.createAtLeastNLayersMustBeEditableCheck(1));
+            .add(checkFactory.createAtLeastNLayersMustBeEditableCheck(1))
+            .add(new EnableCheck(){
+                public String check(JComponent component) {
+                    Collection<Layer> layers = 
AttributeTypeFilter.NUMSTRING_FILTER.filter(workbenchContext.getLayerManager());
+                    boolean candidateLayerFound = false;
+                    for (Layer layer : layers) {
+                        if (layer.isEditable()) {
+                            candidateLayerFound = true;
+                            break;
+                        }
+                    }
+                    if (candidateLayerFound) return null;
+                    return 
I18N.get("ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes");
+                }
+            });
     }
 }

Modified: core/trunk/src/language/jump.properties
===================================================================
--- core/trunk/src/language/jump.properties     2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump.properties     2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2309,6 +2309,7 @@
 ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.calculate-length = Calculate 
length
 ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.layer = Layer
 ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.length-attribute-name = 
Length attribute name
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes
 = No editable layer with required attributes available
 ui.plugin.analysis.ConvexHullPlugIn.Computing-Convex-Hull = Computing Convex 
Hull
 ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull = Convex Hull
 ui.plugin.analysis.ConvexHullPlugIn.Convex-Hull-on-Layer = Convex Hull on Layer

Modified: core/trunk/src/language/jump_cz.properties
===================================================================
--- core/trunk/src/language/jump_cz.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_cz.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2720,4 +2720,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_de.properties
===================================================================
--- core/trunk/src/language/jump_de.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_de.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2716,4 +2716,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_es.properties
===================================================================
--- core/trunk/src/language/jump_es.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_es.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2699,4 +2699,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_fi.properties
===================================================================
--- core/trunk/src/language/jump_fi.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_fi.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2693,4 +2693,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=Valinnan
 synkronointi ominaisuustaulussa ja kartalla
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=Synkronoi
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=Yleist\u00E4 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=Yleist\u00E4\u00E4
 geometriat k\u00E4ytt\u00E4m\u00E4ll\u00E4 Visvalingam-Whyatt-algoritmia.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=Yleist\u00E4\u00E4
 geometriat k\u00E4ytt\u00E4m\u00E4ll\u00E4 Visvalingam-Whyatt-algoritmia.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_fr.properties
===================================================================
--- core/trunk/src/language/jump_fr.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_fr.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2723,4 +2723,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Attributes-format-in-attribute-table=Format
 des attributs dans la table attributaire
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=Synchroniser
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=Simplifier 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=Simplifier
 la g\xE9om\xE9trie en utilisant l'algorithme de Visvalingam-Whyatt.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=Simplifier
 la g\xE9om\xE9trie en utilisant l'algorithme de Visvalingam-Whyatt.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=Aucune
 couche modifiable n'a les attributs requis
\ No newline at end of file

Modified: core/trunk/src/language/jump_hu.properties
===================================================================
--- core/trunk/src/language/jump_hu.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_hu.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2716,4 +2716,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_it.properties
===================================================================
--- core/trunk/src/language/jump_it.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_it.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2700,3 +2700,4 @@
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
 
ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available

Modified: core/trunk/src/language/jump_ja_JP.properties
===================================================================
--- core/trunk/src/language/jump_ja_JP.properties       2016-11-02 15:42:27 UTC 
(rev 5142)
+++ core/trunk/src/language/jump_ja_JP.properties       2016-11-03 08:22:52 UTC 
(rev 5143)
@@ -2718,4 +2718,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_ml.properties
===================================================================
--- core/trunk/src/language/jump_ml.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_ml.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -3989,4 +3989,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_pt.properties
===================================================================
--- core/trunk/src/language/jump_pt.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_pt.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -2714,4 +2714,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_pt_BR.properties
===================================================================
--- core/trunk/src/language/jump_pt_BR.properties       2016-11-02 15:42:27 UTC 
(rev 5142)
+++ core/trunk/src/language/jump_pt_BR.properties       2016-11-03 08:22:52 UTC 
(rev 5143)
@@ -2715,4 +2715,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_ta_IN.properties
===================================================================
--- core/trunk/src/language/jump_ta_IN.properties       2016-11-02 15:42:27 UTC 
(rev 5142)
+++ core/trunk/src/language/jump_ta_IN.properties       2016-11-03 08:22:52 UTC 
(rev 5143)
@@ -2717,4 +2717,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_te.properties
===================================================================
--- core/trunk/src/language/jump_te.properties  2016-11-02 15:42:27 UTC (rev 
5142)
+++ core/trunk/src/language/jump_te.properties  2016-11-03 08:22:52 UTC (rev 
5143)
@@ -3223,4 +3223,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 
ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
-ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_zh_CN.properties
===================================================================
--- core/trunk/src/language/jump_zh_CN.properties       2016-11-02 15:42:27 UTC 
(rev 5142)
+++ core/trunk/src/language/jump_zh_CN.properties       2016-11-03 08:22:52 UTC 
(rev 5143)
@@ -2878,4 +2878,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: core/trunk/src/language/jump_zh_HK.properties
===================================================================
--- core/trunk/src/language/jump_zh_HK.properties       2016-11-02 15:42:27 UTC 
(rev 5142)
+++ core/trunk/src/language/jump_zh_HK.properties       2016-11-03 08:22:52 UTC 
(rev 5143)
@@ -2879,4 +2879,5 @@
 
org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Selection-synchronization=#T:Synchronization
 of Selection between the Attribute Table and the Map
 org.openjump.core.ui.plugin.view.ViewOptionsPlugIn.Synchronize=#T:Synchronize
 ui.plugin.analysis.GeometryFunction.Simplify-(Visvalingam-Whyatt)=#T:Simplify 
(Visvalingam-Whyatt)
-ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.Simplifies-a-geometry-using-the-Visvalingam-Whyatt-algorithm=#T:Simplifies
 a geometry using the Visvalingam-Whyatt algorithm.
+ui.plugin.analysis.CalculateAreasAndLengthsPlugIn.no-editable-layer-with-required-attributes=#T:No
 editable layer with required attributes available
\ No newline at end of file

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/tools/ReplaceValuePlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/tools/ReplaceValuePlugIn.java    
2016-11-02 15:42:27 UTC (rev 5142)
+++ core/trunk/src/org/openjump/core/ui/plugin/tools/ReplaceValuePlugIn.java    
2016-11-03 08:22:52 UTC (rev 5143)
@@ -39,7 +39,6 @@
 
 import javax.swing.*;
 
-
 import org.openjump.sigle.utilities.gui.DialogUtil;
 
 import com.vividsolutions.jump.I18N;
@@ -51,9 +50,6 @@
 import com.vividsolutions.jump.workbench.ui.*;
 import com.vividsolutions.jump.workbench.ui.images.IconLoader;
 
-import static com.vividsolutions.jump.I18N.get;
-
-
 /**
  * 
  * @author Erwan Bocher Laboratoire RESO UMR CNRS 6590
@@ -62,19 +58,13 @@
  * license Licence CeCILL http://www.cecill.info/
  */
 
-public class ReplaceValuePlugIn
-    extends AbstractPlugIn
-    implements ThreadedPlugIn
-{
-
+public class ReplaceValuePlugIn extends AbstractPlugIn implements 
ThreadedPlugIn {
  
-  private MultiInputDialog dialog;
   //-- replace later with correct language
   private static String ATTRIBUTE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Attribute");
   private static String VALUE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.New-value");
   private static String ATTRIBUTE_SRC = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Attribute-src");
   private static String BY_ATTRIBUTE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.New-value-by-copy");
-  private static String TYPE = "";
   private static String SELECTED_ONLY = 
GenericNames.USE_SELECTED_FEATURES_ONLY;
   private static String DESCRIPTION = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Description");
 
@@ -87,34 +77,31 @@
   public static final ImageIcon ICON = IconLoader.icon("Wrench.gif");
 
 
-  public ReplaceValuePlugIn()
-  {
-   
-  }
+  public ReplaceValuePlugIn() {}
   
   public void initialize(PlugInContext context) {
-               
-         context.getFeatureInstaller().addMainMenuItem(this,new String[] { 
MenuNames.TOOLS, MenuNames.TOOLS_EDIT_ATTRIBUTES }, 
-                       this.getName(), false, null, 
-                       createEnableCheck(context.getWorkbenchContext())
-                               ); 
-               
-       }
 
+         context.getFeatureInstaller().addMainMenuPlugin(
+                       this,
+                         new String[]{ MenuNames.TOOLS, 
MenuNames.TOOLS_EDIT_ATTRIBUTES },
+                         this.getName(), false, null,
+                         createEnableCheck(context.getWorkbenchContext()));
+  }
+
   public String getName(){
        return 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Replace-Attribute-Value");
   }
   
   public boolean execute(PlugInContext context) throws Exception {
 //       lemesre: duplicate from private initialisation
-         ATTRIBUTE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Attribute");
-         VALUE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.New-value");
-         ATTRIBUTE_SRC = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Attribute-src");
-         BY_ATTRIBUTE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.New-value-by-copy");
-         SELECTED_ONLY = GenericNames.USE_SELECTED_FEATURES_ONLY;
-         DESCRIPTION = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Description");
+         //ATTRIBUTE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Attribute");
+         //VALUE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.New-value");
+         //ATTRIBUTE_SRC = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Attribute-src");
+         //BY_ATTRIBUTE = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.New-value-by-copy");
+         //SELECTED_ONLY = GenericNames.USE_SELECTED_FEATURES_ONLY;
+         //DESCRIPTION = 
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Description");
 
-         dialog = new MultiInputDialog(context.getWorkbenchFrame(), getName(), 
true);
+         MultiInputDialog dialog = new 
MultiInputDialog(context.getWorkbenchFrame(), getName(), true);
          setDialogValues(dialog, context);
          if (layer.isEditable()){
                  GUIUtil.centreOnWindow(dialog);
@@ -130,27 +117,24 @@
 
   }
 
-  public void run(TaskMonitor monitor, PlugInContext context)
-  throws Exception
-  {
+  public void run(TaskMonitor monitor, PlugInContext context) throws Exception 
{
 
          // input-proofing
          if (layer == null) return;
          if (attrName == null) return;
          if (value == null && attrNameSrc == null) return;
 
+         List<Feature> srcFeatures = 
layer.getFeatureCollectionWrapper().getFeatures();
 
-         List srcFeatures = layer.getFeatureCollectionWrapper().getFeatures();
-
-
          if (useSelected){
 
-                 Collection featureSelected = 
context.getLayerViewPanel().getSelectionManager().getFeaturesWithSelectedItems(layer);
 ;
+                 Collection<Feature> featureSelected =
+                                 
context.getLayerViewPanel().getSelectionManager().getFeaturesWithSelectedItems(layer);
           if (featureSelected.size() == 0) {
-              
context.getWorkbenchFrame().warnUser(I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Layer-has-no-feature-selected"));
+              context.getWorkbenchFrame().warnUser(
+                       
I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Layer-has-no-feature-selected"));
               return;
           }
-                 //System.out.println("Feature selected");
                  
monitor.report(I18N.get("org.openjump.sigle.plugin.ReplaceValuePlugIn.Replacing-values"));
                  if (byAttribute) {
                          replaceByAttributeValue(featureSelected, 
attrName,attrNameSrc);
@@ -160,7 +144,6 @@
 
          } else {
 
-                 //System.out.println("All features");
                  if (byAttribute) {
                          replaceByAttributeValue(srcFeatures, 
attrName,attrNameSrc);
                  } else {
@@ -175,8 +158,7 @@
   }
   
 
-  private void setDialogValues(final MultiInputDialog dialog, PlugInContext 
context)
-  {
+  private void setDialogValues(final MultiInputDialog dialog, PlugInContext 
context) {
          
        dialog.setSideBarDescription(DESCRIPTION);  
     //Initial layer value is null
@@ -224,9 +206,7 @@
                  public void actionPerformed(ActionEvent e) {
                          JCheckBox chk = (JCheckBox) e.getSource();
                          valuetextfield.setEnabled(!chk.isSelected());
-                         // valuetextfield.setVisible(!chk.isSelected());
-                         
dialog.getComboBox(ATTRIBUTE_SRC).setEnabled(chk.isSelected()); 
-                         // 
dialog.getComboBox(ATTRIBUTE_SRC).setVisible(chk.isSelected()); 
+                         
dialog.getComboBox(ATTRIBUTE_SRC).setEnabled(chk.isSelected());
                  }
          });
        
@@ -244,66 +224,47 @@
 
   }
   
-  private void replaceValue(Collection selectedFC, String attrName, String 
value){
+  private void replaceValue(Collection<Feature> selectedFC, String attrName, 
String value){
 
-         AttributeType type;
-         type = ((Feature) 
selectedFC.iterator().next()).getSchema().getAttributeType(attrName);
+         AttributeType type =
+                         
selectedFC.iterator().next().getSchema().getAttributeType(attrName);
 
-         for (Iterator i = selectedFC.iterator(); i.hasNext(); ) {
-                 Feature f = (Feature) i.next();
+         for (Feature f : selectedFC) {
 
-                 if (byAttribute) {
-                         // replace by the value of selected attribute
-
-                 }else {
+                 if (!byAttribute) {
                          // remplacement par la valeur saisie
                          if (type == AttributeType.DOUBLE) {
                                  f.setAttribute(attrName, new Double (value));
-
                          } else if (type == AttributeType.INTEGER)  {
-                                 f.setAttribute(attrName, new Integer 
(value)); 
-
+                                 f.setAttribute(attrName, new Integer (value));
                          } else if (type == AttributeType.STRING) {
-                                 f.setAttribute(attrName, new String (value)); 
-
-                         } else {
-
+                                 f.setAttribute(attrName, value);
                          }
                  }
          }
 
   }
                  
-  private void  replaceByAttributeValue(Collection selectedFC, String 
attrNameDest,
+  private void  replaceByAttributeValue(Collection<Feature> selectedFC, String 
attrNameDest,
                  String attrNameSrc){
 
-         //AttributeType typeSrc;
-         AttributeType typeDest;
-         String AttrValue;
-         typeDest = ((Feature) 
selectedFC.iterator().next()).getSchema().getAttributeType(attrNameDest); 
+         AttributeType typeDest =
+                         
selectedFC.iterator().next().getSchema().getAttributeType(attrNameDest);
 
-         for (Iterator i = selectedFC.iterator(); i.hasNext(); ) {
-                 Feature f = (Feature) i.next();
+         for (Feature f : selectedFC) {
 
-                 AttrValue = (String) f.getAttribute(attrNameSrc);
+                 String attrValue = f.getString(attrNameSrc);
 
                  if (byAttribute) {
                          // replace by the value of selected attribute
                          if (typeDest == AttributeType.DOUBLE) {               
    
-                                 f.setAttribute(attrNameDest, new Double 
(AttrValue));
-
+                                 f.setAttribute(attrNameDest, new Double 
(attrValue));
                          } else if (typeDest == AttributeType.INTEGER)  {
-                                 f.setAttribute(attrNameDest, new Integer 
(AttrValue)); 
+                                 f.setAttribute(attrNameDest, new Integer 
(attrValue));
 
                          } else if (typeDest == AttributeType.STRING) {
-                                 f.setAttribute(attrNameDest, new String 
(AttrValue)); 
-
-                         } else {
-
+                                 f.setAttribute(attrNameDest, attrValue);
                          }
-
-                 }else {
-                         
                  }
          }
 
@@ -311,15 +272,11 @@
 
   public static MultiEnableCheck createEnableCheck(final WorkbenchContext 
workbenchContext) {
        EnableCheckFactory checkFactory = new 
EnableCheckFactory(workbenchContext);
-       
        return new MultiEnableCheck()
-               //.add(checkFactory.createAtLeastNLayersMustExistCheck(1))
-        //.add(checkFactory.createExactlyNLayersMustBeSelectedCheck(1))
-               //.add(checkFactory.createSelectedLayersMustBeEditableCheck());
         .add(checkFactory.createExactlyOneSelectedLayerMustBeEditableCheck())
         .add(new EnableCheck(){
             public String check(JComponent component) {
-                Layer[] layers = 
workbenchContext.getLayerNamePanel().getSelectedLayers();
+                Layer[] layers = 
workbenchContext.getLayerableNamePanel().getSelectedLayers();
                 Layer layer = null;
                 for (Layer lyr : layers) {
                     if (lyr.isEditable()) {


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to