// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/json/ObjectMapperProvider.java
// public class ObjectMapperProvider {
//     public static ObjectMapper newObjectMapper () {
//         ObjectMapper m = new ObjectMapper();
//         m.configure( JsonParser.Feature.ALLOW_COMMENTS, true );
//         m.configure( DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true );
//         m.configure( SerializationFeature.INDENT_OUTPUT, true );
//         m.configure( SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true );
//         m.configure( SerializationFeature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS, true );
//         m.configure( JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true );
//         m.configure( JsonParser.Feature.AUTO_CLOSE_SOURCE, true );
//         return m;
//     }
// 
//     public static final TypeReference<Map<String,Object>> STRING_OBJECT_MAP
//             = new TR();
// 
//     private static final class TR extends TypeReference<Map<String,Object>> {
//     }
// }
// 
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/json/ObjectMapperProvider.java
// public static final TypeReference<Map<String,Object>> STRING_OBJECT_MAP
//         = new TR();


import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedHashMap;
import java.util.Map;
import org.netbeans.modules.nodejs.json.ObjectMapperProvider;
import static org.netbeans.modules.nodejs.json.ObjectMapperProvider.STRING_OBJECT_MAP;
import org.openide.filesystems.FileObject;
import org.openide.util.Exceptions;
import org.openide.util.RequestProcessor;

    public void run () {
        try {
            FileObject fo = prj.getProjectDirectory().getFileObject( ".nbinfo" );
            if (fo == null) {
                fo = prj.getProjectDirectory().createData( ".nbinfo" );
            }
            Map<String, String> m = new LinkedHashMap<>();
            synchronized ( this ) {
                if (platform != null) {
                    m.put( "platformName", platform );
                }
                if (runArguments != null) {
                    m.put( "arguments", runArguments );
                }
            }
            try (OutputStream out = fo.getOutputStream()) {
                ObjectMapperProvider.newObjectMapper().writeValue( out, m );
            }
        } catch ( IOException ex ) {
            Exceptions.printStackTrace( ex );
        }
    }

    private void load () {
        FileObject fo = prj.getProjectDirectory().getFileObject( ".nbinfo" );
        if (fo != null) {
            fileFound = true;
            Map<String, String> loadedData = null;
            try (InputStream in = fo.getInputStream()) {
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/json/ObjectMapperProvider.java
// public class ObjectMapperProvider {
//     public static ObjectMapper newObjectMapper () {
//         ObjectMapper m = new ObjectMapper();
//         m.configure( JsonParser.Feature.ALLOW_COMMENTS, true );
//         m.configure( DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true );
//         m.configure( SerializationFeature.INDENT_OUTPUT, true );
//         m.configure( SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true );
//         m.configure( SerializationFeature.WRITE_CHAR_ARRAYS_AS_JSON_ARRAYS, true );
//         m.configure( JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true );
//         m.configure( JsonParser.Feature.AUTO_CLOSE_SOURCE, true );
//         return m;
//     }
// 
//     public static final TypeReference<Map<String,Object>> STRING_OBJECT_MAP
//             = new TR();
// 
//     private static final class TR extends TypeReference<Map<String,Object>> {
//     }
// }
// 
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/json/ObjectMapperProvider.java
// public static final TypeReference<Map<String,Object>> STRING_OBJECT_MAP
//         = new TR();


// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/NbInfo.java
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.LinkedHashMap;
import java.util.Map;
import org.netbeans.modules.nodejs.json.ObjectMapperProvider;
import static org.netbeans.modules.nodejs.json.ObjectMapperProvider.STRING_OBJECT_MAP;
import org.openide.filesystems.FileObject;
import org.openide.util.Exceptions;
import org.openide.util.RequestProcessor;


    public void run () {
        try {
            FileObject fo = prj.getProjectDirectory().getFileObject( ".nbinfo" );
            if (fo == null) {
                fo = prj.getProjectDirectory().createData( ".nbinfo" );
            }
            Map<String, String> m = new LinkedHashMap<>();
            synchronized ( this ) {
                if (platform != null) {
                    m.put( "platformName", platform );
                }
                if (runArguments != null) {
                    m.put( "arguments", runArguments );
                }
            }
            try (OutputStream out = fo.getOutputStream()) {
                ObjectMapperProvider.newObjectMapper().writeValue( out, m );
            }
        } catch ( IOException ex ) {
            Exceptions.printStackTrace( ex );
        }
    }

    private void load () {
        FileObject fo = prj.getProjectDirectory().getFileObject( ".nbinfo" );
        if (fo != null) {
            fileFound = true;
            Map<String, String> loadedData = null;
            try (InputStream in = fo.getInputStream()) {
                loadedData = ObjectMapperProvider.newObjectMapper().readValue( in, STRING_OBJECT_MAP );