# This patch file was generated by NetBeans IDE # Following Index: paths are relative to: E:\sources\netbeans.org\release55\web\freeform # This patch can be applied using context Tools: Patch action on respective folder. # It uses platform neutral UTF-8 encoding and \n newlines. # Above lines and this line are ignored by the patching process. Index: src/org/netbeans/modules/web/freeform/WebProjectNature.java *** E:\sources\netbeans.org\release55\web\freeform\src\org\netbeans\modules\web\freeform\WebProjectNature.java Base (1.11.22.1.2.4) --- E:\sources\netbeans.org\release55\web\freeform\src\org\netbeans\modules\web\freeform\WebProjectNature.java Locally Modified (Based On 1.11.22.1.2.4) *************** *** 141,146 **** --- 141,147 ---- new WebModules(project, projectHelper, projectEvaluator), // WebModuleProvider, ClassPathProvider new WebFreeFormActionProvider(project, projectHelper, aux), //ActionProvider new HelpIDFragmentProviderImpl(), + new LookupMergerImpl(), }); } Index: src/org/netbeans/modules/web/freeform/LookupMergerImpl.java *** E:\sources\netbeans.org\release55\web\freeform\src\org\netbeans\modules\web\freeform\LookupMergerImpl.java No Base Revision --- E:\sources\netbeans.org\release55\web\freeform\src\org\netbeans\modules\web\freeform\LookupMergerImpl.java Locally New *************** *** 1,0 **** --- 1,81 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.web.freeform; + + import java.util.ArrayList; + import java.util.List; + + import org.netbeans.api.java.project.JavaProjectConstants; + import org.netbeans.api.project.ant.AntArtifact; + + import org.netbeans.spi.project.ant.AntArtifactProvider; + + import org.netbeans.modules.ant.freeform.spi.LookupMerger; + + import org.openide.util.Lookup; + + /** + * Merges AntArtifactProviders - duplicates all artifacts that have type + * ARTIFACT_TYPE_JAR and changes the type to ARTIFACT_TYPE_WAR_EAR_ARCHIVE + * + * @author Milan Kubec + */ + public class LookupMergerImpl implements LookupMerger { + + public LookupMergerImpl() { } + + public Class[] getMergeableClasses() { + return new Class[] { AntArtifactProvider.class }; + } + + public Object merge(Lookup lookup, Class clazz) { + if (clazz == AntArtifactProvider.class) { + return new AntArtifactProviderImpl(lookup); + } + throw new IllegalArgumentException("Merging of " + clazz + " is not supported"); // NOI18N + } + + private static class AntArtifactProviderImpl implements AntArtifactProvider { + + private Lookup lkp; + + public AntArtifactProviderImpl(Lookup lookup) { + this.lkp = lookup; + } + + public AntArtifact[] getBuildArtifacts() { + AntArtifactProvider aap = (AntArtifactProvider) lkp.lookup(AntArtifactProvider.class); + AntArtifact artifacts[] = aap.getBuildArtifacts(); + List webArtifactList = new ArrayList(); + for (int i = 0; i < artifacts.length; i++) { + if (artifacts[i].getType().equals(JavaProjectConstants.ARTIFACT_TYPE_JAR)) { + webArtifactList.add(new WebFreeformAntArtifact(artifacts[i])); + } + } + AntArtifact allArtifacts[] = new AntArtifact[artifacts.length + webArtifactList.size()]; + AntArtifact webArtifacts[] = (AntArtifact[]) webArtifactList.toArray(new AntArtifact[webArtifactList.size()]); + System.arraycopy(artifacts, 0, allArtifacts, 0, artifacts.length); + System.arraycopy(webArtifacts, 0, allArtifacts, artifacts.length, webArtifacts.length); + return allArtifacts; + } + + } + + } Index: src/org/netbeans/modules/web/freeform/WebFreeformAntArtifact.java *** E:\sources\netbeans.org\release55\web\freeform\src\org\netbeans\modules\web\freeform\WebFreeformAntArtifact.java No Base Revision --- E:\sources\netbeans.org\release55\web\freeform\src\org\netbeans\modules\web\freeform\WebFreeformAntArtifact.java Locally New *************** *** 1,0 **** --- 1,63 ---- + /* + * The contents of this file are subject to the terms of the Common Development + * and Distribution License (the License). You may not use this file except in + * compliance with the License. + * + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html + * or http://www.netbeans.org/cddl.txt. + * + * When distributing Covered Code, include this CDDL Header Notice in each file + * and include the License file at http://www.netbeans.org/cddl.txt. + * If applicable, add the following below the CDDL Header, with the fields + * enclosed by brackets [] replaced by your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + */ + + package org.netbeans.modules.web.freeform; + + import java.io.File; + import java.net.URI; + + import org.netbeans.api.project.ant.AntArtifact; + import org.netbeans.modules.web.api.webmodule.WebProjectConstants; + + /** + * Simple implementation of AntArtifact that just copies another AntArtifact + * and replaces its type by ARTIFACT_TYPE_WAR_EAR_ARCHIVE + * + * @author Milan Kubec + */ + public class WebFreeformAntArtifact extends AntArtifact { + + private AntArtifact aa; + + public WebFreeformAntArtifact(AntArtifact aa) { + super(); + this.aa = aa; + } + + public String getType() { + return WebProjectConstants.ARTIFACT_TYPE_WAR_EAR_ARCHIVE; + } + + public File getScriptLocation() { + return aa.getScriptLocation(); + } + + public String getTargetName() { + return aa.getTargetName(); + } + + public String getCleanTargetName() { + return aa.getCleanTargetName(); + } + + public URI[] getArtifactLocations() { + return aa.getArtifactLocations(); + } + + }