Revision: 5833
          http://sourceforge.net/p/jump-pilot/code/5833
Author:   ma15569
Date:     2018-06-04 16:33:24 +0000 (Mon, 04 Jun 2018)
Log Message:
-----------
Remove previous RasterImageLayer commit to  a more generic method 

Modified Paths:
--------------
    
core/trunk/src/com/vividsolutions/jump/workbench/plugin/EnableCheckFactory.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/plugin/EnableCheckFactory.java
===================================================================
--- 
core/trunk/src/com/vividsolutions/jump/workbench/plugin/EnableCheckFactory.java 
    2018-06-04 12:41:21 UTC (rev 5832)
+++ 
core/trunk/src/com/vividsolutions/jump/workbench/plugin/EnableCheckFactory.java 
    2018-06-04 16:33:24 UTC (rev 5833)
@@ -812,14 +812,20 @@
     }
 
     /**
-     * Check that at least n RasterImageLayer.class layers have been loaded
+     * Check that at least n Layerables of a type (Layer.class,
+     * RasterImageLayer.class, WMSLayer.class, etc) have been loaded
      * 
      * @param number
-     *            of RasterImageLayer.class layers
+     *            of layerables
+     * @param type
+     *            of layerable class (RasterImageLayer.class, Layer.class,
+     *            WMSLayer.class, etc)
      * @return error message or null
      */
-    public EnableCheck createAtLeastNRasterImageLayersMustExistCheck(final int 
n) {
+    public EnableCheck createAtLeastNLayerablesMustExistCheck(final int n,
+            @SuppressWarnings("rawtypes") Class layerableClass) {
         return new EnableCheck() {
+            @SuppressWarnings("unchecked")
             @Override
             public String check(JComponent component) {
                 final LayerManager layerManager = workbenchContext
@@ -827,20 +833,16 @@
                 String msg;
                 if (n == 1) {
                     msg = 
get("com.vividsolutions.jump.workbench.plugin.At-least-one-layerables-must-exist")
-                            + " ("
-                            + 
get("org.openjump.core.rasterimage.AddRasterImageLayerWizard.Sextante-Raster-Image")
-                            + ")";
+                            + ": " + layerableClass.getSimpleName();
                 } else {
                     msg = getMessage(
                             
"com.vividsolutions.jump.workbench.plugin.At-least-n-layerables-must-exist",
                             new Object[] { n })
-                            + " ("
-                            + 
get("org.openjump.core.rasterimage.AddRasterImageLayerWizard.Sextante-Raster-Image")
-                            + ")";
+                            + ": " + layerableClass.getSimpleName();
                     ;
                 }
-                return (layerManager == null || n > layerManager
-                        .getRasterImageLayers().size()) ? msg : null;
+                return (layerManager == null || n > layerManager.getLayerables(
+                        layerableClass).size()) ? msg : null;
             }
         };
     }


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to