// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/api/ProjectMetadata.java
// public interface ProjectMetadata {
//     public static final String PROP_MAIN_FILE = "main"; //NOi18N
//     public static final String PROP_TEST_SCRIPT = "scripts.test"; //NOi18N
//     public static final String PROP_NAME = "name"; //NOi18N
//     public static final String PROP_DESCRIPTION = "description"; //NOi18N
//     public static final String PROP_LICENSE_KIND = "license.type"; //NOi18N
//     public static final String PROP_LICENSE_URL = "license.url"; //NOi18N
//     public static final String PROP_AUTHOR_NAME = "author.name"; //NOi18N
//     public static final String PROP_AUTHOR_EMAIL = "author.email"; //NOi18N
//     public static final String PROP_AUTHOR_URL = "author.url"; //NOi18N
//     public static final String PROP_BUG_URL = "bugs.url"; //NOi18N
//     public static final String PROP_KEYWORDS = "keywords"; //NOi18N
//     public static final String PROP_VERSION = "version"; //NOi18N
// 
//     public String getValue ( String key );
// 
//     public void setValue ( String key, String value );
// 
//     public void save () throws IOException;
// 
//     public void addPropertyChangeListener ( PropertyChangeListener pcl );
// 
//     public void addMap ( String key, Map<String, Object> m );
// 
//     public Map<String, Object> getMap ( String key );
// 
//     public void clearValue ( String key );
// 
//     public void addList ( String key, List<?> l );
// 
//     public <T> T setValueAs ( String key, T obj );
// }
// 
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/forks/EmailAddressValidator.java
// public class EmailAddressValidator extends AbstractValidator<String> {
//     private final Validator<String> hv = new ValidHostNameOrIPValidator( false );
//     private final Validator<String> spv = StringValidators.NO_WHITESPACE;
//     private final Validator<String> encv = StringValidators.encodableInCharset( "US-ASCII" );
// 
//     // Forked from simplevalidation because NetBeans is still using an
//     // old version.  Can be deleted once NetBeans is on simplevalidation 1.8
//     static final Pattern ADDRESS_PATTERN = Pattern.compile( "(.*?)<(.*)>$" ); //NOI18N
// 
//     public EmailAddressValidator () {
//         super( String.class );
//     }
// 
//     @Override
//     public void validate ( Problems problems, String compName, String model ) {
//         Matcher m = ADDRESS_PATTERN.matcher( model );
//         String address;
//         if (m.lookingAt()) {
//             if (m.groupCount() == 2) {
//                 address = m.group( 2 );
//             } else {
//                 address = m.group( 1 );
//             }
//         } else {
//             address = model;
//         }
//         String[] nameAndHost = address.split( "@" );
//         if (nameAndHost.length == 0) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "NO_AT_SYMBOL", compName, address ) );
//             return;
//         }
//         if (nameAndHost.length == 1 && nameAndHost[0].contains( "@" )) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_MISSING_HOST", compName, nameAndHost[0] ) );
//             return;
//         }
//         if (nameAndHost.length > 2) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_HAS_>1_@", compName, address ) );
//             return;
//         }
//         String name = nameAndHost[0];
//         if (name.length() == 0) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_MISSING_NAME", compName, name ) );
//             return;
//         }
//         if (name.length() > 64) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "ADDRESS_MAY_BE_TOO_LONG", compName, name ), Severity.WARNING );
//         }
//         String host = nameAndHost.length >= 2 ? nameAndHost[1] : null;
//         if (host == null) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_MISSING_HOST", compName, nameAndHost[0] ) );
//             return;
//         }
//         hv.validate( problems, compName, host );
//         spv.validate( problems, compName, name );
//         encv.validate( problems, compName, address );
//     }
// }


