This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 186930
Collapse All | Expand All

(-)a/ant.freeform/nbproject/project.xml (-1 / +1 lines)
Lines 163-169 Link Here
163
                    <build-prerequisite/>
163
                    <build-prerequisite/>
164
                    <compile-dependency/>
164
                    <compile-dependency/>
165
                    <run-dependency>
165
                    <run-dependency>
166
                        <specification-version>8.6</specification-version>
166
                        <specification-version>8.8</specification-version>
167
                    </run-dependency>
167
                    </run-dependency>
168
                </dependency>
168
                </dependency>
169
                <dependency>
169
                <dependency>
(-)a/ant.freeform/src/org/netbeans/modules/ant/freeform/FreeformProject.java (-17 / +5 lines)
Lines 73-79 Link Here
73
import org.openide.util.lookup.Lookups;
73
import org.openide.util.lookup.Lookups;
74
import org.openide.xml.XMLUtil;
74
import org.openide.xml.XMLUtil;
75
import org.w3c.dom.Element;
75
import org.w3c.dom.Element;
76
import org.w3c.dom.NodeList;
77
76
78
/**
77
/**
79
 * One freeform project.
78
 * One freeform project.
Lines 167-191 Link Here
167
    
166
    
168
    /** Store configured project name. */
167
    /** Store configured project name. */
169
    public void setName(final String name) {
168
    public void setName(final String name) {
170
        ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
169
        ProjectManager.mutex().writeAccess(new Runnable() {
171
            public Void run() {
170
            public void run() {
172
                Element data = getPrimaryConfigurationData();
171
                Element data = getPrimaryConfigurationData();
173
                // XXX replace by XMLUtil when that has findElement, findText, etc.
172
                Element nameElement = XMLUtil.changeElementText(data, "name", FreeformProjectType.NS_GENERAL, name, true);
174
                NodeList nl = data.getElementsByTagNameNS(FreeformProjectType.NS_GENERAL, "name");
173
                if (nameElement == null) {
175
                Element nameEl;
174
                     XMLUtil.insertTextNode(data, "name", FreeformProjectType.NS_GENERAL, name, data.getChildNodes().item(0));
176
                if (nl.getLength() == 1) {
177
                    nameEl = (Element) nl.item(0);
178
                    NodeList deadKids = nameEl.getChildNodes();
179
                    while (deadKids.getLength() > 0) {
180
                        nameEl.removeChild(deadKids.item(0));
181
                    }
182
                } else {
183
                    nameEl = data.getOwnerDocument().createElementNS(FreeformProjectType.NS_GENERAL, "name");
184
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
185
                }
175
                }
186
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
187
                putPrimaryConfigurationData(data);
176
                putPrimaryConfigurationData(data);
188
                return null;
189
            }
177
            }
190
        });
178
        });
191
    }
179
    }
(-)a/cnd.makeproject/nbproject/project.xml (-1 / +1 lines)
Lines 256-262 Link Here
256
                    <build-prerequisite/>
256
                    <build-prerequisite/>
257
                    <compile-dependency/>
257
                    <compile-dependency/>
258
                    <run-dependency>
258
                    <run-dependency>
259
                        <specification-version>8.0</specification-version>
259
                        <specification-version>8.8</specification-version>
260
                    </run-dependency>
260
                    </run-dependency>
261
                </dependency>
261
                </dependency>
262
                <dependency>
262
                <dependency>
(-)a/cnd.makeproject/src/org/netbeans/modules/cnd/makeproject/MakeProject.java (-26 / +8 lines)
Lines 129-139 Link Here
129
import org.openide.util.NbBundle;
129
import org.openide.util.NbBundle;
130
import org.openide.util.WeakListeners;
130
import org.openide.util.WeakListeners;
131
import org.openide.util.lookup.Lookups;
131
import org.openide.util.lookup.Lookups;
132
import org.openide.xml.XMLUtil;
132
import org.openidex.search.SearchInfo;
133
import org.openidex.search.SearchInfo;
133
import org.w3c.dom.Element;
134
import org.w3c.dom.Element;
134
import org.w3c.dom.NodeList;
135
import org.w3c.dom.NodeList;
135
import org.w3c.dom.Node;
136
import org.w3c.dom.Node;
136
import org.w3c.dom.Text;
137
137
138
/**
138
/**
139
 * Represents one plain Make project.
139
 * Represents one plain Make project.
Lines 577-617 Link Here
577
            @Override
577
            @Override
578
            public String run() {
578
            public String run() {
579
                Element data = helper.getPrimaryConfigurationData(true);
579
                Element data = helper.getPrimaryConfigurationData(true);
580
                // XXX replace by XMLUtil when that has findElement, findText, etc.
580
                Element element = XMLUtil.findElement(data, "name", MakeProjectType.PROJECT_CONFIGURATION_NAMESPACE);
581
                NodeList nl = data.getElementsByTagNameNS(MakeProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
581
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
582
                if (nl.getLength() == 1) {
583
                    nl = nl.item(0).getChildNodes();
584
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
585
                        return ((Text) nl.item(0)).getNodeValue();
586
                    }
587
                }
588
                return "???"; // NOI18N
589
            }
582
            }
590
        });
583
        });
591
    }
584
    }
592
585
593
    public void setName(final String name) {
586
    public void setName(final String name) {
594
        ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
587
        ProjectManager.mutex().writeAccess(new Runnable() {
595
588
596
            @Override
589
            @Override
597
            public Void run() {
590
            public void run() {
598
                Element data = helper.getPrimaryConfigurationData(true);
591
                Element data = helper.getPrimaryConfigurationData(true);
599
                // XXX replace by XMLUtil when that has findElement, findText, etc.
592
                Element nameElement = XMLUtil.changeElementText(data, "name", MakeProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
600
                NodeList nl = data.getElementsByTagNameNS(MakeProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
593
                if (nameElement == null) {
601
                Element nameEl;
594
                     XMLUtil.insertTextNode(data, "name", MakeProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
602
                if (nl.getLength() == 1) {
603
                    nameEl = (Element) nl.item(0);
604
                    NodeList deadKids = nameEl.getChildNodes();
605
                    while (deadKids.getLength() > 0) {
606
                        nameEl.removeChild(deadKids.item(0));
607
                    }
608
                } else {
609
                    nameEl = data.getOwnerDocument().createElementNS(MakeProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
610
                    data.insertBefore(nameEl, data.getChildNodes().item(0));
611
                }
595
                }
612
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
613
                helper.putPrimaryConfigurationData(data, true);
596
                helper.putPrimaryConfigurationData(data, true);
614
                return null;
615
            }
597
            }
616
        });
598
        });
617
    }
599
    }
(-)a/compapp.projects.base/nbproject/project.xml (-1 / +1 lines)
Lines 293-299 Link Here
293
                    <build-prerequisite/>
293
                    <build-prerequisite/>
294
                    <compile-dependency/>
294
                    <compile-dependency/>
295
                    <run-dependency>
295
                    <run-dependency>
296
                        <specification-version>8.0</specification-version>
296
                        <specification-version>8.8</specification-version>
297
                    </run-dependency>
297
                    </run-dependency>
298
                </dependency>
298
                </dependency>
299
                <dependency>
299
                <dependency>
(-)a/compapp.projects.base/src/org/netbeans/modules/compapp/projects/base/IcanproProject.java (-16 / +5 lines)
Lines 24-30 Link Here
24
import java.nio.charset.Charset;
24
import java.nio.charset.Charset;
25
import java.nio.charset.IllegalCharsetNameException;
25
import java.nio.charset.IllegalCharsetNameException;
26
import java.nio.charset.UnsupportedCharsetException;
26
import java.nio.charset.UnsupportedCharsetException;
27
import java.util.*;
28
import java.util.logging.Logger;
27
import java.util.logging.Logger;
29
import javax.swing.Icon;
28
import javax.swing.Icon;
30
import javax.swing.ImageIcon;
29
import javax.swing.ImageIcon;
Lines 57-70 Link Here
57
import org.openide.util.ImageUtilities;
56
import org.openide.util.ImageUtilities;
58
import org.openide.util.Lookup;
57
import org.openide.util.Lookup;
59
import org.openide.util.Mutex;
58
import org.openide.util.Mutex;
60
import org.openide.util.Utilities;
61
import org.openide.util.lookup.Lookups;
59
import org.openide.util.lookup.Lookups;
62
import org.netbeans.spi.project.AuxiliaryConfiguration;
60
import org.netbeans.spi.project.AuxiliaryConfiguration;
63
import org.netbeans.spi.project.support.ant.EditableProperties;
61
import org.netbeans.spi.project.support.ant.EditableProperties;
62
import org.openide.xml.XMLUtil;
64
import org.w3c.dom.Element;
63
import org.w3c.dom.Element;
65
import org.w3c.dom.Node;
66
import org.w3c.dom.NodeList;
67
import org.w3c.dom.Text;
68
64
69
/**
65
/**
70
 * Represents one ejb module project
66
 * Represents one ejb module project
Lines 189-206 Link Here
189
185
190
    /** Return configured project name. */
186
    /** Return configured project name. */
191
    public String getName() {
187
    public String getName() {
192
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
188
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
193
            public Object run() {
189
            public String run() {
194
                Element data = helper.getPrimaryConfigurationData(true);
190
                Element data = helper.getPrimaryConfigurationData(true);
195
                // XXX replace by XMLUtil when that has findElement, findText, etc.
191
                Element element = XMLUtil.findElement(data, "name", IcanproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
196
                NodeList nl = data.getElementsByTagNameNS(IcanproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
192
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
197
                if (nl.getLength() == 1) {
198
                    nl = nl.item(0).getChildNodes();
199
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
200
                        return ((Text) nl.item(0)).getNodeValue();
201
                    }
202
                }
203
                return "???"; // NOI18N
204
            }
193
            }
205
        });
194
        });
206
    }
195
    }
(-)a/compapp.projects.jbi/nbproject/project.xml (-16 / +16 lines)
Lines 112-123 Link Here
112
                    </run-dependency>
112
                    </run-dependency>
113
                </dependency>
113
                </dependency>
114
                <dependency>
114
                <dependency>
115
                    <code-name-base>org.netbeans.modules.keyring</code-name-base>
116
                    <build-prerequisite/>
117
                    <compile-dependency/>
118
                    <run-dependency/>
119
                </dependency>
120
                <dependency>
121
                    <code-name-base>org.netbeans.api.visual</code-name-base>
115
                    <code-name-base>org.netbeans.api.visual</code-name-base>
122
                    <build-prerequisite/>
116
                    <build-prerequisite/>
123
                    <compile-dependency/>
117
                    <compile-dependency/>
Lines 126-140 Link Here
126
                    </run-dependency>
120
                    </run-dependency>
127
                </dependency>
121
                </dependency>
128
                <dependency>
122
                <dependency>
129
                    <code-name-base>org.netbeans.modules.xml.jaxb.api</code-name-base>
130
                    <build-prerequisite/>
131
                    <compile-dependency/>
132
                    <run-dependency>
133
                        <release-version>1</release-version>
134
                        <specification-version>1.2.1</specification-version>
135
                    </run-dependency>
136
                </dependency>
137
                <dependency>
138
                    <code-name-base>org.netbeans.libs.xerces</code-name-base>
123
                    <code-name-base>org.netbeans.libs.xerces</code-name-base>
139
                    <build-prerequisite/>
124
                    <build-prerequisite/>
140
                    <compile-dependency/>
125
                    <compile-dependency/>
Lines 214-219 Link Here
214
                    </run-dependency>
199
                    </run-dependency>
215
                </dependency>
200
                </dependency>
216
                <dependency>
201
                <dependency>
