Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
View | Details | Raw Unified | Return to bug 93509 | Differences between
and this patch

Collapse All | Expand All

(-)javawebstart/nbproject/project.xml (-1 / +1 lines)
 Lines 47-53    Link Here 
47
                    <compile-dependency/>
47
                    <compile-dependency/>
48
                    <run-dependency>
48
                    <run-dependency>
49
                        <release-version>1</release-version>
49
                        <release-version>1</release-version>
50
                        <specification-version>1.14</specification-version>
50
                        <specification-version>1.16</specification-version>
51
                    </run-dependency>
51
                    </run-dependency>
52
                </dependency>
52
                </dependency>
53
                <dependency>
53
                <dependency>
(-)javawebstart/src/org/netbeans/modules/javawebstart/ui/customizer/JWSCompositeCategoryProvider.java (-13 / +56 lines)
 Lines 27-36    Link Here 
27
import java.util.Collection;
27
import java.util.Collection;
28
import java.util.Properties;
28
import java.util.Properties;
29
import java.util.ResourceBundle;
29
import java.util.ResourceBundle;
30
import java.util.logging.Level;
31
import java.util.logging.Logger;
30
import javax.swing.JComponent;
32
import javax.swing.JComponent;
31
33
32
import org.netbeans.api.project.Project;
34
import org.netbeans.api.project.Project;
33
import org.netbeans.api.project.ProjectManager;
35
import org.netbeans.api.project.ProjectManager;
36
import org.netbeans.api.project.ant.AntBuildExtender;
34
import org.netbeans.modules.java.j2seproject.api.J2SEProjectConfigurations;
37
import org.netbeans.modules.java.j2seproject.api.J2SEProjectConfigurations;
35
import org.netbeans.spi.project.ProjectConfiguration;
38
import org.netbeans.spi.project.ProjectConfiguration;
36
import org.netbeans.spi.project.ProjectConfigurationProvider;
39
import org.netbeans.spi.project.ProjectConfigurationProvider;
 Lines 49-55    Link Here 
49
import org.openide.xml.XMLUtil;
52
import org.openide.xml.XMLUtil;
50
import org.w3c.dom.Document;
53
import org.w3c.dom.Document;
51
import org.w3c.dom.Element;
54
import org.w3c.dom.Element;
52
import org.w3c.dom.Node;
53
import org.w3c.dom.NodeList;
55
import org.w3c.dom.NodeList;
54
import org.xml.sax.InputSource;
56
import org.xml.sax.InputSource;
55
import org.xml.sax.SAXException;
57
import org.xml.sax.SAXException;
 Lines 175-193    Link Here 
175
            } catch (SAXException ex) {
177
            } catch (SAXException ex) {
176
                ErrorManager.getDefault().notify(ex);
178
                ErrorManager.getDefault().notify(ex);
177
            }
179
            }
178
            // XXX test if it's already modified - then do not save!
180
            FileObject jnlpBuildFile = projDir.getFileObject("nbproject/jnlp-impl.xml"); // NOI18N
181
            AntBuildExtender extender = proj.getLookup().lookup(AntBuildExtender.class);
182
            if (extender != null) {
183
                assert jnlpBuildFile != null;
184
                if (extender.getExtension("jws") == null) {
185
                    AntBuildExtender.Extension ext = extender.addExtension("jws", jnlpBuildFile);
186
                    ext.addDependency("jar", "jnlp");
187
                }
188
                ProjectManager.getDefault().saveProject(proj);
189
            } else {
190
                Logger.getLogger(JWSCompositeCategoryProvider.class.getName()).log(Level.INFO, 
191
                        "Trying to include JWS build snippet in project type that doesn't support AntBuildExtender API contract.");
192
            }
193
            
194
            //TODO this piece shall not proceed when the upgrade to j2se-project/4 was cancelled.
195
            //how to figure..
179
            Element docElem = xmlDoc.getDocumentElement();
196
            Element docElem = xmlDoc.getDocumentElement();
180
            NodeList nl = docElem.getElementsByTagName("import"); // NOI18N
197
            NodeList nl = docElem.getElementsByTagName("target"); // NOI18N
181
            if (nl.getLength() == 1) {
198
            Element target = null;
182
                Element importElem = xmlDoc.createElement("import"); // NOI18N
199
            for (int i = 0; i < nl.getLength(); i++) {
183
                importElem.setAttribute("file", "nbproject/jnlp-impl.xml");  // NOI18N
200
                Element e = (Element) nl.item(i);
184
                Node n = nl.item(0).getNextSibling();
201
                if (e.getAttribute("name") != null && "-post-jar".equals(e.getAttribute("name"))) {
185
                docElem.insertBefore(importElem, n);
202
                    target = e;
186
                Element targetElem = xmlDoc.createElement("target"); // NOI18N
203
                    break;
187
                targetElem.setAttribute("name", "-post-jar"); // NOI18N
204
                }
188
                targetElem.setAttribute("depends", "jnlp"); // NOI18N
205
            }
189
                n = importElem.getNextSibling();
206
            boolean changed = false;
190
                docElem.insertBefore(targetElem, n);
207
            if (target != null) {
208
                if ((target.getAttribute("depends") != null && target.getAttribute("depends").contains("jnlp"))) {
209
                    String old = target.getAttribute("depends");
210
                    old = old.replaceAll("jnlp", "");
211
                    old = old.replaceAll(",[\\s]*$", "");
212
                    old = old.replaceAll("^[\\s]*,", "");
213
                    old = old.replaceAll(",[\\s]*,", ",");
214
                    old = old.trim();
215
                    if (old.length() == 0) {
216
                        target.removeAttribute("depends");
217
                    } else {
218
                        target.setAttribute("depends", old); // NOI18N
219
                    }
220
                    changed = true;
221
                }
222
            }
223
            nl = docElem.getElementsByTagName("import");
224
            for (int i = 0; i < nl.getLength(); i++) {
225
                Element e = (Element) nl.item(i);
226
                if (e.getAttribute("file") != null && "nbproject/jnlp-impl.xml".equals(e.getAttribute("file"))) {
227
                    e.getParentNode().removeChild(e);
228
                    changed = true;
229
                    break;
230
                }
231
            }
232
            
233
            if (changed) {
191
                final Document fdoc = xmlDoc;
234
                final Document fdoc = xmlDoc;
192
                try {
235
                try {
193
                    ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
236
                    ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {

Return to bug 93509
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo