OSDN Git Service

ADT GLE2: Remove (or disable) debug printfs.
authorRaphael Moll <ralf@android.com>
Tue, 27 Jul 2010 13:11:15 +0000 (09:11 -0400)
committerRaphael Moll <ralf@android.com>
Tue, 27 Jul 2010 13:11:15 +0000 (09:11 -0400)
Change-Id: I3d8a0f6b4731ee78af8da33c1749423ca7b13254

eclipse/plugins/com.android.ide.eclipse.adt/gscripts/BaseView.groovy
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/CanvasDropListener.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/LayoutCanvas.java
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/NodeProxy.java

index fa81ec8..714c6b7 100755 (executable)
@@ -42,7 +42,7 @@ public class BaseView implements IViewRule {
         // Derived classes should do so if they can handle some subclasses.
 
         // For debugging and as an example of how to use the injected _rules_engine property.
-        _rules_engine.debugPrintf("Initialize() of %s", _rules_engine.getFqcn());
+        // _rules_engine.debugPrintf("Initialize() of %s", _rules_engine.getFqcn());
 
         // If onInitialize returns false, it means it can't handle the given FQCN and
         // will be unloaded.
index e3a433c..8c4e46f 100755 (executable)
@@ -36,6 +36,8 @@ import java.util.Arrays;
  */
 /* package */ class CanvasDropListener implements DropTargetListener {
 
+    private static final boolean DEBUG = false;
+
     private final LayoutCanvas mCanvas;
 
     /**
@@ -101,7 +103,7 @@ import java.util.Arrays;
      * {@inheritDoc}
      */
     public void dragEnter(DropTargetEvent event) {
-        AdtPlugin.printErrorToConsole("DEBUG", "drag enter", event);
+        if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "drag enter", event);
 
         // Make sure we don't have any residual data from an earlier operation.
         clearDropInfo();
@@ -148,7 +150,7 @@ import java.util.Arrays;
      * {@inheritDoc}
      */
     public void dragOperationChanged(DropTargetEvent event) {
-        AdtPlugin.printErrorToConsole("DEBUG", "drag changed", event);
+        if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "drag changed", event);
 
         checkDataType(event);
         recomputeDragType(event);
@@ -179,7 +181,7 @@ import java.util.Arrays;
      * {@inheritDoc}
      */
     public void dragLeave(DropTargetEvent event) {
-        AdtPlugin.printErrorToConsole("DEBUG", "drag leave");
+        if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "drag leave");
 
         // dragLeave is unfortunately called right before data is about to be dropped
         // (between the last dropMove and the next dropAccept). That means we can't just
@@ -207,7 +209,7 @@ import java.util.Arrays;
      * {@inheritDoc}
      */
     public void dropAccept(DropTargetEvent event) {
-        AdtPlugin.printErrorToConsole("DEBUG", "drop accept");
+        if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "drop accept");
 
         checkDataType(event);
 
@@ -233,7 +235,7 @@ import java.util.Arrays;
      * {@inheritDoc}
      */
     public void drop(DropTargetEvent event) {
-        AdtPlugin.printErrorToConsole("DEBUG", "dropped");
+        if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "dropped");
 
         SimpleElement[] elements = null;
 
@@ -246,7 +248,7 @@ import java.util.Arrays;
         }
 
         if (elements == null || elements.length < 1) {
-            AdtPlugin.printErrorToConsole("DEBUG", "drop missing drop data");
+            if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "drop missing drop data");
             return;
         }
 
@@ -260,7 +262,7 @@ import java.util.Arrays;
                 // Attempt to create a root node accordingly.
                 createDocumentRoot(elements);
             } else {
-                AdtPlugin.printErrorToConsole("DEBUG", "dropped on null targetNode");
+                if (DEBUG) AdtPlugin.printErrorToConsole("DEBUG", "dropped on null targetNode");
             }
             return;
         }
index c724207..0e56bba 100755 (executable)
@@ -140,6 +140,8 @@ import java.util.Set;
  */
 class LayoutCanvas extends Canvas implements ISelectionProvider {
 
+    private final static boolean DEBUG = false;
+
     /* package */ static final String PREFIX_CANVAS_ACTION = "canvas_action_";
 
     /** The layout editor that uses this layout canvas. */
@@ -2178,6 +2180,6 @@ class LayoutCanvas extends Canvas implements ISelectionProvider {
     }
 
     private void debugPrintf(String message, Object... params) {
-        AdtPlugin.printToConsole("Canvas", String.format(message, params));
+        if (DEBUG) AdtPlugin.printToConsole("Canvas", String.format(message, params));
     }
 }
index 72be438..6d9c98e 100755 (executable)
@@ -199,7 +199,7 @@ public class NodeProxy implements INode {
         // Find the descriptor for this FQCN
         ViewElementDescriptor vd = getFqcnViewDescritor(viewFqcn);
         if (vd == null) {
-            debugPrintf("Can't create a new %s element", viewFqcn);
+            warnPrintf("Can't create a new %s element", viewFqcn);
             return null;
         }
 
@@ -218,7 +218,7 @@ public class NodeProxy implements INode {
             // Panic ensues.
             // The best bet is to abort now. The edit wrapper will release the edit and the
             // XML/UI should get reloaded properly (with a likely invalid XML.)
-            debugPrintf("Failed to create a new %s element", viewFqcn);
+            warnPrintf("Failed to create a new %s element", viewFqcn);
             throw new RuntimeException("XML node creation failed."); //$NON-NLS-1$
         }
 
@@ -231,7 +231,7 @@ public class NodeProxy implements INode {
         // Find the descriptor for this FQCN
         ViewElementDescriptor vd = getFqcnViewDescritor(viewFqcn);
         if (vd == null) {
-            debugPrintf("Can't create a new %s element", viewFqcn);
+            warnPrintf("Can't create a new %s element", viewFqcn);
             return null;
         }
 
@@ -256,7 +256,7 @@ public class NodeProxy implements INode {
             // Panic ensues.
             // The best bet is to abort now. The edit wrapper will release the edit and the
             // XML/UI should get reloaded properly (with a likely invalid XML.)
-            debugPrintf("Failed to create a new %s element", viewFqcn);
+            warnPrintf("Failed to create a new %s element", viewFqcn);
             throw new RuntimeException("XML node creation failed."); //$NON-NLS-1$
         }
 
@@ -359,7 +359,7 @@ public class NodeProxy implements INode {
         return null;
     }
 
-    private void debugPrintf(String msg, Object...params) {
+    private void warnPrintf(String msg, Object...params) {
         AdtPlugin.printToConsole(
                 mNode == null ? "Groovy" : mNode.getDescriptor().getXmlLocalName() + ".groovy",
                 String.format(msg, params)