202
                    <code-name-base>org.netbeans.modules.keyring</code-name-base>
203
                    <build-prerequisite/>
204
                    <compile-dependency/>
205
                    <run-dependency/>
206
                </dependency>
207
                <dependency>
217
                    <code-name-base>org.netbeans.modules.project.ant</code-name-base>
208
                    <code-name-base>org.netbeans.modules.project.ant</code-name-base>
218
                    <build-prerequisite/>
209
                    <build-prerequisite/>
219
                    <compile-dependency/>
210
                    <compile-dependency/>
Lines 259-264 Link Here
259
                    </run-dependency>
250
                    </run-dependency>
260
                </dependency>
251
                </dependency>
261
                <dependency>
252
                <dependency>
253
                    <code-name-base>org.netbeans.modules.xml.jaxb.api</code-name-base>
254
                    <build-prerequisite/>
255
                    <compile-dependency/>
256
                    <run-dependency>
257
                        <release-version>1</release-version>
258
                        <specification-version>1.2.1</specification-version>
259
                    </run-dependency>
260
                </dependency>
261
                <dependency>
262
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
262
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
263
                    <build-prerequisite/>
263
                    <build-prerequisite/>
264
                    <compile-dependency/>
264
                    <compile-dependency/>
Lines 429-435 Link Here
429
                    <build-prerequisite/>
429
                    <build-prerequisite/>
430
                    <compile-dependency/>
430
                    <compile-dependency/>
431
                    <run-dependency>
431
                    <run-dependency>
432
                        <specification-version>8.0</specification-version>
432
                        <specification-version>8.8</specification-version>
433
                    </run-dependency>
433
                    </run-dependency>
434
                </dependency>
434
                </dependency>
435
                <dependency>
435
                <dependency>
(-)a/compapp.projects.jbi/src/org/netbeans/modules/compapp/projects/jbi/JbiProject.java (-36 / +10 lines)
Lines 74-82 Link Here
74
import org.openide.util.lookup.Lookups;
74
import org.openide.util.lookup.Lookups;
75
import org.openide.windows.TopComponent;
75
import org.openide.windows.TopComponent;
76
import org.w3c.dom.Element;
76
import org.w3c.dom.Element;
77
import org.w3c.dom.Node;
78
import org.w3c.dom.NodeList;
77
import org.w3c.dom.NodeList;
79
import org.w3c.dom.Text;
80
import java.beans.PropertyChangeListener;
78
import java.beans.PropertyChangeListener;
81
import java.beans.PropertyChangeSupport;
79
import java.beans.PropertyChangeSupport;
82
import java.io.File;
80
import java.io.File;
Lines 98-103 Link Here
98
import org.openide.filesystems.FileChangeListener;
96
import org.openide.filesystems.FileChangeListener;
99
import org.openide.filesystems.FileUtil;
97
import org.openide.filesystems.FileUtil;
100
import org.openide.util.ImageUtilities;
98
import org.openide.util.ImageUtilities;
99
import org.openide.xml.XMLUtil;
101
100
102
/**
101
/**
103
 * Represents one Composite Application (JBI) Project.
102
 * Represents one Composite Application (JBI) Project.
Lines 389-413 Link Here
389
     * @return DOCUMENT ME!
388
     * @return DOCUMENT ME!
390
     */
389
     */
391
    public String getName() {
390
    public String getName() {
392
        return (String) ProjectManager.mutex().readAccess(
391
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
393
                new Mutex.Action() {
392
            public String run() {
394
            public Object run() {
395
                Element data = helper.getPrimaryConfigurationData(true);
393
                Element data = helper.getPrimaryConfigurationData(true);
396
                
394
                Element element = XMLUtil.findElement(data, "name", JbiProjectType.PROJECT_CONFIGURATION_NAMESPACE);
397
                // XXX replace by XMLUtil when that has findElement, findText, etc.
395
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
398
                NodeList nl = data.getElementsByTagNameNS(
399
                        JbiProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name" // NOI18N
400
                        );
401
                
402
                if (nl.getLength() == 1) {
403
                    nl = nl.item(0).getChildNodes();
404
                    
405
                    if ((nl.getLength() == 1) && (nl.item(0).getNodeType() == Node.TEXT_NODE)) {
406
                        return ((Text) nl.item(0)).getNodeValue();
407
                    }
408
                }
409
                
410
                return "???"; // NOI18N
411
            }
396
            }
412
        }
397
        }
413
        );
398
        );
Lines 415-439 Link Here
415
    
400
    
416
    /** Store configured project name. */
401
    /** Store configured project name. */
417
    public void setName(final String name) {
402
    public void setName(final String name) {
418
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
403
        ProjectManager.mutex().writeAccess(new Runnable() {
419
            public Object run() {
404
            public void run() {
420
                Element data = helper.getPrimaryConfigurationData(true);
405
                Element data = helper.getPrimaryConfigurationData(true);
421
                // XXX replace by XMLUtil when that has findElement, findText, etc.
406
                Element nameElement = XMLUtil.changeElementText(data, "name", JbiProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
422
                NodeList nl = data.getElementsByTagNameNS(JbiProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
407
                if (nameElement == null) {
423
                Element nameEl;
408
                     XMLUtil.insertTextNode(data, "name", JbiProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
424
                if (nl.getLength() == 1) {
425
                    nameEl = (Element) nl.item(0);
426
                    NodeList deadKids = nameEl.getChildNodes();
427
                    while (deadKids.getLength() > 0) {
428
                        nameEl.removeChild(deadKids.item(0));
429
                    }
430
                } else {
431
                    nameEl = data.getOwnerDocument().createElementNS(JbiProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
432
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
433
                }
409
                }
434
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
435
                helper.putPrimaryConfigurationData(data, true);
410
                helper.putPrimaryConfigurationData(data, true);
436
                return null;
437
            }
411
            }
438
        });
412
        });
439
    }
413
    }
(-)a/edm.project/nbproject/project.xml (-1 / +1 lines)
Lines 215-221 Link Here
215
                    <build-prerequisite/>
215
                    <build-prerequisite/>
216
                    <compile-dependency/>
216
                    <compile-dependency/>
217
                    <run-dependency>
217
                    <run-dependency>
218
                        <specification-version>8.0</specification-version>
218
                        <specification-version>8.8</specification-version>
219
                    </run-dependency>
219
                    </run-dependency>
220
                </dependency>
220
                </dependency>
221
                <dependency>
221
                <dependency>
(-)a/edm.project/src/org/netbeans/modules/edm/project/EdmproProject.java (-29 / +11 lines)
Lines 58-67 Link Here
58
import org.netbeans.spi.project.AuxiliaryConfiguration;
58
import org.netbeans.spi.project.AuxiliaryConfiguration;
59
import org.netbeans.spi.project.support.ant.EditableProperties;
59
import org.netbeans.spi.project.support.ant.EditableProperties;
60
import org.openide.modules.InstalledFileLocator;
60
import org.openide.modules.InstalledFileLocator;
61
import org.openide.xml.XMLUtil;
61
import org.w3c.dom.Element;
62
import org.w3c.dom.Element;
62
import org.w3c.dom.Node;
63
import org.w3c.dom.NodeList;
64
import org.w3c.dom.Text;
65
63
66
/**
64
/**
67
 * Represents one ejb module project
65
 * Represents one ejb module project
Lines 208-226 Link Here
208
206
209
    /** Return configured project name. */
207
    /** Return configured project name. */
210
    public String getName() {
208
    public String getName() {
211
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
209
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
212
210
213
            public Object run() {
211
            public String run() {
214
                Element data = helper.getPrimaryConfigurationData(true);
212
                Element data = helper.getPrimaryConfigurationData(true);
215
                // XXX replace by XMLUtil when that has findElement, findText, etc.
213
                Element element = XMLUtil.findElement(data, "name", EdmproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
216
                NodeList nl = data.getElementsByTagNameNS(EdmproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
214
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
217
                if (nl.getLength() == 1) {
218
                    nl = nl.item(0).getChildNodes();
219
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
220
                        return ((Text) nl.item(0)).getNodeValue();
221
                    }
222
                }
223
                return "???"; // NOI18N
224
            }
215
            }
225
        });
216
        });
226
    }
217
    }
Lines 418-442 Link Here
418
    }
409
    }
419
410
420
    public void setName(final String name) {
411
    public void setName(final String name) {
421
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
412
        ProjectManager.mutex().writeAccess(new Runnable() {
422
413
423
            public Object run() {
414
            public void run() {
424
                Element data = helper.getPrimaryConfigurationData(true);
415
                Element data = helper.getPrimaryConfigurationData(true);
425
                NodeList nl = data.getElementsByTagNameNS(EdmproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
416
                Element nameElement = XMLUtil.changeElementText(data, "name", EdmproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
426
                Element nameEl;
417
                if (nameElement == null) {
427
                if (nl.getLength() == 1) {
418
                     XMLUtil.insertTextNode(data, "name", EdmproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
428
                    nameEl = (Element) nl.item(0);
429
                    NodeList deadKids = nameEl.getChildNodes();
430
                    while (deadKids.getLength() > 0) {
431
                        nameEl.removeChild(deadKids.item(0));
432
                    }
433
                } else {
434
                    nameEl = data.getOwnerDocument().createElementNS(EdmproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
435
                    data.insertBefore(nameEl, data.getChildNodes().item(0));
436
                }
419
                }
437
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
420
438
                helper.putPrimaryConfigurationData(data, true);
421
                helper.putPrimaryConfigurationData(data, true);
439
                return null;
440
            }
422
            }
441
        });
423
        });
442
    }
424
    }
(-)a/etl.project/nbproject/project.xml (-1 / +1 lines)
Lines 239-245 Link Here
239
                    <build-prerequisite/>
239
                    <build-prerequisite/>
240
                    <compile-dependency/>
240
                    <compile-dependency/>
241
                    <run-dependency>
241
                    <run-dependency>
242
                        <specification-version>7.12</specification-version>
242
                        <specification-version>8.8</specification-version>
243
                    </run-dependency>
243
                    </run-dependency>
244
                </dependency>
244
                </dependency>
245
                <dependency>
245
                <dependency>
(-)a/etl.project/src/org/netbeans/modules/etl/project/EtlproProject.java (-29 / +10 lines)
Lines 60-69 Link Here
60
import org.netbeans.spi.project.support.ant.EditableProperties;
60
import org.netbeans.spi.project.support.ant.EditableProperties;
61
import org.openide.modules.InstalledFileLocator;
61
import org.openide.modules.InstalledFileLocator;
62
import org.openide.util.ImageUtilities;
62
import org.openide.util.ImageUtilities;
63
import org.openide.xml.XMLUtil;
63
import org.w3c.dom.Element;
64
import org.w3c.dom.Element;
64
import org.w3c.dom.Node;
65
import org.w3c.dom.NodeList;
66
import org.w3c.dom.Text;
67
65
68
/**
66
/**
69
 * Represents one ejb module project
67
 * Represents one ejb module project
Lines 207-225 Link Here
207
205
208
    /** Return configured project name. */
206
    /** Return configured project name. */
209
    public String getName() {
207
    public String getName() {
210
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
208
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
211
209
212
            public Object run() {
210
            public String run() {
213
                Element data = helper.getPrimaryConfigurationData(true);
211
                Element data = helper.getPrimaryConfigurationData(true);
214
                // XXX replace by XMLUtil when that has findElement, findText, etc.
212
                Element element = XMLUtil.findElement(data, "name", EtlproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
215
                NodeList nl = data.getElementsByTagNameNS(EtlproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
213
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
216
                if (nl.getLength() == 1) {
217
                    nl = nl.item(0).getChildNodes();
218
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
219
                        return ((Text) nl.item(0)).getNodeValue();
220
                    }
221
                }
222
                return "???"; // NOI18N
223
            }
214
            }
224
        });
215
        });
225
    }
