This is an automated email from the ASF dual-hosted git repository.

junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new b83834c  [NETBEANS-1721] Changed display of boolean values in PHP 
Debugger
     new 08fb876  Merge pull request #2178 from 
KacerCZ/netbeans-1721-boolean-debug
b83834c is described below

commit b83834cb143c0307f069670d7a1fb6fc88b901e1
Author: Tomas Prochazka <[email protected]>
AuthorDate: Tue Jun 9 23:15:37 2020 +0200

    [NETBEANS-1721] Changed display of boolean values in PHP Debugger
---
 .../php/dbgp/models/nodes/AbstractModelNode.java   |  7 ++-
 .../php/dbgp/models/nodes/BooleanVariableNode.java | 55 ++++++++++++++++++++++
 .../dbgp/models/nodes/ScalarTypeVariableNode.java  |  7 ---
 3 files changed, 60 insertions(+), 9 deletions(-)

diff --git 
a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/AbstractModelNode.java
 
b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/AbstractModelNode.java
index 8ea306e..c0575ba 100644
--- 
a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/AbstractModelNode.java
+++ 
b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/AbstractModelNode.java
@@ -40,6 +40,8 @@ public abstract class AbstractModelNode {
     private static final String STRING = "string"; // NOI18N
     private static final String UNDEF = "uninitialized"; // NOI18N
     private static final String NULL = "null"; // NOI18N
+    private static final String BOOLEAN = "boolean"; // NOI18N
+    private static final String BOOL = "bool"; // NOI18N
     private List<AbstractVariableNode> myVars;
     private AbstractModelNode myParent;
 
@@ -71,8 +73,9 @@ public abstract class AbstractModelNode {
                 return new ObjectVariableNode(property, parent);
             case RESOURCE:
                 return new ResourceVariableNode(property, parent);
-            case ScalarTypeVariableNode.BOOLEAN:
-            case ScalarTypeVariableNode.BOOL:
+            case BOOLEAN:
+            case BOOL:
+                return new BooleanVariableNode(property, parent);
             case ScalarTypeVariableNode.INTEGER:
             case ScalarTypeVariableNode.INT:
             case ScalarTypeVariableNode.FLOAT:
diff --git 
a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/BooleanVariableNode.java
 
b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/BooleanVariableNode.java
new file mode 100644
index 0000000..d3da3c1
--- /dev/null
+++ 
b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/BooleanVariableNode.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.php.dbgp.models.nodes;
+
+import java.util.Set;
+import org.netbeans.modules.php.dbgp.UnsufficientValueException;
+
+import org.netbeans.modules.php.dbgp.models.VariablesModelFilter.FilterType;
+import org.netbeans.modules.php.dbgp.packets.Property;
+import org.openide.util.NbBundle;
+
+class BooleanVariableNode extends 
org.netbeans.modules.php.dbgp.models.VariablesModel.AbstractVariableNode {
+
+    private static final String TYPE_BOOLEAN = "TYPE_Boolean"; // NOI18N
+    private static final String VALUE_TRUE = "1"; // NOI18N
+    private static final String DISPLAY_VALUE_TRUE = "true"; // NOI18N
+    private static final String DISPLAY_VALUE_FALSE = "false"; // NOI18N
+
+    BooleanVariableNode(Property property, AbstractModelNode parent) {
+        super(property, parent);
+    }
+
+    @Override
+    public String getType() {
+        return NbBundle.getMessage(BooleanVariableNode.class, TYPE_BOOLEAN);
+    }
+
+    @Override
+    protected boolean isTypeApplied(Set<FilterType> filters) {
+        return filters.contains(FilterType.SCALARS);
+    }
+
+    @Override
+    public String getValue() throws UnsufficientValueException {
+        String value = super.getValue();
+        return value.equals(VALUE_TRUE) ? DISPLAY_VALUE_TRUE : 
DISPLAY_VALUE_FALSE;
+    }
+
+}
diff --git 
a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/ScalarTypeVariableNode.java
 
b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/ScalarTypeVariableNode.java
index e03a83b..ffd65a9 100644
--- 
a/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/ScalarTypeVariableNode.java
+++ 
b/php/php.dbgp/src/org/netbeans/modules/php/dbgp/models/nodes/ScalarTypeVariableNode.java
@@ -30,11 +30,8 @@ import org.openide.util.NbBundle;
 class ScalarTypeVariableNode extends 
org.netbeans.modules.php.dbgp.models.VariablesModel.AbstractVariableNode {
     private static final String TYPE_FLOAT = "TYPE_Float"; // NOI18N
     private static final String TYPE_INT = "TYPE_Int"; // NOI18N
-    private static final String TYPE_BOOLEAN = "TYPE_Boolean"; // NOI18N
     private static final String TYPE_STRING = "TYPE_String"; // NOI18N
     private static final String TYPE_NULL = "TYPE_Null"; // NOI18N
-    public static final String BOOLEAN = "boolean"; // NOI18N
-    public static final String BOOL = "bool"; // NOI18N
     public static final String INTEGER = "integer"; // NOI18N
     public static final String INT = "int"; // NOI18N
     public static final String FLOAT = "float"; // NOI18N
@@ -49,10 +46,6 @@ class ScalarTypeVariableNode extends 
org.netbeans.modules.php.dbgp.models.Variab
         String type = super.getType();
         String bundleKey;
         switch (type) {
-            case BOOLEAN:
-            case BOOL:
-                bundleKey = TYPE_BOOLEAN;
-                break;
             case INTEGER:
             case INT:
                 bundleKey = TYPE_INT;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to