String imageName = null;
- if( type.equals("Boolean") ){
- imageName = null;
- }else if( type.equals( "Number" ) ){
- imageName = null;
- }else if( type.equals( "String" ) ){
- imageName = null;
- }else if( type.equals( "Array" ) ){
- imageName = "temp.png";
- }else if( type.equals( "Index" ) ){
- imageName = null;
- }else{
- imageName = null;
+// if( type.equals("Boolean") ){
+// imageName = null;
+// }else if( type.equals( "Number" ) ){
+// imageName = null;
+// }else if( type.equals( "String" ) ){
+// imageName = null;
+// }else if( type.equals( "Array" ) ){
+// imageName = "temp.png";
+// }else if( type.equals( "Index" ) ){
+// imageName = null;
+// }else{
+// imageName = null;
+// }
+
+ if( type.equals( "Array" ) ){
+ imageName = "temp.png";
}
-
+
if (imageName != null) {
treeItem.setImage ( ResourceManager.getImage( BuilderConstants.ICON_DIR, imageName ) );
}
TreeItem[] items = parentItem.getItems();
- JsonObject parentJson = null;
- JsonArray parentArray = null;
-
- if( parentJsonElement instanceof JsonObject ){
- parentJson = (JsonObject) parentJsonElement;
- } else if( parentJsonElement instanceof JsonArray ){
- parentArray = (JsonArray) parentJsonElement;
- }
-
JsonObject jsonOb = null;
if( type.equals("Array") ){
JsonArray array = new JsonArray();
- parentJson.add(key, array);
+ ((JsonObject)parentJsonElement).add(key, array);
jsonOb = null;
for (TreeItem item : items) {
if( item.getText(2).equals("Index") ){
}
}else if( type.equals("Object") ){
jsonOb = new JsonObject();
- parentJson.add(key, jsonOb);
+ ((JsonObject)parentJsonElement).add(key, jsonOb);
for (TreeItem item : items) {
makeJsonFromTree( item, jsonOb );
}
if(item.getText().length() > 0){
makeJsonFromTree( item, jsonOb );
}else{
- parentArray.add( new JsonPrimitive(item.getText(1)) );
+ ((JsonArray)parentJsonElement).add( new JsonPrimitive(item.getText(1)) );
}
}
if( !jsonOb.entrySet().isEmpty() )
- parentArray.add(jsonOb);
+ ((JsonArray)parentJsonElement).add(jsonOb);
}else if( type.equals("String") ){
- parentJson.addProperty( key, value );
+ ((JsonObject)parentJsonElement).addProperty( key, value );
}else if( type.equals("Boolean") ){
- parentJson.addProperty( key, Boolean.valueOf( value ) );
+ ((JsonObject)parentJsonElement).addProperty( key, Boolean.valueOf( value ) );
}else if( type.equals("Number") ){
- parentJson.addProperty( key, Long.parseLong( value ) );
+ ((JsonObject)parentJsonElement).addProperty( key, Long.parseLong( value ) );
}else{
- parentJson.add( key, null );
+ ((JsonObject)parentJsonElement).add( key, null );
}
}
// }
// return false;
// }
-}
+}
\ No newline at end of file