216
    }
Lines 336-359 Link Here
336
    }
327
    }
337
328
338
        public void setName(final String name) {
329
        public void setName(final String name) {
339
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
330
        ProjectManager.mutex().writeAccess(new Runnable() {
340
            public Object run() {
331
            public void run() {
341
                Element data = helper.getPrimaryConfigurationData(true);
332
                Element data = helper.getPrimaryConfigurationData(true);
342
                NodeList nl = data.getElementsByTagNameNS(EtlproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
333
                Element nameElement = XMLUtil.changeElementText(data, "name", EtlproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
343
                Element nameEl;
334
                if (nameElement == null) {
344
                if (nl.getLength() == 1) {
335
                     XMLUtil.insertTextNode(data, "name", EtlproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
345
                    nameEl = (Element) nl.item(0);
346
                    NodeList deadKids = nameEl.getChildNodes();
347
                    while (deadKids.getLength() > 0) {
348
                        nameEl.removeChild(deadKids.item(0));
349
                    }
350
                } else {
351
                    nameEl = data.getOwnerDocument().createElementNS(EtlproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
352
                    data.insertBefore(nameEl, data.getChildNodes().item(0));
353
                }
336
                }
354
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
355
                helper.putPrimaryConfigurationData(data, true);
337
                helper.putPrimaryConfigurationData(data, true);
356
                return null;
357
            }
338
            }
358
        });
339
        });
359
    }
340
    }
(-)a/iep.project/nbproject/project.xml (-9 / +9 lines)
Lines 139-144 Link Here
139
                    </run-dependency>
139
                    </run-dependency>
140
                </dependency>
140
                </dependency>
141
                <dependency>
141
                <dependency>
142
                    <code-name-base>org.netbeans.modules.xml.catalogsupport</code-name-base>
143
                    <build-prerequisite/>
144
                    <compile-dependency/>
145
                    <run-dependency>
146
                        <specification-version>1.0</specification-version>
147
                    </run-dependency>
148
                </dependency>
149
                <dependency>
142
                    <code-name-base>org.netbeans.modules.xml.misc</code-name-base>
150
                    <code-name-base>org.netbeans.modules.xml.misc</code-name-base>
143
                    <build-prerequisite/>
151
                    <build-prerequisite/>
144
                    <compile-dependency/>
152
                    <compile-dependency/>
Lines 147-160 Link Here
147
                    </run-dependency>
155
                    </run-dependency>
148
                </dependency>
156
                </dependency>
149
                <dependency>
157
                <dependency>
150
                    <code-name-base>org.netbeans.modules.xml.catalogsupport</code-name-base>
151
                    <build-prerequisite/>
152
                    <compile-dependency/>
153
                    <run-dependency>
154
                        <specification-version>1.0</specification-version>
155
                    </run-dependency>
156
                </dependency>
157
                <dependency>
158
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
158
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
159
                    <build-prerequisite/>
159
                    <build-prerequisite/>
160
                    <compile-dependency/>
160
                    <compile-dependency/>
Lines 241-247 Link Here
241
                    <build-prerequisite/>
241
                    <build-prerequisite/>
242
                    <compile-dependency/>
242
                    <compile-dependency/>
243
                    <run-dependency>
243
                    <run-dependency>
244
                        <specification-version>6.5.1</specification-version>
244
                        <specification-version>8.8</specification-version>
245
                    </run-dependency>
245
                    </run-dependency>
246
                </dependency>
246
                </dependency>
247
                <dependency>
247
                <dependency>
(-)a/iep.project/src/org/netbeans/modules/iep/project/IepProject.java (-27 / +10 lines)
Lines 62-67 Link Here
62
import org.openide.util.Mutex;
62
import org.openide.util.Mutex;
63
import org.openide.util.Utilities;
63
import org.openide.util.Utilities;
64
import org.openide.util.lookup.Lookups;
64
import org.openide.util.lookup.Lookups;
65
import org.openide.xml.XMLUtil;
65
import org.w3c.dom.Element;
66
import org.w3c.dom.Element;
66
import org.w3c.dom.Node;
67
import org.w3c.dom.Node;
67
import org.w3c.dom.NodeList;
68
import org.w3c.dom.NodeList;
Lines 205-222 Link Here
205
206
206
    /** Return configured project name. */
207
    /** Return configured project name. */
207
    public String getName() {
208
    public String getName() {
208
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
209
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
209
            public Object run() {
210
            public String run() {
210
                Element data = helper.getPrimaryConfigurationData(true);
211
                Element data = helper.getPrimaryConfigurationData(true);
211
                // XXX replace by XMLUtil when that has findElement, findText, etc.
212
                Element element = XMLUtil.findElement(data, "name", IepProjectType.PROJECT_CONFIGURATION_NAMESPACE);
212
                NodeList nl = data.getElementsByTagNameNS(IepProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
213
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
213
                if (nl.getLength() == 1) {
214
                    nl = nl.item(0).getChildNodes();
215
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
216
                        return ((Text) nl.item(0)).getNodeValue();
217
                    }
218
                }
219
                return "???"; // NOI18N
220
            }
214
            }
221
        });
215
        });
222
    }
216
    }
Lines 227-251 Link Here
227
221
228
    /** Store configured project name. */
222
    /** Store configured project name. */
229
    public void setName(final String name) {
223
    public void setName(final String name) {
230
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
224
        ProjectManager.mutex().writeAccess(new Runnable() {
231
            public Object run() {
225
            public void run() {
232
                Element data = helper.getPrimaryConfigurationData(true);
226
                Element data = helper.getPrimaryConfigurationData(true);
233
                // XXX replace by XMLUtil when that has findElement, findText, etc.
227
                Element nameElement = XMLUtil.changeElementText(data, "name", IepProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
234
                NodeList nl = data.getElementsByTagNameNS(IepProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
228
                if (nameElement == null) {
235
                Element nameEl;
229
                     XMLUtil.insertTextNode(data, "name", IepProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
236
                if (nl.getLength() == 1) {
237
                    nameEl = (Element) nl.item(0);
238
                    NodeList deadKids = nameEl.getChildNodes();
239
                    while (deadKids.getLength() > 0) {
240
                        nameEl.removeChild(deadKids.item(0));
241
                    }
242
                } else {
243
                    nameEl = data.getOwnerDocument().createElementNS(IepProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
244
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
245
                }
230
                }
246
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
247
                helper.putPrimaryConfigurationData(data, true);
231
                helper.putPrimaryConfigurationData(data, true);
248
                return null;
249
            }
232
            }
250
        });
233
        });
251
    }
234
    }
(-)a/j2ee.archive/nbproject/project.xml (-1 / +1 lines)
Lines 306-312 Link Here
306
                    <build-prerequisite/>
306
                    <build-prerequisite/>
307
                    <compile-dependency/>
307
                    <compile-dependency/>
308
                    <run-dependency>
308
                    <run-dependency>
309
                        <specification-version>8.4</specification-version>
309
                        <specification-version>8.8</specification-version>
310
                    </run-dependency>
310
                    </run-dependency>
311
                </dependency>
311
                </dependency>
312
                <dependency>
312
                <dependency>
(-)a/j2ee.archive/src/org/netbeans/modules/j2ee/archive/project/ArchiveProject.java (-16 / +6 lines)
Lines 100-105 Link Here
100
import org.netbeans.spi.project.ui.support.UILookupMergerSupport;
100
import org.netbeans.spi.project.ui.support.UILookupMergerSupport;
101
import org.openide.util.Lookup.Item;
101
import org.openide.util.Lookup.Item;
102
import org.openide.util.Lookup.Result;
102
import org.openide.util.Lookup.Result;
103
import org.openide.xml.XMLUtil;
103
import org.w3c.dom.Element;
104
import org.w3c.dom.Element;
104
import org.w3c.dom.Node;
105
import org.w3c.dom.Node;
105
import org.w3c.dom.NodeList;
106
import org.w3c.dom.NodeList;
Lines 171-196 Link Here
171
    
172
    
172
    /** Store configured project name. */
173
    /** Store configured project name. */
173
    public void setName(final String name) {
174
    public void setName(final String name) {
174
        ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
175
        ProjectManager.mutex().writeAccess(new Runnable() {
175
            @Override
176
            @Override
176
            public Object run() {
177
            public void run() {
177
                Element data = helper.getPrimaryConfigurationData(true);
178
                Element data = helper.getPrimaryConfigurationData(true);
178
                // XXX replace by XMLUtil when that has findElement, findText, etc.
179
                Element nameElement = XMLUtil.changeElementText(data, NAME_LIT, ArchiveProjectType.PROJECT_CONFIGURATION_NS, name, true);
179
                NodeList nl = data.getElementsByTagNameNS(ArchiveProjectType.PROJECT_CONFIGURATION_NS, NAME_LIT);
180
                if (nameElement == null) {
180
                Element nameEl;
181
                     XMLUtil.insertTextNode(data, NAME_LIT, ArchiveProjectType.PROJECT_CONFIGURATION_NS, name, data.getChildNodes().item(0));
181
                if (nl.getLength() == 1) {
182
                    nameEl = (Element) nl.item(0);
183
                    NodeList deadKids = nameEl.getChildNodes();
184
                    while (deadKids.getLength() > 0) {
185
                        nameEl.removeChild(deadKids.item(0));
186
                    }
187
                } else {
188
                    nameEl = data.getOwnerDocument().createElementNS(ArchiveProjectType.PROJECT_CONFIGURATION_NS, NAME_LIT);
189
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
190
                }
182
                }
191
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
192
                helper.putPrimaryConfigurationData(data, true);
183
                helper.putPrimaryConfigurationData(data, true);
193
                return null;
194
            }
184
            }
195
        });
185
        });
196
    }
186
    }
(-)a/j2ee.clientproject/nbproject/project.xml (-1 / +1 lines)
Lines 387-393 Link Here
387
                    <build-prerequisite/>
387
                    <build-prerequisite/>
388
                    <compile-dependency/>
388
                    <compile-dependency/>
389
                    <run-dependency>
389
                    <run-dependency>
390
                        <specification-version>8.4</specification-version>
390
                        <specification-version>8.8</specification-version>
391
                    </run-dependency>
391
                    </run-dependency>
392
                </dependency>
392
                </dependency>
393
                <dependency>
393
                <dependency>