import org.openide.util.NbCollections;
import org.openide.util.Parameters;
import org.netbeans.modules.nodejs.api.ProjectMetadata;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.netbeans.api.project.Project;
import org.netbeans.modules.nodejs.forks.EmailAddressValidator;
import org.netbeans.validation.api.Problems;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
        project.metadata().setValue( ProjectMetadata.PROP_VERSION, version );
    }

    public void setLicenseType ( String type ) {
        project.metadata().setValue( ProjectMetadata.PROP_LICENSE_KIND, type );
    }

    public void setLicenseURL ( URL url ) {
        project.metadata().setValue( ProjectMetadata.PROP_LICENSE_URL, url.toString() );
    }

    public String getLicenseType () {
        return project.metadata().getValue( ProjectMetadata.PROP_LICENSE_KIND );
    }

    public String getLicenseURL () {
        return project.metadata().getValue( ProjectMetadata.PROP_LICENSE_URL );
    }

    public String getDescription () {
        return project.metadata().getValue( ProjectMetadata.PROP_DESCRIPTION );
    }

    public void setAuthor ( String author ) {
        project.metadata().setValue( ProjectMetadata.PROP_AUTHOR_NAME, author );
    }

    public void setAuthorEmail ( String email ) {
        if (email != null && !"".equals( email )) { //NOi18N
            Problems p = new Problems();
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/api/ProjectMetadata.java
// public interface ProjectMetadata {
//     public static final String PROP_MAIN_FILE = "main"; //NOi18N
//     public static final String PROP_TEST_SCRIPT = "scripts.test"; //NOi18N
//     public static final String PROP_NAME = "name"; //NOi18N
//     public static final String PROP_DESCRIPTION = "description"; //NOi18N
//     public static final String PROP_LICENSE_KIND = "license.type"; //NOi18N
//     public static final String PROP_LICENSE_URL = "license.url"; //NOi18N
//     public static final String PROP_AUTHOR_NAME = "author.name"; //NOi18N
//     public static final String PROP_AUTHOR_EMAIL = "author.email"; //NOi18N
//     public static final String PROP_AUTHOR_URL = "author.url"; //NOi18N
//     public static final String PROP_BUG_URL = "bugs.url"; //NOi18N
//     public static final String PROP_KEYWORDS = "keywords"; //NOi18N
//     public static final String PROP_VERSION = "version"; //NOi18N
// 
//     public String getValue ( String key );
// 
//     public void setValue ( String key, String value );
// 
//     public void save () throws IOException;
// 
//     public void addPropertyChangeListener ( PropertyChangeListener pcl );
// 
//     public void addMap ( String key, Map<String, Object> m );
// 
//     public Map<String, Object> getMap ( String key );
// 
//     public void clearValue ( String key );
// 
//     public void addList ( String key, List<?> l );
// 
//     public <T> T setValueAs ( String key, T obj );
// }
// 
// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/forks/EmailAddressValidator.java
// public class EmailAddressValidator extends AbstractValidator<String> {
//     private final Validator<String> hv = new ValidHostNameOrIPValidator( false );
//     private final Validator<String> spv = StringValidators.NO_WHITESPACE;
//     private final Validator<String> encv = StringValidators.encodableInCharset( "US-ASCII" );
// 
//     // Forked from simplevalidation because NetBeans is still using an
//     // old version.  Can be deleted once NetBeans is on simplevalidation 1.8
//     static final Pattern ADDRESS_PATTERN = Pattern.compile( "(.*?)<(.*)>$" ); //NOI18N
// 
//     public EmailAddressValidator () {
//         super( String.class );
//     }
// 
//     @Override
//     public void validate ( Problems problems, String compName, String model ) {
//         Matcher m = ADDRESS_PATTERN.matcher( model );
//         String address;
//         if (m.lookingAt()) {
//             if (m.groupCount() == 2) {
//                 address = m.group( 2 );
//             } else {
//                 address = m.group( 1 );
//             }
//         } else {
//             address = model;
//         }
//         String[] nameAndHost = address.split( "@" );
//         if (nameAndHost.length == 0) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "NO_AT_SYMBOL", compName, address ) );
//             return;
//         }
//         if (nameAndHost.length == 1 && nameAndHost[0].contains( "@" )) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_MISSING_HOST", compName, nameAndHost[0] ) );
//             return;
//         }
//         if (nameAndHost.length > 2) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_HAS_>1_@", compName, address ) );
//             return;
//         }
//         String name = nameAndHost[0];
//         if (name.length() == 0) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_MISSING_NAME", compName, name ) );
//             return;
//         }
//         if (name.length() > 64) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "ADDRESS_MAY_BE_TOO_LONG", compName, name ), Severity.WARNING );
//         }
//         String host = nameAndHost.length >= 2 ? nameAndHost[1] : null;
//         if (host == null) {
//             problems.add( NbBundle.getMessage( StringValidators.class,
//                     "EMAIL_MISSING_HOST", compName, nameAndHost[0] ) );
//             return;
//         }
//         hv.validate( problems, compName, host );
//         spv.validate( problems, compName, name );
//         encv.validate( problems, compName, address );
//     }
// }


// Path: node-projects/src/main/java/org/netbeans/modules/nodejs/NodeJSProjectProperties.java
import org.openide.util.NbCollections;
import org.openide.util.Parameters;
import org.netbeans.modules.nodejs.api.ProjectMetadata;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.netbeans.api.project.Project;
import org.netbeans.modules.nodejs.forks.EmailAddressValidator;
import org.netbeans.validation.api.Problems;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;

        project.metadata().setValue( ProjectMetadata.PROP_VERSION, version );
    }

    public void setLicenseType ( String type ) {
        project.metadata().setValue( ProjectMetadata.PROP_LICENSE_KIND, type );
    }

    public void setLicenseURL ( URL url ) {
        project.metadata().setValue( ProjectMetadata.PROP_LICENSE_URL, url.toString() );
    }

    public String getLicenseType () {
        return project.metadata().getValue( ProjectMetadata.PROP_LICENSE_KIND );
    }

    public String getLicenseURL () {
        return project.metadata().getValue( ProjectMetadata.PROP_LICENSE_URL );
    }

    public String getDescription () {
        return project.metadata().getValue( ProjectMetadata.PROP_DESCRIPTION );
    }

    public void setAuthor ( String author ) {
        project.metadata().setValue( ProjectMetadata.PROP_AUTHOR_NAME, author );
    }

    public void setAuthorEmail ( String email ) {
        if (email != null && !"".equals( email )) { //NOi18N
            Problems p = new Problems();
            new EmailAddressValidator().validate( p, "email", email ); //NOI18N