]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/services/CaseInsensitiveComponentNamingStrategy.java
Replace System.err and System.out with SLF4J Logging
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / services / CaseInsensitiveComponentNamingStrategy.java
index ff1c17bd36c72da78f14561218d0d858a772a00d..d2c15b5c47e98780d10dba480a1eaa9d20715fb7 100644 (file)
@@ -43,6 +43,8 @@ import org.simantics.modeling.ComponentUtils;
 import org.simantics.structural.stubs.StructuralResource2;
 import org.simantics.utils.datastructures.Pair;
 import org.simantics.utils.ui.ErrorLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * A first-hand component naming strategy implementation for structural models.
@@ -58,6 +60,7 @@ import org.simantics.utils.ui.ErrorLogger;
  */
 public class CaseInsensitiveComponentNamingStrategy extends ComponentNamingStrategyBase implements ChangeListener {
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(CaseInsensitiveComponentNamingStrategy.class);
     private static final boolean            DEBUG_ALL                                     = false;
     private static final boolean            DEBUG_GRAPH_UPDATES                           = false | DEBUG_ALL;
     private static final boolean            DEBUG_CACHE_INITIALIZATION                    = false | DEBUG_ALL;
@@ -139,7 +142,7 @@ public class CaseInsensitiveComponentNamingStrategy extends ComponentNamingStrat
                         // Validate cache.
                         Set<Resource> existingEntries = getMapSet(s2r, newName);
                         if (!existingEntries.isEmpty()) {
-                            System.out.println("WARNING: Somebody is screwing the model up with duplicate name: " + newName);
+                            LOGGER.warn("WARNING: Somebody is screwing the model up with duplicate name: " + newName);
                             // TODO: generate issue or message
                         }
 
@@ -164,7 +167,7 @@ public class CaseInsensitiveComponentNamingStrategy extends ComponentNamingStrat
                             if (existingEntries.contains(component))
                                 continue;
 
-                            System.out.println("WARNING: Somebody is screwing the model up with duplicate name: " + newName);
+                            LOGGER.warn("WARNING: Somebody is screwing the model up with duplicate name: " + newName);
                             // TODO: generate issue or message
                         }
 
@@ -300,8 +303,8 @@ public class CaseInsensitiveComponentNamingStrategy extends ComponentNamingStrat
                                 if (components.size() > 1) {
                                     // Found duplicate names in the model !!
                                     // TODO: generate issue!
-                                    System.err.println("WARNING: found multiple components with same name '" + componentName + "': " + components);
-                                    System.err.println("TODO: generate issue");
+                                    LOGGER.warn("WARNING: found multiple components with same name '" + componentName + "': " + components);
+                                    LOGGER.warn("TODO: generate issue");
                                 } else {
                                     String prevName = r2s.putIfAbsent(component, componentName);
                                     if (prevName == null)
@@ -486,7 +489,7 @@ public class CaseInsensitiveComponentNamingStrategy extends ComponentNamingStrat
     }
 
     private static void debug(Object obj, String string) {
-        System.out.println("[" + obj.getClass().getSimpleName() + "(" + System.identityHashCode(obj) + ")] " + string);
+        LOGGER.info("[" + obj.getClass().getSimpleName() + "(" + System.identityHashCode(obj) + ")] " + string);
     }
 
     private static <K,V> Set<V> addToMapSet(ConcurrentMap<K, Set<V>> map, K key, V value) {