(-)a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/AppClientProject.java (-14 / +4 lines)
Lines 136-143 Link Here
136
import org.openide.util.NbBundle;
136
import org.openide.util.NbBundle;
137
import org.openide.util.RequestProcessor;
137
import org.openide.util.RequestProcessor;
138
import org.openide.util.lookup.Lookups;
138
import org.openide.util.lookup.Lookups;
139
import org.openide.xml.XMLUtil;
139
import org.w3c.dom.Element;
140
import org.w3c.dom.Element;
140
import org.w3c.dom.NodeList;
141
141
142
/**
142
/**
143
 * Represents one plain Application Client project.
143
 * Represents one plain Application Client project.
Lines 385-404 Link Here
385
        ProjectManager.mutex().writeAccess(new Runnable() {
385
        ProjectManager.mutex().writeAccess(new Runnable() {
386
            public void run() {
386
            public void run() {
387
                Element data = helper.getPrimaryConfigurationData(true);
387
                Element data = helper.getPrimaryConfigurationData(true);
388
                // XXX replace by XMLUtil when that has findElement, findText, etc.
388
                Element nameElement = XMLUtil.changeElementText(data, "name", AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
389
                NodeList nl = data.getElementsByTagNameNS(AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
389
                if (nameElement == null) {
390
                Element nameEl;
390
                     XMLUtil.insertTextNode(data, "name", AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
391
                if (nl.getLength() == 1) {
392
                    nameEl = (Element) nl.item(0);
393
                    NodeList deadKids = nameEl.getChildNodes();
394
                    while (deadKids.getLength() > 0) {
395
                        nameEl.removeChild(deadKids.item(0));
396
                    }
397
                } else {
398
                    nameEl = data.getOwnerDocument().createElementNS(AppClientProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
399
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
400
                }
391
                }
401
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
402
                helper.putPrimaryConfigurationData(data, true);
392
                helper.putPrimaryConfigurationData(data, true);
403
            }
393
            }
404
        });
394
        });
(-)a/j2ee.earproject/nbproject/project.xml (-1 / +1 lines)
Lines 350-356 Link Here
350
                    <build-prerequisite/>
350
                    <build-prerequisite/>
351
                    <compile-dependency/>
351
                    <compile-dependency/>
352
                    <run-dependency>
352
                    <run-dependency>
353
                        <specification-version>8.4</specification-version>
353
                        <specification-version>8.8</specification-version>
354
                    </run-dependency>
354
                    </run-dependency>
355
                </dependency>
355
                </dependency>
356
                <dependency>
356
                <dependency>
(-)a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/EarProject.java (-17 / +6 lines)
Lines 118-125 Link Here
118
import org.openide.util.Mutex;
118
import org.openide.util.Mutex;
119
import org.openide.util.NbBundle;
119
import org.openide.util.NbBundle;
120
import org.openide.util.lookup.Lookups;
120
import org.openide.util.lookup.Lookups;
121
import org.openide.xml.XMLUtil;
121
import org.w3c.dom.Element;
122
import org.w3c.dom.Element;
122
import org.w3c.dom.NodeList;
123
123
124
/**
124
/**
125
 * Represents an Enterprise Application project.
125
 * Represents an Enterprise Application project.
Lines 276-300 Link Here
276
    
276
    
277
    /** Store configured project name. */
277
    /** Store configured project name. */
278
    public void setName(final String name) {
278
    public void setName(final String name) {
279
        ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
279
        ProjectManager.mutex().writeAccess(new Runnable() {
280
            public Void run() {
280
            public void run() {
281
                Element data = helper.getPrimaryConfigurationData(true);
281
                Element data = helper.getPrimaryConfigurationData(true);
282
                // XXX replace by XMLUtil when that has findElement, findText, etc.
282
                Element nameElement = XMLUtil.changeElementText(data, "name", EarProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
283
                NodeList nl = data.getElementsByTagNameNS(EarProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
283
                if (nameElement == null) {
284
                Element nameEl;
284
                     XMLUtil.insertTextNode(data, "name", EarProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
285
                if (nl.getLength() == 1) {
286
                    nameEl = (Element) nl.item(0);
287
                    NodeList deadKids = nameEl.getChildNodes();
288
                    while (deadKids.getLength() > 0) {
289
                        nameEl.removeChild(deadKids.item(0));
290
                    }
291
                } else {
292
                    nameEl = data.getOwnerDocument().createElementNS(EarProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
293
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
294
                }
285
                }
295
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
296
                helper.putPrimaryConfigurationData(data, true);
286
                helper.putPrimaryConfigurationData(data, true);
297
                return null;
298
            }
287
            }
299
        });
288
        });
300
    }
289
    }
(-)a/j2ee.ejbjarproject/nbproject/project.xml (-1 / +1 lines)
Lines 453-459 Link Here
453
                    <build-prerequisite/>
453
                    <build-prerequisite/>
454
                    <compile-dependency/>
454
                    <compile-dependency/>
455
                    <run-dependency>
455
                    <run-dependency>
456
                        <specification-version>8.4</specification-version>
456
                        <specification-version>8.8</specification-version>
457
                    </run-dependency>
457
                    </run-dependency>
458
                </dependency>
458
                </dependency>
459
                <dependency>
459
                <dependency>
(-)a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java (-14 / +3 lines)
Lines 149-155 Link Here
149
import org.openide.util.NbBundle;
149
import org.openide.util.NbBundle;
150
import org.w3c.dom.Document;
150
import org.w3c.dom.Document;
151
import org.w3c.dom.Element;
151
import org.w3c.dom.Element;
152
import org.w3c.dom.NodeList;
153
import org.netbeans.modules.websvc.api.webservices.WebServicesSupport;
152
import org.netbeans.modules.websvc.api.webservices.WebServicesSupport;
154
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
153
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
155
import org.netbeans.modules.websvc.spi.webservices.WebServicesSupportFactory;
154
import org.netbeans.modules.websvc.spi.webservices.WebServicesSupportFactory;
Lines 573-592 Link Here
573
        ProjectManager.mutex().writeAccess(new Runnable() {
572
        ProjectManager.mutex().writeAccess(new Runnable() {
574
            public void run() {
573
            public void run() {
575
                Element data = helper.getPrimaryConfigurationData(true);
574
                Element data = helper.getPrimaryConfigurationData(true);
576
                // XXX replace by XMLUtil when that has findElement, findText, etc.
575
                Element nameElement = XMLUtil.changeElementText(data, "name", EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
577
                NodeList nl = data.getElementsByTagNameNS(EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); //NOI18N
576
                if (nameElement == null) {
578
                Element nameEl;
577
                     XMLUtil.insertTextNode(data, "name", EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
579
                if (nl.getLength() == 1) {
580
                    nameEl = (Element) nl.item(0);
581
                    NodeList deadKids = nameEl.getChildNodes();
582
                    while (deadKids.getLength() > 0) {
583
                        nameEl.removeChild(deadKids.item(0));
584
                    }
585
                } else {
586
                    nameEl = data.getOwnerDocument().createElementNS(EjbJarProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); //NOI18N
587
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
588
                }
578
                }
589
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
590
                helper.putPrimaryConfigurationData(data, true);
579
                helper.putPrimaryConfigurationData(data, true);
591
            }
580
            }
592
        });
581
        });
(-)a/java.j2seproject/nbproject/project.xml (-1 / +1 lines)
Lines 274-280 Link Here
274
                    <build-prerequisite/>
274
                    <build-prerequisite/>
275
                    <compile-dependency/>
275
                    <compile-dependency/>
276
                    <run-dependency>
276
                    <run-dependency>
277
                        <specification-version>8.6</specification-version>
277
                        <specification-version>8.8</specification-version>
278
                    </run-dependency>
278
                    </run-dependency>
279
                </dependency>
279
                </dependency>
280
                <dependency>
280
                <dependency>
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java (-17 / +7 lines)
Lines 44-49 Link Here
44
44
45
package org.netbeans.modules.java.j2seproject;
45
package org.netbeans.modules.java.j2seproject;
46
46
47
import org.openide.xml.XMLUtil;
47
import java.beans.PropertyChangeEvent;
48
import java.beans.PropertyChangeEvent;
48
import java.beans.PropertyChangeListener;
49
import java.beans.PropertyChangeListener;
49
import java.io.File;
50
import java.io.File;
Lines 417-445 Link Here
417
        return helper.resolveFile(testClassesDir);
418
        return helper.resolveFile(testClassesDir);
418
    }
419
    }
419
420
420
    // Currently unused (but see #47230):
421
    /** Store configured project name. */
421
    /** Store configured project name. */
422
    public void setName(final String name) {
422
    public void setName(final String name) {
423
        ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
423
        ProjectManager.mutex().writeAccess(new Runnable() {
424
            @Override
424
            @Override
425
            public Void run() {
425
            public void run() {
426
                Element data = helper.getPrimaryConfigurationData(true);
426
                Element data = helper.getPrimaryConfigurationData(true);
427
                // XXX replace by XMLUtil when that has findElement, findText, etc.
427
                Element nameElement = XMLUtil.changeElementText(data, "name", J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
428
                NodeList nl = data.getElementsByTagNameNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
428
                if (nameElement == null) {
429
                Element nameEl;
429
                     XMLUtil.insertTextNode(data, "name", J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
430
                if (nl.getLength() == 1) {
431
                    nameEl = (Element) nl.item(0);
432
                    NodeList deadKids = nameEl.getChildNodes();
433
                    while (deadKids.getLength() > 0) {
434
                        nameEl.removeChild(deadKids.item(0));
435
                    }
436
                } else {
437
                    nameEl = data.getOwnerDocument().createElementNS(J2SEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
438
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
439
                }
430
                }
440
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
441
                helper.putPrimaryConfigurationData(data, true);
431
                helper.putPrimaryConfigurationData(data, true);
442
                return null;
432
                return;
443
            }
433
            }
444
        });
434
        });
445
    }
435
    }
(-)a/javacard.project/nbproject/project.xml (-1 / +1 lines)
Lines 309-315 Link Here
309
                    <build-prerequisite/>
309
                    <build-prerequisite/>
310
                    <compile-dependency/>
310
                    <compile-dependency/>
311
                    <run-dependency>
311
                    <run-dependency>
312
                        <specification-version>8.0</specification-version>
312
                        <specification-version>8.8</specification-version>
313
                    </run-dependency>
313
                    </run-dependency>
314
                </dependency>
314
                </dependency>
315
                <dependency>
315
                <dependency>
(-)a/javacard.project/src/org/netbeans/modules/javacard/project/JCProject.java (-15 / +3 lines)
Lines 54-60 Link Here
54
import java.io.InputStream;
54
import java.io.InputStream;
55
import java.io.OutputStream;
55
import java.io.OutputStream;
56
import java.net.URI;
56
import java.net.URI;
57
import java.net.URL;
58
import java.nio.charset.Charset;
57
import java.nio.charset.Charset;
59
import java.nio.charset.IllegalCharsetNameException;
58
import java.nio.charset.IllegalCharsetNameException;
60
import java.nio.charset.UnsupportedCharsetException;
59
import java.nio.charset.UnsupportedCharsetException;
Lines 91-97 Link Here
91
import org.netbeans.modules.java.api.common.queries.QuerySupport;
90
import org.netbeans.modules.java.api.common.queries.QuerySupport;
92
import org.netbeans.modules.javacard.JCUtil;
91
import org.netbeans.modules.javacard.JCUtil;
93
import org.netbeans.modules.javacard.api.AntClasspathClosureProvider;
92
import org.netbeans.modules.javacard.api.AntClasspathClosureProvider;
94
import org.netbeans.modules.javacard.common.Utils;
95
import static org.netbeans.modules.javacard.common.JCConstants.RUNTIME_DESCRIPTOR;
93
import static org.netbeans.modules.javacard.common.JCConstants.RUNTIME_DESCRIPTOR;
96
import org.netbeans.modules.javacard.constants.ProjectPropertyNames;
94
import org.netbeans.modules.javacard.constants.ProjectPropertyNames;
97
import org.netbeans.modules.javacard.project.deps.ArtifactKind;
95
import org.netbeans.modules.javacard.project.deps.ArtifactKind;
Lines 152-160 Link Here
152
import org.openide.util.WeakListeners;
150
import org.openide.util.WeakListeners;
153
import org.openide.util.lookup.Lookups;
151
import org.openide.util.lookup.Lookups;
154
import org.openide.util.lookup.ProxyLookup;
152
import org.openide.util.lookup.ProxyLookup;
153
import org.openide.xml.XMLUtil;
155
import org.w3c.dom.Element;
154
import org.w3c.dom.Element;
156
import org.w3c.dom.Node;
157
import org.w3c.dom.NodeList;
158
import org.xml.sax.SAXException;
155
import org.xml.sax.SAXException;
159
156
160
/**
157
/**
Lines 1279-1295 Link Here
1279
1276
1280
                public String run() {
1277
                public String run() {
1281
                    Element data = antHelper.getPrimaryConfigurationData(true);
1278
                    Element data = antHelper.getPrimaryConfigurationData(true);
1282
                    // XXX replace by XMLUtil when that has findElement, findText, etc.
1279
                    Element element = XMLUtil.findElement(data, "name", JCProjectType.PROJECT_CONFIGURATION_NAMESPACE);
1283
                    NodeList nl = data.getElementsByTagNameNS(
1280
                    return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
1284
                            JCProjectType.PROJECT_CONFIGURATION_NAMESPACE,
1285
                            "name"); // NOI18N
1286
                    if (nl.getLength() == 1) {
1287
                        nl = nl.item(0).getChildNodes();
1288
                        if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
1289
                            return nl.item(0).getNodeValue();
1290
                        }
1291
                    }
1292
                    return "???"; // NOI18N
1293
                }
1281
                }
1294
            });
1282
            });
1295
            synchronized (pcs) {
1283
            synchronized (pcs) {
(-)a/javacard.project/src/org/netbeans/modules/javacard/project/ProjectRenamer.java (-17 / +4 lines)
Lines 155-177 Link Here
155
    public Void run() throws Exception {
155
    public Void run() throws Exception {
156
        // -------- Update project name in project.xml ------------
156
        // -------- Update project name in project.xml ------------
157
        Element data = antHelper.getPrimaryConfigurationData(true);
157
        Element data = antHelper.getPrimaryConfigurationData(true);
158
        // XXX replace by XMLUtil when that has findElement, findText, etc.
158
        Element nameElement = XMLUtil.changeElementText(data, "name", JCProjectType.PROJECT_CONFIGURATION_NAMESPACE, newName, true);
159
        NodeList nl = data.getElementsByTagNameNS(
159
        if (nameElement == null) {
160
                JCProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); //NOI18N
160
            XMLUtil.insertTextNode(data, "name", JCProjectType.PROJECT_CONFIGURATION_NAMESPACE, newName, data.getChildNodes().item(0));
161
        Element nameEl;
161
         }
162
        if (nl.getLength() == 1) {
163
            nameEl = (Element) nl.item(0);
164
            NodeList deadKids = nameEl.getChildNodes();
165
            while (deadKids.getLength() > 0) {
166
                nameEl.removeChild(deadKids.item(0));
167
            }
168
        } else {
169
            nameEl = data.getOwnerDocument().createElementNS(
170
                    JCProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); //NOI18N
171
            //NOI18N
172
            data.insertBefore(nameEl, data.getChildNodes().item(0));
173
        }
174
        nameEl.appendChild(data.getOwnerDocument().createTextNode(newName));
175
        antHelper.putPrimaryConfigurationData(data, true);
162
        antHelper.putPrimaryConfigurationData(data, true);
176
        // -------- Update dest.war.name in project.properties
163
        // -------- Update dest.war.name in project.properties
177
        EditableProperties props = antHelper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
164
        EditableProperties props = antHelper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
(-)a/mobility.project/nbproject/project.xml (-1 / +1 lines)
Lines 317-323 Link Here
317
                    <build-prerequisite/>
317
                    <build-prerequisite/>
318
                    <compile-dependency/>
318
                    <compile-dependency/>
319
                    <run-dependency>
319
                    <run-dependency>
320
                        <specification-version>8.0</specification-version>
320
                        <specification-version>8.8</specification-version>
321
                    </run-dependency>
321
                    </run-dependency>
322
                </dependency>
322
                </dependency>
323
                <dependency>
323
                <dependency>
(-)a/mobility.project/src/org/netbeans/modules/mobility/project/J2MEProject.java (-25 / +8 lines)
Lines 134-139 Link Here
134
import org.openide.util.MutexException;
134
import org.openide.util.MutexException;
135
import org.openide.util.NbBundle;
135
import org.openide.util.NbBundle;
136
import org.openide.util.lookup.Lookups;
136
import org.openide.util.lookup.Lookups;
137
import org.openide.xml.XMLUtil;
137
import org.w3c.dom.Element;
138
import org.w3c.dom.Element;
138
import org.w3c.dom.NodeList;
139
import org.w3c.dom.NodeList;
139
import org.w3c.dom.Text;
140
import org.w3c.dom.Text;
Lines 481-505 Link Here
481
    
482
    
482
    /** Store configured project name. */
483
    /** Store configured project name. */
483
    public void setName(final String name) {
484
    public void setName(final String name) {
484
        ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
485
        ProjectManager.mutex().writeAccess(new Runnable() {
485
            public Object run() {
486
            public void run() {
486
                final Element data = helper.getPrimaryConfigurationData(true);
487
                final Element data = helper.getPrimaryConfigurationData(true);
487
                // XXX replace by XMLUtil when that has findElement, findText, etc.
488
                Element nameElement = XMLUtil.changeElementText(data, "name", J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
488
                final NodeList nl = data.getElementsByTagNameNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
489
                if (nameElement == null) {
489
                Element nameEl;
490
                     XMLUtil.insertTextNode(data, "name", J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
490
                if (nl.getLength() == 1) {
491
                    nameEl = (Element) nl.item(0);
492
                    final NodeList deadKids = nameEl.getChildNodes();
493
                    while (deadKids.getLength() > 0) {
494
                        nameEl.removeChild(deadKids.item(0));
495
                    }
496
                } else {
497
                    nameEl = data.getOwnerDocument().createElementNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
498
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
499
                }
491
                }
500
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
501
                helper.putPrimaryConfigurationData(data, true);
492
                helper.putPrimaryConfigurationData(data, true);
502
                return null;
503
            }
493
            }
504
        });
494
        });
505
    }
495
    }
Lines 608-622 Link Here
608
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
598
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
609
            public String run() {
599
            public String run() {
610
                final Element data = helper.getPrimaryConfigurationData(true);
600
                final Element data = helper.getPrimaryConfigurationData(true);
611
                // XXX replace by XMLUtil when that has findElement, findText, etc.
601
                Element element = XMLUtil.findElement(data, "name", J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE);
612
                NodeList nl = data.getElementsByTagNameNS(J2MEProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name"); // NOI18N
602
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
613
                if (nl.getLength() == 1) {
614
                    nl = nl.item(0).getChildNodes();
615
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
616
                        return ((Text) nl.item(0)).getNodeValue();
617
                    }
618
                }
619
                return "???"; // NOI18N
620
            }
603
            }
621
        });
604
        });
622
    }
605
    }
(-)a/o.n.bluej/nbproject/project.xml (-1 / +1 lines)
Lines 213-219 Link Here
213
                    <build-prerequisite/>
213
                    <build-prerequisite/>
214
                    <compile-dependency/>
214
                    <compile-dependency/>
215
                    <run-dependency>
215
                    <run-dependency>
216
                        <specification-version>8.4</specification-version>
216
                        <specification-version>8.8</specification-version>
217
                    </run-dependency>
217
                    </run-dependency>
218
                </dependency>
218
                </dependency>
219
                <dependency>
219
                <dependency>
(-)a/o.n.bluej/src/org/netbeans/bluej/BluejProject.java (-17 / +6 lines)
Lines 50-56 Link Here
50
import java.io.File;
50
import java.io.File;
51
import java.io.IOException;
51
import java.io.IOException;
52
import javax.swing.Icon;
52
import javax.swing.Icon;
53
import javax.swing.ImageIcon;
54
import org.netbeans.api.java.classpath.ClassPath;
53
import org.netbeans.api.java.classpath.ClassPath;
55
import org.netbeans.api.java.classpath.GlobalPathRegistry;
54
import org.netbeans.api.java.classpath.GlobalPathRegistry;
56
import org.netbeans.api.java.project.JavaProjectConstants;
55
import org.netbeans.api.java.project.JavaProjectConstants;
Lines 83-88 Link Here
83
import org.openide.util.Mutex;
82
import org.openide.util.Mutex;
84
import org.openide.util.Utilities;
83
import org.openide.util.Utilities;
85
import org.openide.util.lookup.Lookups;
84
import org.openide.util.lookup.Lookups;
85
import org.openide.xml.XMLUtil;
86
import org.w3c.dom.Element;
86
import org.w3c.dom.Element;
87
import org.w3c.dom.Text;
87
import org.w3c.dom.Text;
88
import org.w3c.dom.Node;
88
import org.w3c.dom.Node;
Lines 286-310 Link Here
286
    // Currently unused (but see #47230):
286
    // Currently unused (but see #47230):
287
    /** Store configured project name. */
287
    /** Store configured project name. */
288
    public void setName(final String name) {
288
    public void setName(final String name) {
289
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
289
        ProjectManager.mutex().writeAccess(new Runnable() {
290
            public Object run() {
290
            public void run() {
291
                Element data = helper.getPrimaryConfigurationData(true);
291
                Element data = helper.getPrimaryConfigurationData(true);
292
                // XXX replace by XMLUtil when that has findElement, findText, etc.
292
                Element nameElement = XMLUtil.changeElementText(data, "name", BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
293
                NodeList nl = data.getElementsByTagNameNS(BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");  // NOI18N
293
                if (nameElement == null) {
294
                Element nameEl;
294
                     XMLUtil.insertTextNode(data, "name", BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
295
                if (nl.getLength() == 1) {
296
                    nameEl = (Element) nl.item(0);
297
                    NodeList deadKids = nameEl.getChildNodes();
298
                    while (deadKids.getLength() > 0) {
299
                        nameEl.removeChild(deadKids.item(0));
300
                    }
301
                } else {
302
                    nameEl = data.getOwnerDocument().createElementNS(BluejProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
303
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
304
                }
295
                }
305
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
306
                helper.putPrimaryConfigurationData(data, true);
296
                helper.putPrimaryConfigurationData(data, true);
307
                return null;
308
            }
297
            }
309
        });
298
        });
310
    }
299
    }
(-)a/openide.util/apichanges.xml (+16 lines)
Lines 1507-1512 Link Here
1507
        <class package="org.openide.xml" name="XMLUtil"/>
1507
        <class package="org.openide.xml" name="XMLUtil"/>
1508
        <issue number="136595"/>
1508
        <issue number="136595"/>
1509
    </change>
1509
    </change>
1510
    <change id="change-element-text-and-insert-text-node--XMLUtil">
1511
        <api name="xml"/>
1512
        <summary>Created two methods that allow changing text elements and adding new
1513
        text elements.</summary>
1514
        <version major="8" minor="8"/>
1515
        <date day="7" month="6" year="2010"/>
1516
        <author login="mvfranz"/>
1517
        <compatibility addition="yes"/>
1518
        <description>
1519
            <p>
1520
                Created two methods to manipulate XML text nodes. 
1521
            </p>
1522
        </description>
1523
        <class package="org.openide.xml" name="XMLUtil"/>
1524
        <issue number="186930"/>
1525
    </change>
1510
</changes>
1526
</changes>
1511
<htmlcontents>
1527
<htmlcontents>
1512
<head>
1528
<head>
(-)a/openide.util/manifest.mf (-1 / +1 lines)
Lines 1-5 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.openide.util
2
OpenIDE-Module: org.openide.util
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/openide/util/Bundle.properties
4
OpenIDE-Module-Specification-Version: 8.7
4
OpenIDE-Module-Specification-Version: 8.8
5
5
(-)a/openide.util/src/org/openide/xml/XMLUtil.java (+50 lines)
Lines 1044-1049 Link Here
1044
    }
1044
    }
1045
1045
1046
    /**
1046
    /**
1047
     * Change the text within the specified element.
1048
     *
1049
     * @param parent parent of the element to be changed
1050
     * @param elementName element name that will be changed
1051
     * @param namespace the namespace the element is a member of.
1052
     * @param elementText the text that will replace the existing text
1053
     * @param removeChildren if the specified node has children, remove them before
1054
     * updating the text.
1055
     * @return return the updated parent node, or null, if the element was not found
1056
     *
1057
     * @since 8.8
1058
     * 
1059
     */
1060
    public static Element changeElementText(Element parent, String elementName, String namespace, String elementText, boolean removeChildren) {
1061
        Element elementToChange = XMLUtil.findElement(parent, elementName, namespace);
1062
        // we found the element
1063
        if (elementToChange != null) {
1064
            if (removeChildren) {
1065
                // remove any children elements, there should be none
1066
                NodeList deadKids = elementToChange.getChildNodes();
1067
                while (deadKids.getLength() > 0) {
1068
                    elementToChange.removeChild(deadKids.item(0));
1069
                }
1070
            }
1071
            elementToChange.appendChild(parent.getOwnerDocument().createTextNode(elementText));
1072
            return parent;
1073
        } else {
1074
            return null;
1075
        }
1076
    }
1077
1078
    /**
1079
     * Insert a text node using the specified name and text.
1080
     *
1081
     * @param parent parent of for the new node
1082
     * @param elementName name for the new node
1083
     * @param namespace namespace for the new node
1084
     * @param elementText text to put in the node
1085
     * @param insertBefore node that the new node will be inserted before.
1086
     *
1087
     * @since 8.8
1088
     */
1089
    public static void insertTextNode(Element parent, String elementName, String namespace, String elementText, Node insertBefore) {
1090
        Element nameElement = parent.getOwnerDocument().createElementNS(namespace, elementName);
1091
        Text textElement = parent.getOwnerDocument().createTextNode(elementText);
1092
        nameElement.appendChild(textElement);
1093
        parent.insertBefore(nameElement, insertBefore);
1094
    }
1095
1096
    /**
1047
     * Create an XML error handler that rethrows errors and fatal errors and logs warnings.
1097
     * Create an XML error handler that rethrows errors and fatal errors and logs warnings.
1048
     * @return a standard error handler
1098
     * @return a standard error handler
1049
     *
1099
     *
(-)a/openide.util/test/unit/src/org/openide/xml/XMLUtilTest.java (+46 lines)
Lines 707-710 Link Here
707
        assertEquals(1, tableNode.getAttributes().getLength());
707
        assertEquals(1, tableNode.getAttributes().getLength());
708
    }
708
    }
709
709
710
    public void testChangeElementText() throws Exception {
711
        String srcXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
712
                        "<book id=\"1\">\n" +
713
                        "    <author>McLaughlin, Brett</author>\n" +
714
                        "    <title>Java and XML</title>\n" +
715
                        "    <genre>Computer</genre>\n" +
716
                        "    <price>49.99</price>\n" +
717
                        "    <publish_date>2006-12-08</publish_date>\n" +
718
                        "    <description>An in-depth look at Java XML APIs.</description>\n" +
719
                        "</book>\n";
720
721
        // starting with an element, find a child element by name and namspace to replace the text
722
        Document srcDoc = XMLUtil.parse(new InputSource(new StringReader(srcXml)), false, true, null, null);
723
        Element srcRoot = srcDoc.getDocumentElement();
724
        Element author = XMLUtil.findElement(srcRoot, "author", null);
725
        assertNotNull(author);
726
        assertEquals("McLaughlin, Brett", author.getTextContent());
727
        Element book = XMLUtil.changeElementText(srcRoot, "author", null, "McLaughlin, Brett and Edelson, Justin", true);
728
        assertNotNull(book);
729
        Element updatedAuthor = XMLUtil.findElement(srcRoot, "author", null);
730
        assertEquals("McLaughlin, Brett and Edelson, Justin", updatedAuthor.getTextContent());
731
732
        Element failed = XMLUtil.changeElementText(srcRoot, "publisher", null, "O'Reilly Media", true);
733
        assertNull(failed);
734
735
        Element failedNamespace = XMLUtil.changeElementText(srcRoot, "author", "http://www.test.org/NS", "McLaughlin, Brett and Edelson, Justin", true);
736
        assertNull(failedNamespace);
737
    }
738
739
    public void testInsertTextNode() throws Exception {
740
        String srcXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
741
                        "<book id=\"1\">\n" +
742
                        "    <author>McLaughlin, Brett</author>\n" +
743
                        "    <title>Java and XML</title>\n" +
744
                        "    <genre>Computer</genre>\n" +
745
                        "    <price>49.99</price>\n" +
746
                        "    <publish_date>2006-12-08</publish_date>\n" +
747
                        "    <description>An in-depth look at Java XML APIs.</description>\n" +
748
                        "</book>\n";
749
        Document srcDoc = XMLUtil.parse(new InputSource(new StringReader(srcXml)), false, true, null, null);
750
        Element srcRoot = srcDoc.getDocumentElement();
751
        XMLUtil.insertTextNode(srcRoot, "publisher", (String)null, "O'Reilly Media", srcRoot.getChildNodes().item(0));
752
        Element publisher = XMLUtil.findElement(srcRoot, "publisher", null);
753
        assertNotNull(publisher);
754
        assertEquals("O'Reilly Media", publisher.getTextContent());
755
    }
710
}
756
}
(-)a/ruby.project/nbproject/project.xml (-1 / +1 lines)
Lines 265-271 Link Here
265
                    <build-prerequisite/>
265
                    <build-prerequisite/>
266
                    <compile-dependency/>
266
                    <compile-dependency/>
267
                    <run-dependency>
267
                    <run-dependency>
268
                        <specification-version>8.4</specification-version>
268
                        <specification-version>8.8</specification-version>
269
                    </run-dependency>
269
                    </run-dependency>
270
                </dependency>
270
                </dependency>
271
                <dependency>
271
                <dependency>
(-)a/ruby.project/src/org/netbeans/modules/ruby/rubyproject/RubyBaseProject.java (-29 / +8 lines)
Lines 83-92 Link Here
83
import org.openide.util.Mutex;
83
import org.openide.util.Mutex;
84
import org.openide.util.MutexException;
84
import org.openide.util.MutexException;
85
import org.openide.util.RequestProcessor;
85
import org.openide.util.RequestProcessor;
86
import org.openide.xml.XMLUtil;
86
import org.w3c.dom.Element;
87
import org.w3c.dom.Element;
87
import org.w3c.dom.Node;
88
import org.w3c.dom.NodeList;
89
import org.w3c.dom.Text;
90
88
91
public abstract class RubyBaseProject implements Project, RakeProjectListener {
89
public abstract class RubyBaseProject implements Project, RakeProjectListener {
92
90
Lines 258-283 Link Here
258
    // Currently unused (but see #47230):
256
    // Currently unused (but see #47230):
259
    /** Store configured project name. */
257
    /** Store configured project name. */
260
    public void setName(final String name) {
258
    public void setName(final String name) {
261
        ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
259
        ProjectManager.mutex().writeAccess(new Runnable() {
262
            public Void run() {
260
            public void run() {
263
                Element data = helper.getPrimaryConfigurationData(true);
261
                Element data = helper.getPrimaryConfigurationData(true);
264
                // XXX replace by XMLUtil when that has findElement, findText, etc.
262
                Element nameElement = XMLUtil.changeElementText(data, "name", projectConfigurationNamespace, name, true);
265
                NodeList nl = data.getElementsByTagNameNS(projectConfigurationNamespace, "name"); // NOI18N
263
                if (nameElement == null) {
266
                Element nameEl;
264
                     XMLUtil.insertTextNode(data, "name", projectConfigurationNamespace, name, data.getChildNodes().item(0));
267
                if (nl.getLength() == 1) {
268
                    nameEl = (Element) nl.item(0);
269
                    NodeList deadKids = nameEl.getChildNodes();
270
                    while (deadKids.getLength() > 0) {
271
                        nameEl.removeChild(deadKids.item(0));
272
                    }
273
                } else {
274
                    nameEl = data.getOwnerDocument().createElementNS(projectConfigurationNamespace, "name"); // NOI18N
275
276
                    data.insertBefore(nameEl, /* OK if null */ data.getChildNodes().item(0));
277
                }
265
                }
278
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
279
                helper.putPrimaryConfigurationData(data, true);
266
                helper.putPrimaryConfigurationData(data, true);
280
                return null;
281
            }
267
            }
282
        });
268
        });
283
    }
269
    }
Lines 370-384 Link Here
370
            return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
356
            return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
371
                public String run() {
357
                public String run() {
372
                    Element data = updateHelper.getPrimaryConfigurationData(true);
358
                    Element data = updateHelper.getPrimaryConfigurationData(true);
373
                    // XXX replace by XMLUtil when that has findElement, findText, etc.
359
                    Element element = XMLUtil.findElement(data, "name", RubyBaseProject.this.projectConfigurationNamespace);
374
                    NodeList nl = data.getElementsByTagNameNS(RubyBaseProject.this.projectConfigurationNamespace, "name"); // NOI18N
360
                    return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
375
                    if (nl.getLength() == 1) {
376
                        nl = nl.item(0).getChildNodes();
377
                        if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
378
                            return ((Text) nl.item(0)).getNodeValue();
379
                        }
380
                    }
381
                    return "???"; // NOI18N
382
                }
361
                }
383
            });
362
            });
384
        }
363
        }
(-)a/sql.project/manifest.mf (-1 / +2 lines)
Lines 4-8 Link Here
4
OpenIDE-Module: org.netbeans.modules.sql.project
4
OpenIDE-Module: org.netbeans.modules.sql.project
5
OpenIDE-Module-Layer: org/netbeans/modules/sql/project/ui/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/sql/project/ui/resources/layer.xml
6
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/sql/project/ui/resources/Bundle.properties
6
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/sql/project/ui/resources/Bundle.properties
7
OpenIDE-Module-Class: Loader 
8
7
Name: org/netbeans/modules/sql/project/ui/SQLDataLoader.class
9
Name: org/netbeans/modules/sql/project/ui/SQLDataLoader.class
8
OpenIDE-Module-Class: Loader 
(-)a/sql.project/nbproject/project.xml (-10 / +10 lines)
Lines 42-47 Link Here
42
                    </run-dependency>
42
                    </run-dependency>
43
                </dependency>
43
                </dependency>
44
                <dependency>
44
                <dependency>
45
                    <code-name-base>org.netbeans.api.java</code-name-base>
46
                    <build-prerequisite/>
47
                    <compile-dependency/>
48
                    <run-dependency>
49
                        <release-version>1</release-version>
50
                        <specification-version>1.16</specification-version>
51
                    </run-dependency>
52
                </dependency>
53
                <dependency>
45
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
54
                    <code-name-base>org.netbeans.api.java.classpath</code-name-base>
46
                    <build-prerequisite/>
55
                    <build-prerequisite/>
47
                    <compile-dependency/>
56
                    <compile-dependency/>
Lines 50-64 Link Here
50
                        <specification-version>1.18</specification-version>
59
                        <specification-version>1.18</specification-version>
51
                    </run-dependency>
60
                    </run-dependency>
52
                </dependency>
61
                </dependency>
53
        <dependency>
54
                    <code-name-base>org.netbeans.api.java</code-name-base>
55
                    <build-prerequisite/>
56
                    <compile-dependency/>
57
                    <run-dependency>
58
                        <release-version>1</release-version>
59
                        <specification-version>1.16</specification-version>
60
                    </run-dependency>
61
                </dependency>
62
                <dependency>
62
                <dependency>
63
                    <code-name-base>org.netbeans.modules.compapp.projects.base</code-name-base>
63
                    <code-name-base>org.netbeans.modules.compapp.projects.base</code-name-base>
64
                    <build-prerequisite/>
64
                    <build-prerequisite/>
Lines 264-270 Link Here
264
                    <build-prerequisite/>
264
                    <build-prerequisite/>
265
                    <compile-dependency/>
265
                    <compile-dependency/>
266
                    <run-dependency>
266
                    <run-dependency>
267
                        <specification-version>7.12</specification-version>
267
                        <specification-version>8.8</specification-version>
268
                    </run-dependency>
268
                    </run-dependency>
269
                </dependency>
269
                </dependency>
270
                <dependency>
270
                <dependency>
(-)a/sql.project/src/org/netbeans/modules/sql/project/IcanproProject.java (-14 / +5 lines)
Lines 56-65 Link Here
56
import org.openide.util.Utilities;
56
import org.openide.util.Utilities;
57
import org.openide.util.lookup.Lookups;
57
import org.openide.util.lookup.Lookups;
58
import org.netbeans.spi.project.AuxiliaryConfiguration;
58
import org.netbeans.spi.project.AuxiliaryConfiguration;
59
import org.openide.xml.XMLUtil;
59
import org.w3c.dom.Element;
60
import org.w3c.dom.Element;
60
import org.w3c.dom.Node;
61
import org.w3c.dom.NodeList;
62
import org.w3c.dom.Text;
63
61
64
/**
62
/**
65
 * Represents one ejb module project
63
 * Represents one ejb module project
Lines 182-199 Link Here
182
180
183
    /** Return configured project name. */
181
    /** Return configured project name. */
184
    public String getName() {
182
    public String getName() {
185
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
183
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
186
            public Object run() {
184
            public String run() {
187
                Element data = helper.getPrimaryConfigurationData(true);
185
                Element data = helper.getPrimaryConfigurationData(true);
188
                // XXX replace by XMLUtil when that has findElement, findText, etc.
186
                Element element = XMLUtil.findElement(data, "name", SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
189
                NodeList nl = data.getElementsByTagNameNS(SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
187
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
190
                if (nl.getLength() == 1) {
191
                    nl = nl.item(0).getChildNodes();
192
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
193
                        return ((Text) nl.item(0)).getNodeValue();
194
                    }
195
                }
196
                return "???"; // NOI18N
197
            }
188
            }
198
        });
189
        });
199
    }
190
    }
(-)a/sql.project/src/org/netbeans/modules/sql/project/SQLproProject.java (-27 / +10 lines)
Lines 93-98 Link Here
93
import java.nio.charset.UnsupportedCharsetException;
93
import java.nio.charset.UnsupportedCharsetException;
94
import java.util.logging.Logger;
94
import java.util.logging.Logger;
95
import org.netbeans.api.queries.FileEncodingQuery;
95
import org.netbeans.api.queries.FileEncodingQuery;
96
import org.openide.xml.XMLUtil;
96
97
97
98
98
99
Lines 229-246 Link Here
229
230
230
    /** Return configured project name. */
231
    /** Return configured project name. */
231
    public String getName() {
232
    public String getName() {
232
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
233
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
233
            public Object run() {
234
            public String run() {
234
                Element data = helper.getPrimaryConfigurationData(true);
235
                Element data = helper.getPrimaryConfigurationData(true);
235
                // XXX replace by XMLUtil when that has findElement, findText, etc.
236
                Element element = XMLUtil.findElement(data, "name", SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
236
                NodeList nl = data.getElementsByTagNameNS(SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
237
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
237
                if (nl.getLength() == 1) {
238
                    nl = nl.item(0).getChildNodes();
239
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
240
                        return ((Text) nl.item(0)).getNodeValue();
241
                    }
242
                }
243
                return "???"; // NOI18N
244
            }
238
            }
245
        });
239
        });
246
    }
240
    }
Lines 251-275 Link Here
251
245
252
    /** Store configured project name. */
246
    /** Store configured project name. */
253
    public void setName(final String name) {
247
    public void setName(final String name) {
254
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
248
        ProjectManager.mutex().writeAccess(new Runnable() {
255
            public Object run() {
249
            public void run() {
256
                Element data = helper.getPrimaryConfigurationData(true);
250
                Element data = helper.getPrimaryConfigurationData(true);
257
                // XXX replace by XMLUtil when that has findElement, findText, etc.
251
                Element nameElement = XMLUtil.changeElementText(data, "name", SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
258
                NodeList nl = data.getElementsByTagNameNS(SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
252
                if (nameElement == null) {
259
                Element nameEl;
253
                     XMLUtil.insertTextNode(data, "name", SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
260
                if (nl.getLength() == 1) {
261
                    nameEl = (Element) nl.item(0);
262
                    NodeList deadKids = nameEl.getChildNodes();
263
                    while (deadKids.getLength() > 0) {
264
                        nameEl.removeChild(deadKids.item(0));
265
                    }
266
                } else {
267
                    nameEl = data.getOwnerDocument().createElementNS(SQLproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
268
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
269
                }
254
                }
270
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
271
                helper.putPrimaryConfigurationData(data, true);
255
                helper.putPrimaryConfigurationData(data, true);
272
                return null;
273
            }
256
            }
274
        });
257
        });
275
    }
258
    }
(-)a/uml.project/nbproject/project.xml (-1 / +1 lines)
Lines 224-230 Link Here
224
                    <build-prerequisite/>
224
                    <build-prerequisite/>
225
                    <compile-dependency/>
225
                    <compile-dependency/>
226
                    <run-dependency>
226
                    <run-dependency>
227
                        <specification-version>8.0</specification-version>
227
                        <specification-version>8.8</specification-version>
228
                    </run-dependency>
228
                    </run-dependency>
229
                </dependency>
229
                </dependency>
230
                <dependency>
230
                <dependency>
(-)a/uml.project/src/org/netbeans/modules/uml/project/UMLProject.java (-47 / +10 lines)
Lines 103-108 Link Here
103
import org.openide.loaders.DataObject;
103
import org.openide.loaders.DataObject;
104
import org.openide.windows.TopComponent;
104
import org.openide.windows.TopComponent;
105
import org.openide.windows.WindowManager;
105
import org.openide.windows.WindowManager;
106
import org.openide.xml.XMLUtil;
106
107
107
108
108
/**
109
/**
Lines 266-292 Link Here
266
    /** Return configured project name. */
267
    /** Return configured project name. */
267
    public String getName()
268
    public String getName()
268
    {
269
    {
269
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action()
270
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>()
270
        {
271
        {
271
            public Object run()
272
            public String run()
272
            {
273
            {
273
                Element data = mHelper.getPrimaryConfigurationData(true);
274
                Element data = mHelper.getPrimaryConfigurationData(true);
274
                
275
                Element element = XMLUtil.findElement(data, "name", UMLProjectType.PROJECT_CONFIGURATION_NAMESPACE);
275
                // XXX replace by XMLUtil when that has findElement, findText, etc.
276
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
276
                NodeList nl = data.getElementsByTagNameNS(
277
                        UMLProjectType.PROJECT_CONFIGURATION_NAMESPACE,
278
                        "name"); // NOI18N
279
                
280
                if (nl.getLength() == 1)
281
                {
282
                    nl = nl.item(0).getChildNodes();
283
                    if (nl.getLength() == 1 && nl.item(0)
284
                    .getNodeType() == Node.TEXT_NODE)
285
                    {
286
                        return ((Text) nl.item(0)).getNodeValue();
287
                    }
288
                }
289
                return "???"; // NOI18N
290
            }
277
            }
291
        });
278
        });
292
    }
279
    }
Lines 294-334 Link Here
294
    
281
    
295
    public void setName(final String name)
282
    public void setName(final String name)
296
    {
283
    {
297
        ProjectManager.mutex().writeAccess(new Mutex.Action()
284
        ProjectManager.mutex().writeAccess(new Runnable()
298
        {
285
        {
299
            public Object run()
286
            public void run()
300
            {
287
            {
301
                Element data = mHelper.getPrimaryConfigurationData(true);
288
                Element data = mHelper.getPrimaryConfigurationData(true);
302
                
289
                Element nameElement = XMLUtil.changeElementText(data, "name", UMLProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
303
                // XXX replace by XMLUtil when that has findElement, findText, etc.
290
                if (nameElement == null)
304
                NodeList nl = data.getElementsByTagNameNS(
305
                        UMLProjectType.PROJECT_CONFIGURATION_NAMESPACE,
306
                        "name"); // NOI18N
307
                
308
                Element nameEl;
309
                if (nl.getLength() == 1)
310
                {
291
                {
311
                    nameEl = (Element) nl.item(0);
292
                     XMLUtil.insertTextNode(data, "name", UMLProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
312
                    NodeList deadKids = nameEl.getChildNodes();
313
                    
314
                    while (deadKids.getLength() > 0)
315
                    {
316
                        nameEl.removeChild(deadKids.item(0));
317
                    }
318
                }
293
                }
319
                
320
                else
321
                {
322
                    nameEl = data.getOwnerDocument().createElementNS(
323
                            UMLProjectType.PROJECT_CONFIGURATION_NAMESPACE,
324
                            "name"); // NOI18N
325
                    
326
                    data.insertBefore(nameEl, data.getChildNodes().item(0));
327
                }
328
                
329
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
330
                mHelper.putPrimaryConfigurationData(data, true);
294
                mHelper.putPrimaryConfigurationData(data, true);
331
                return null;
332
            }
295
            }
333
        });
296
        });
334
    }
297
    }
(-)a/web.project/nbproject/project.xml (-1 / +1 lines)
Lines 492-498 Link Here
492
                    <build-prerequisite/>
492
                    <build-prerequisite/>
493
                    <compile-dependency/>
493
                    <compile-dependency/>
494
                    <run-dependency>
494
                    <run-dependency>
495
                        <specification-version>8.4</specification-version>
495
                        <specification-version>8.8</specification-version>
496
                    </run-dependency>
496
                    </run-dependency>
497
                </dependency>
497
                </dependency>
498
                <dependency>
498
                <dependency>
(-)a/web.project/src/org/netbeans/modules/web/project/WebProject.java (-16 / +6 lines)
Lines 186-191 Link Here
186
import org.openide.util.NbBundle;
186
import org.openide.util.NbBundle;
187
import org.openide.util.RequestProcessor;
187
import org.openide.util.RequestProcessor;
188
import org.openide.util.lookup.ProxyLookup;
188
import org.openide.util.lookup.ProxyLookup;
189
import org.openide.xml.XMLUtil;
189
190
190
/**
191
/**
191
 * Represents one plain Web project.
192
 * Represents one plain Web project.
Lines 692-716 Link Here
692
    
693
    
693
    /** Store configured project name. */
694
    /** Store configured project name. */
694
    public void setName(final String name) {
695
    public void setName(final String name) {
695
        ProjectManager.mutex().writeAccess(new Mutex.Action<Void>() {
696
        ProjectManager.mutex().writeAccess(new Runnable() {
696
            public Void run() {
697
            public void run() {
697
                Element data = helper.getPrimaryConfigurationData(true);
698
                Element data = helper.getPrimaryConfigurationData(true);
698
                // XXX replace by XMLUtil when that has findElement, findText, etc.
699
                Element nameElement = XMLUtil.changeElementText(data, "name", WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
699
                NodeList nl = data.getElementsByTagNameNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
700
                if (nameElement == null) {
700
                Element nameEl;
701
                     XMLUtil.insertTextNode(data, "name", WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
701
                if (nl.getLength() == 1) {
702
                    nameEl = (Element) nl.item(0);
703
                    NodeList deadKids = nameEl.getChildNodes();
704
                    while (deadKids.getLength() > 0) {
705
                        nameEl.removeChild(deadKids.item(0));
706
                    }
707
                } else {
708
                    nameEl = data.getOwnerDocument().createElementNS(WebProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
709
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
710
                }
702
                }
711
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
712
                helper.putPrimaryConfigurationData(data, true);
703
                helper.putPrimaryConfigurationData(data, true);
713
                return null;
714
            }
704
            }
715
        });
705
        });
716
    }
706
    }
(-)a/wlm.project/nbproject/project.xml (-9 / +9 lines)
Lines 151-156 Link Here
151
                    </run-dependency>
151
                    </run-dependency>
152
                </dependency>
152
                </dependency>
153
                <dependency>
153
                <dependency>
154
                    <code-name-base>org.netbeans.modules.xml.misc</code-name-base>
155
                    <build-prerequisite/>
156
                    <compile-dependency/>
157
                    <run-dependency>
158
                        <specification-version>6.9</specification-version>
159
                    </run-dependency>
160
                </dependency>
161
                <dependency>
154
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
162
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
155
                    <build-prerequisite/>
163
                    <build-prerequisite/>
156
                    <compile-dependency/>
164
                    <compile-dependency/>
Lines 169-182 Link Here
169
                    </run-dependency>
177
                    </run-dependency>
170
                </dependency>
178
                </dependency>
171
                <dependency>
179
                <dependency>
172
                    <code-name-base>org.netbeans.modules.xml.misc</code-name-base>
173
                    <build-prerequisite/>
174
                    <compile-dependency/>
175
                    <run-dependency>
176
                        <specification-version>6.9</specification-version>
177
                    </run-dependency>
178
                </dependency>
179
                <dependency>
180
                    <code-name-base>org.netbeans.modules.xml.wsdl.extensions</code-name-base>
180
                    <code-name-base>org.netbeans.modules.xml.wsdl.extensions</code-name-base>
181
                    <build-prerequisite/>
181
                    <build-prerequisite/>
182
                    <compile-dependency/>
182
                    <compile-dependency/>
Lines 303-309 Link Here
303
                    <build-prerequisite/>
303
                    <build-prerequisite/>
304
                    <compile-dependency/>
304
                    <compile-dependency/>
305
                    <run-dependency>
305
                    <run-dependency>
306
                        <specification-version>6.5.1</specification-version>
306
                        <specification-version>8.8</specification-version>
307
                    </run-dependency>
307
                    </run-dependency>
308
                </dependency>
308
                </dependency>
309
                <dependency>
309
                <dependency>
(-)a/wlm.project/src/org/netbeans/modules/workflow/project/WorkflowproProject.java (-26 / +10 lines)
Lines 84-89 Link Here
84
import org.openide.util.Lookup;
84
import org.openide.util.Lookup;
85
import org.openide.util.Mutex;
85
import org.openide.util.Mutex;
86
import org.openide.util.lookup.Lookups;
86
import org.openide.util.lookup.Lookups;
87
import org.openide.xml.XMLUtil;
87
import org.w3c.dom.Element;
88
import org.w3c.dom.Element;
88
import org.w3c.dom.Node;
89
import org.w3c.dom.Node;
89
import org.w3c.dom.NodeList;
90
import org.w3c.dom.NodeList;
Lines 133-156 Link Here
133
    
134
    
134
    @SuppressWarnings("unchecked") // NOI18N
135
    @SuppressWarnings("unchecked") // NOI18N
135
    public void setName(final String name) {
136
    public void setName(final String name) {
136
        ProjectManager.mutex().writeAccess(new Mutex.Action() {
137
        ProjectManager.mutex().writeAccess(new Runnable() {
137
            public Object run() {
138
            public void run() {
138
                Element data = helper.getPrimaryConfigurationData(true);
139
                Element data = helper.getPrimaryConfigurationData(true);
139
                NodeList nl = data.getElementsByTagNameNS(WorkflowproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
140
                Element nameElement = XMLUtil.changeElementText(data, "name", WorkflowproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
140
                Element nameEl;
141
                if (nameElement == null) {
141
                if (nl.getLength() == 1) {
142
                     XMLUtil.insertTextNode(data, "name", WorkflowproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
142
                    nameEl = (Element) nl.item(0);
143
                    NodeList deadKids = nameEl.getChildNodes();
144
                    while (deadKids.getLength() > 0) {
145
                        nameEl.removeChild(deadKids.item(0));
146
                    }
147
                } else {
148
                    nameEl = data.getOwnerDocument().createElementNS(WorkflowproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
149
                    data.insertBefore(nameEl, data.getChildNodes().item(0));
150
                }
143
                }
151
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
152
                helper.putPrimaryConfigurationData(data, true);
144
                helper.putPrimaryConfigurationData(data, true);
153
                return null;
154
            }
145
            }
155
        });
146
        });
156
    }    
147
    }    
Lines 259-276 Link Here
259
250
260
    /** Return configured project name. */
251
    /** Return configured project name. */
261
    public String getName() {
252
    public String getName() {
262
        return (String) ProjectManager.mutex().readAccess(new Mutex.Action() {
253
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
263
            public Object run() {
254
            public String run() {
264
                Element data = helper.getPrimaryConfigurationData(true);
255
                Element data = helper.getPrimaryConfigurationData(true);
265
                // XXX replace by XMLUtil when that has findElement, findText, etc.
256
                Element element = XMLUtil.findElement(data, "name", WorkflowproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
266
                NodeList nl = data.getElementsByTagNameNS(WorkflowproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
257
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
267
                if (nl.getLength() == 1) {
268
                    nl = nl.item(0).getChildNodes();
269
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
270
                        return ((Text) nl.item(0)).getNodeValue();
271
                    }
272
                }
273
                return "???"; // NOI18N
274
            }
258
            }
275
        });
259
        });
276
    }
260
    }
(-)a/xslt.project/nbproject/project.xml (-9 / +9 lines)
Lines 137-142 Link Here
137
                    </run-dependency>
137
                    </run-dependency>
138
                </dependency>
138
                </dependency>
139
                <dependency>
139
                <dependency>
140
                    <code-name-base>org.netbeans.modules.xml.catalogsupport</code-name-base>
141
                    <build-prerequisite/>
142
                    <compile-dependency/>
143
                    <run-dependency>
144
                        <specification-version>1.0</specification-version>
145
                    </run-dependency>
146
                </dependency>
147
                <dependency>
140
                    <code-name-base>org.netbeans.modules.xml.misc</code-name-base>
148
                    <code-name-base>org.netbeans.modules.xml.misc</code-name-base>
141
                    <build-prerequisite/>
149
                    <build-prerequisite/>
142
                    <compile-dependency/>
150
                    <compile-dependency/>
Lines 145-158 Link Here
145
                    </run-dependency>
153
                    </run-dependency>
146
                </dependency>
154
                </dependency>
147
                <dependency>
155
                <dependency>
148
                    <code-name-base>org.netbeans.modules.xml.catalogsupport</code-name-base>
149
                    <build-prerequisite/>
150
                    <compile-dependency/>
151
                    <run-dependency>
152
                        <specification-version>1.0</specification-version>
153
                    </run-dependency>
154
                </dependency>
155
                <dependency>
156
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
156
                    <code-name-base>org.netbeans.modules.xml.retriever</code-name-base>
157
                    <build-prerequisite/>
157
                    <build-prerequisite/>
158
                    <compile-dependency/>
158
                    <compile-dependency/>
Lines 302-308 Link Here
302
                    <build-prerequisite/>
302
                    <build-prerequisite/>
303
                    <compile-dependency/>
303
                    <compile-dependency/>
304
                    <run-dependency>
304
                    <run-dependency>
305
                        <specification-version>7.15</specification-version>
305
                        <specification-version>8.8</specification-version>
306
                    </run-dependency>
306
                    </run-dependency>
307
                </dependency>
307
                </dependency>
308
                <dependency>
308
                <dependency>
(-)a/xslt.project/src/org/netbeans/modules/xslt/project/XsltproProject.java (-29 / +8 lines)
Lines 73-84 Link Here
73
import org.openide.util.ImageUtilities;
73
import org.openide.util.ImageUtilities;
74
import org.openide.util.Lookup;
74
import org.openide.util.Lookup;
75
import org.openide.util.Mutex;
75
import org.openide.util.Mutex;
76
import org.openide.util.Utilities;
77
import org.openide.util.lookup.Lookups;
76
import org.openide.util.lookup.Lookups;
77
import org.openide.xml.XMLUtil;
78
import org.w3c.dom.Element;
78
import org.w3c.dom.Element;
79
import org.w3c.dom.Node;
80
import org.w3c.dom.NodeList;
81
import org.w3c.dom.Text;
82
79
83
/**
80
/**
84
 *
81
 *
Lines 143-182 Link Here
143
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
140
        return ProjectManager.mutex().readAccess(new Mutex.Action<String>() {
144
            public String run() {
141
            public String run() {
145
                Element data = helper.getPrimaryConfigurationData(true);
142
                Element data = helper.getPrimaryConfigurationData(true);
146
                // XXX replace by XMLUtil when that has findElement, findText, etc.
143
                Element element = XMLUtil.findElement(data, "name", XsltproProjectType.PROJECT_CONFIGURATION_NAMESPACE);
147
                NodeList nl = data.getElementsByTagNameNS(XsltproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
144
                return (element != null) ? XMLUtil.findText(element) : "???"; // NOI18N
148
                if (nl.getLength() == 1) {
149
                    nl = nl.item(0).getChildNodes();
150
                    if (nl.getLength() == 1 && nl.item(0).getNodeType() == Node.TEXT_NODE) {
151
                        return ((Text) nl.item(0)).getNodeValue();
152
                    }
153
                }
154
                return "???"; // NOI18N
155
            }
145
            }
156
        });
146
        });
157
    }
147
    }
158
    
148
    
159
    /** Store configured project name. */
149
    /** Store configured project name. */
160
    public void setName(final String name) {
150
    public void setName(final String name) {
161
        ProjectManager.mutex().writeAccess(new Mutex.Action<Object>() {
151
        ProjectManager.mutex().writeAccess(new Runnable() {
162
            public Object run() {
152
            public void run() {
163
                Element data = helper.getPrimaryConfigurationData(true);
153
                Element data = helper.getPrimaryConfigurationData(true);
164
                // XXX replace by XMLUtil when that has findElement, findText, etc.
154
                Element nameElement = XMLUtil.changeElementText(data, "name", XsltproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, true);
165
                NodeList nl = data.getElementsByTagNameNS(XsltproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
155
                if (nameElement == null) {
166
                Element nameEl;
156
                     XMLUtil.insertTextNode(data, "name", XsltproProjectType.PROJECT_CONFIGURATION_NAMESPACE, name, data.getChildNodes().item(0));
167
                if (nl.getLength() == 1) {
168
                    nameEl = (Element) nl.item(0);
169
                    NodeList deadKids = nameEl.getChildNodes();
170
                    while (deadKids.getLength() > 0) {
171
                        nameEl.removeChild(deadKids.item(0));
172
                    }
173
                } else {
174
                    nameEl = data.getOwnerDocument().createElementNS(XsltproProjectType.PROJECT_CONFIGURATION_NAMESPACE, "name");
175
                    data.insertBefore(nameEl, /* OK if null */data.getChildNodes().item(0));
176
                }
157
                }
177
                nameEl.appendChild(data.getOwnerDocument().createTextNode(name));
178
                helper.putPrimaryConfigurationData(data, true);
158
                helper.putPrimaryConfigurationData(data, true);
179
                return null;
180
            }
159
            }
181
        });
160
        });
182
    }
161
    }

Return to bug 186930