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 219827
Collapse All | Expand All

(-)a/java.j2seproject/apichanges.xml (+22 lines)
Lines 109-114 Link Here
109
109
110
        <change>
110
        <change>
111
            <api name="jseprojects"/>
111
            <api name="jseprojects"/>
112
            <summary>Enable correct cleanup of properties in Project Property dialog of an extension of JSE Project</summary>
113
            <version major="1" minor="56"/>
114
            <date day="10" month="10" year="2012"/>
115
            <author login="psomol"/>
116
            <compatibility addition="yes"/>
117
            <description>
118
                Added interface <code>J2SECustomPropertyHandler</code> with methods <code>save()</code>
119
                and <code>cleanup()</code> to enable correct saving of properties added by JSE Project extending 
120
                modules, and correct memory cleanup when property dialog is closed. If a JSE Project extending 
121
                module adds/modifies panels in Project Property panels, then a mechanism is needed to ensure 
122
                that all user-modified properties are correctly stored in project.properties and private.properties 
123
                when OK pressed, but also to ensure that extension-specific temporary structures are freed on
124
                dialog close. <code>J2SECustomPropertyHandler</code> replaces <code>J2SECustomPropertySaver</code>
125
                which proved insufficient to handle proper memory management. <code>J2SECustomPropertySaver</code>
126
                is thus to be considered deprecated, although technically it is still supported.
127
            </description>
128
            <class package="org.netbeans.modules.java.j2seproject.api" name="J2SECustomPropertyHandler"/>
129
            <issue number="219746"/>
130
        </change>
131
132
        <change>
133
            <api name="jseprojects"/>
112
            <summary>Enable correct handling of properties in Project Property dialog of an extension of JSE Project</summary>
134
            <summary>Enable correct handling of properties in Project Property dialog of an extension of JSE Project</summary>
113
            <version major="1" minor="46"/>
135
            <version major="1" minor="46"/>
114
            <date day="17" month="8" year="2011"/>
136
            <date day="17" month="8" year="2011"/>
(-)a/java.j2seproject/manifest.mf (-1 / +1 lines)
Lines 2-7 Link Here
2
OpenIDE-Module: org.netbeans.modules.java.j2seproject/1
2
OpenIDE-Module: org.netbeans.modules.java.j2seproject/1
3
OpenIDE-Module-Layer: org/netbeans/modules/java/j2seproject/ui/resources/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/java/j2seproject/ui/resources/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/j2seproject/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/j2seproject/Bundle.properties
5
OpenIDE-Module-Implementation-Version: 46
5
OpenIDE-Module-Implementation-Version: 47
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
7
7
(-)a/java.j2seproject/nbproject/project.properties (-1 / +1 lines)
Lines 42-48 Link Here
42
42
43
javac.compilerargs=-Xlint -Xlint:-serial
43
javac.compilerargs=-Xlint -Xlint:-serial
44
javac.source=1.6
44
javac.source=1.6
45
spec.version.base=1.55.0
45
spec.version.base=1.56.0
46
46
47
javadoc.arch=${basedir}/arch.xml
47
javadoc.arch=${basedir}/arch.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
48
javadoc.apichanges=${basedir}/apichanges.xml
(-)f28958b14e16 (+82 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java.j2seproject.api;
43
44
import org.netbeans.api.project.Project;
45
46
/**
47
 * Property handler to be implemented by J2SE Project extension modules
48
 * that introduce new project properties. Registered handlers are
49
 * used to save extended propertes in addition to standard J2SE Project properties
50
 * if modified by user in Project Properties dialog, and to ensure memory
51
 * cleanup at the time when property dialog is closed.
52
 * Implementation of the interface should be registered using 
53
 * {@link org.netbeans.spi.project.ProjectServiceProvider}.
54
 * 
55
 * Note: replaces J2SECustomPropertySaver which should not be used any more
56
 * 
57
 * @author Petr Somol
58
 * @since 1.56
59
 */
60
public interface J2SECustomPropertyHandler {
61
62
    /**
63
     * Method is called when OK is pressed in JSE Project Properties dialog
64
     * and properties supplied by JSE Project extension module 
65
     * (thus not handled by JSE Project itself)
66
     * need to be stored in project.properties and private.properties.
67
     * 
68
     * @param p project whose extension properties are to be saved
69
     */
70
    void save(Project p);
71
72
    /**
73
     * Method is called when JSE Project Properties dialog is closed
74
     * to clean up structures holding project properties specific to
75
     * JSE Project extension module (JFXProjectProperties, JWSProjectProperties)
76
     * for the dialog lifetime.
77
     * 
78
     * @param p project whose extension properties are to be cleaned up
79
     */
80
    void cleanup(Project p);
81
82
}
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SECustomPropertySaver.java (+2 lines)
Lines 48-54 Link Here
48
 * 
48
 * 
49
 * @author Petr Somol
49
 * @author Petr Somol
50
 * @since 1.46
50
 * @since 1.46
51
 * @deprecated use J2SECustomPropertyHandler instead
51
 */
52
 */
53
@Deprecated
52
public interface J2SECustomPropertySaver {
54
public interface J2SECustomPropertySaver {
53
55
54
    /**
56
    /**
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerProviderImpl.java (-3 / +11 lines)
Lines 44-50 Link Here
44
44
45
package org.netbeans.modules.java.j2seproject.ui.customizer;
45
package org.netbeans.modules.java.j2seproject.ui.customizer;
46
46
47
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertySaver;
48
import java.awt.Component;
47
import java.awt.Component;
49
import java.awt.Cursor;
48
import java.awt.Cursor;
50
import java.awt.Dialog;
49
import java.awt.Dialog;
Lines 61-68 Link Here
61
import org.netbeans.api.project.ProjectUtils;
60
import org.netbeans.api.project.ProjectUtils;
62
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
61
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
63
import org.netbeans.modules.java.api.common.project.ui.customizer.CustomizerProvider2;
62
import org.netbeans.modules.java.api.common.project.ui.customizer.CustomizerProvider2;
63
import org.netbeans.modules.java.api.common.project.ui.customizer.ProjectSharability;
64
import org.netbeans.modules.java.j2seproject.J2SEProject;
64
import org.netbeans.modules.java.j2seproject.J2SEProject;
65
import org.netbeans.modules.java.api.common.project.ui.customizer.ProjectSharability;
65
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertyHandler;
66
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertySaver;
66
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper;
67
import org.netbeans.spi.project.support.ant.GeneratedFilesHelper;
67
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
68
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
68
import org.netbeans.spi.project.support.ant.ReferenceHelper;
69
import org.netbeans.spi.project.support.ant.ReferenceHelper;
Lines 166-171 Link Here
166
        
167
        
167
        public void actionPerformed(ActionEvent e) {
168
        public void actionPerformed(ActionEvent e) {
168
            uiProperties.save();
169
            uiProperties.save();
170
            for (J2SECustomPropertyHandler saver : project.getLookup().lookupAll(J2SECustomPropertyHandler.class)) {
171
                saver.save(project);
172
            }
173
            // the following is deprecated
169
            for (J2SECustomPropertySaver saver : project.getLookup().lookupAll(J2SECustomPropertySaver.class)) {
174
            for (J2SECustomPropertySaver saver : project.getLookup().lookupAll(J2SECustomPropertySaver.class)) {
170
                saver.save(project);
175
                saver.save(project);
171
            }
176
            }
Lines 207-213 Link Here
207
                
212
                
208
        public @Override void windowClosed(WindowEvent e) {
213
        public @Override void windowClosed(WindowEvent e) {
209
            project2Dialog.remove( project );
214
            project2Dialog.remove( project );
210
        }    
215
            for (J2SECustomPropertyHandler cleaner : project.getLookup().lookupAll(J2SECustomPropertyHandler.class)) {
216
                cleaner.cleanup(project);
217
            }
218
        }
211
        
219
        
212
        public @Override void windowClosing(WindowEvent e) {
220
        public @Override void windowClosing(WindowEvent e) {
213
            //Dispose the dialog otherwsie the {@link WindowAdapter#windowClosed}
221
            //Dispose the dialog otherwsie the {@link WindowAdapter#windowClosed}
(-)f28958b14e16 (+318 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.java.j2seproject.api;
43
44
import java.beans.PropertyChangeListener;
45
import java.io.IOException;
46
import java.util.Map;
47
import javax.swing.JPanel;
48
import javax.swing.JTextField;
49
import javax.swing.JToggleButton;
50
import javax.swing.text.Document;
51
import org.junit.BeforeClass;
52
import org.junit.Test;
53
import static org.junit.Assert.*;
54
import org.netbeans.api.project.Project;
55
import org.netbeans.junit.MockServices;
56
import org.netbeans.spi.project.support.ant.EditableProperties;
57
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
58
import org.netbeans.spi.project.support.ant.ui.StoreGroup;
59
import org.openide.util.Exceptions;
60
import org.openide.util.Lookup;
61
62
/**
63
 * Test of SPI class org.netbeans.modules.java.j2seproject.api.J2SECustomPropertyHandler
64
 * 
65
 * @author Petr Somol
66
 */
67
public class J2SECustomPropertyHandlerTest {
68
    
69
    public J2SECustomPropertyHandlerTest() {
70
    }
71
72
    @BeforeClass
73
    public static void setUpClass() throws Exception {
74
        MockServices.setServices(MockProjectExtenderPropertiesHandler.class);
75
    }
76
77
    private static MockProjectExtenderProperties extProperties = MockProjectExtenderProperties.getInstance();    
78
    
79
    /**
80
     * Simulates property storage.
81
     */
82
    private static EditableProperties storedProperties = new EditableProperties(true);
83
    
84
    /**
85
     * Simulates reaction to clicking OK in Project Properties dialog.
86
     * Both standard and extended properties thus need to be saved.
87
     */
88
    public void invokeCentralizedSave() {
89
        // first save standard project properties
90
        System.out.println("invokeCentralizedSave():");
91
        // then invoke all registered CustomPropertyHandlers to save all extended properties
92
        Project thisProjectMockup = null;
93
        for (J2SECustomPropertyHandler saver : Lookup.getDefault().lookupAll(J2SECustomPropertyHandler.class)) {
94
            saver.save(thisProjectMockup);
95
        }
96
    }
97
98
    /**
99
     * Simulates reaction to closing the Project Properties dialog.
100
     */
101
    public void invokeCentralizedCleanup() {
102
        System.out.println("invokeCentralizedCleanup():");
103
        // then invoke all registered CustomPropertyHandlers to clean whatever necessary
104
        Project thisProjectMockup = null;
105
        for (J2SECustomPropertyHandler cleaner : Lookup.getDefault().lookupAll(J2SECustomPropertyHandler.class)) {
106
            cleaner.cleanup(thisProjectMockup);
107
        }
108
    }
109
    
110
    /**
111
     * Test of save method, of class J2SECustomPropertyHandler.
112
     */
113
    @Test
114
    public void testCentralizedPropertiesSave() {
115
        MockupCategory1Panel panel1 = new MockupCategory1Panel();
116
        MockupCategory2Panel panel2 = new MockupCategory2Panel();
117
        System.out.println("testCentralizedPropertiesSave():");
118
        assertEquals(storedProperties.size(), 0);
119
        invokeCentralizedSave();
120
        assertEquals(storedProperties.size(), 2); // empty document is not saved
121
        assertEquals(storedProperties.get("mock.property1"), "false"); 
122
        assertEquals(storedProperties.get("mock.property2"), "false"); 
123
        assertNull(storedProperties.get("mock.property3")); 
124
        System.out.println("OK"); 
125
        // simulate user invoked property change in first Category panel followed by click on OK button
126
        panel1.simulateUserButtonAction();
127
        invokeCentralizedSave();
128
        assertEquals(storedProperties.size(), 2); // empty document is not saved
129
        assertEquals(storedProperties.get("mock.property1"), "true"); 
130
        assertEquals(storedProperties.get("mock.property2"), "false"); 
131
        assertNull(storedProperties.get("mock.property3")); 
132
        System.out.println("OK"); 
133
        // simulate user invoked property change in second Category panel followed by click on OK button
134
        panel2.simulateUserButtonAction();
135
        invokeCentralizedSave();
136
        assertEquals(storedProperties.size(), 2); // empty document is not saved
137
        assertEquals(storedProperties.get("mock.property1"), "true"); 
138
        assertEquals(storedProperties.get("mock.property2"), "true"); 
139
        assertNull(storedProperties.get("mock.property3")); 
140
        System.out.println("OK"); 
141
        // simulate user invoked property change in first and second Category panel followed by click on OK button
142
        panel1.simulateUserButtonAction();
143
        panel2.simulateUserTextFieldAction("USER WROTE THIS"); 
144
        invokeCentralizedSave();
145
        assertEquals(storedProperties.size(), 3);
146
        assertEquals(storedProperties.get("mock.property1"), "false"); 
147
        assertEquals(storedProperties.get("mock.property2"), "true"); 
148
        assertEquals(storedProperties.get("mock.property3"), "USER WROTE THIS"); 
149
        System.out.println("OK"); 
150
        // simulate Cancel in properties dialog
151
        panel1.simulateUserButtonAction();
152
        panel2.simulateUserButtonAction();
153
        panel2.simulateUserTextFieldAction("USER WROTE SOMETHING ELSE"); 
154
        invokeCentralizedCleanup();
155
        assertNull(MockProjectExtenderProperties.extProperties);
156
        assertEquals(storedProperties.size(), 3);
157
        assertEquals(storedProperties.get("mock.property1"), "false"); 
158
        assertEquals(storedProperties.get("mock.property2"), "true"); 
159
        assertEquals(storedProperties.get("mock.property3"), "USER WROTE THIS"); 
160
        System.out.println("OK"); 
161
    }
162
163
    /**
164
     * Extended properties centralized property handler service.
165
     */
166
    public static final class MockProjectExtenderPropertiesHandler implements J2SECustomPropertyHandler {
167
168
        @Override
169
        public void save(Project p) {
170
            // in real p would be used to lookup the correct ProjectExtenderProperties instance
171
            MockProjectExtenderProperties prop = MockProjectExtenderProperties.getInstanceIfExists();
172
            if(prop != null) {
173
                try {
174
                    prop.store();
175
                } catch (IOException ex) {
176
                    Exceptions.printStackTrace(ex);
177
                }
178
            }
179
        }
180
181
        @Override
182
        public void cleanup(Project p) {
183
            // in real p would be used to lookup the correct ProjectExtenderProperties instance
184
            MockProjectExtenderProperties prop = MockProjectExtenderProperties.getInstanceIfExists();
185
            if(prop != null) {
186
                prop.cleanup();
187
            }
188
        }
189
    }
190
    
191
    /**
192
     * Class managing properties specific to the project extension module.
193
     */
194
    public static final class MockProjectExtenderProperties {
195
196
        private static MockProjectExtenderProperties extProperties = null;
197
198
        public static final String PROPERTY1 = "mock.property1"; 
199
        public static final String PROPERTY2 = "mock.property2"; 
200
        public static final String PROPERTY3 = "mock.property3"; 
201
        private JToggleButton.ToggleButtonModel model1;
202
        private JToggleButton.ToggleButtonModel model2;
203
        private Document model3;
204
        private StoreGroup mockPropGroup = new StoreGroup();
205
206
        public JToggleButton.ToggleButtonModel getModel1() {
207
            return model1;
208
        }
209
        public JToggleButton.ToggleButtonModel getModel2() {
210
            return model2;
211
        }
212
        public Document getModel3() {
213
            return model3;
214
        }
215
216
        MockProjectExtenderProperties() {
217
            EditableProperties mockCentralProperties = new EditableProperties(true);
218
            MockPropertyEvaluator pe = new MockPropertyEvaluator(mockCentralProperties);
219
            model1 = mockPropGroup.createToggleButtonModel(pe, PROPERTY1);
220
            model2 = mockPropGroup.createToggleButtonModel(pe, PROPERTY2);
221
            model3 = mockPropGroup.createStringDocument(pe, PROPERTY3);
222
        }
223
        
224
        public static MockProjectExtenderProperties getInstanceIfExists() {
225
            if(extProperties != null) {
226
                return extProperties;
227
            }
228
            return null;
229
        }
230
        
231
        public static MockProjectExtenderProperties getInstance() {
232
            if(extProperties == null) {
233
                extProperties = new MockProjectExtenderProperties();
234
            }
235
            return extProperties;
236
        }
237
238
        /**
239
         * Method implementing actual saving of extended properties.
240
         */
241
        public void store() throws IOException {
242
            try {
243
                mockPropGroup.store(storedProperties);
244
                // in reality cache or save to *.properties file
245
                if(false) {
246
                    throw new IOException();
247
                }
248
                
249
            } catch (IOException ioex) {}
250
        }   
251
252
        /**
253
         * Clean up temporary memory structures.
254
         */
255
        public void cleanup() {
256
            extProperties = null;
257
        }   
258
    }
259
    
260
    public static final class MockupCategory1Panel extends JPanel {
261
        JToggleButton button = new JToggleButton();
262
        MockupCategory1Panel() {
263
            button.setModel(extProperties.getModel1());
264
        }
265
        public void simulateUserButtonAction() {
266
            button.doClick();
267
        }
268
    }
269
270
    public static final class MockupCategory2Panel extends JPanel {
271
        JToggleButton button = new JToggleButton();
272
        JTextField textField  = new JTextField();
273
        MockupCategory2Panel() {
274
            button.setModel(extProperties.getModel2());
275
            textField.setDocument(extProperties.getModel3());
276
        }
277
        public void simulateUserButtonAction() {
278
            button.doClick();
279
        }
280
        public void simulateUserTextFieldAction(String str) {
281
            textField.setText(str);
282
        }
283
    }
284
285
    public static final class MockPropertyEvaluator implements PropertyEvaluator {
286
287
        private final EditableProperties ep;
288
                
289
        MockPropertyEvaluator(EditableProperties ep) {
290
            this.ep = ep;
291
        }
292
        
293
        @Override
294
        public String getProperty(String prop) {
295
            return ep.getProperty(prop);
296
        }
297
298
        @Override
299
        public String evaluate(String text) {
300
            return null;
301
        }
302
303
        @Override
304
        public Map<String, String> getProperties() {
305
            return null;
306
        }
307
308
        @Override
309
        public void addPropertyChangeListener(PropertyChangeListener listener) {
310
        }
311
312
        @Override
313
        public void removePropertyChangeListener(PropertyChangeListener listener) {
314
        }
315
        
316
    }
317
    
318
}
(-)a/javafx2.project/manifest.mf (-1 / +1 lines)
Lines 3-6 Link Here
3
OpenIDE-Module: org.netbeans.modules.javafx2.project
3
OpenIDE-Module: org.netbeans.modules.javafx2.project
4
OpenIDE-Module-Layer: org/netbeans/modules/javafx2/project/layer.xml
4
OpenIDE-Module-Layer: org/netbeans/modules/javafx2/project/layer.xml
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javafx2/project/Bundle.properties
5
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javafx2/project/Bundle.properties
6
OpenIDE-Module-Specification-Version: 1.9
6
OpenIDE-Module-Specification-Version: 1.10
(-)a/javafx2.project/nbproject/project.xml (-1 / +1 lines)
Lines 82-88 Link Here
82
                    <compile-dependency/>
82
                    <compile-dependency/>
83
                    <run-dependency>
83
                    <run-dependency>
84
                        <release-version>1</release-version>
84
                        <release-version>1</release-version>
85
                        <specification-version>1.47</specification-version>
85
                        <specification-version>1.56</specification-version>
86
                    </run-dependency>
86
                    </run-dependency>
87
                </dependency>
87
                </dependency>
88
                <dependency>
88
                <dependency>
(-)a/javafx2.project/src/org/netbeans/modules/javafx2/project/JFXProjectProperties.java (+2 lines)
Lines 492-498 Link Here
492
     * 
492
     * 
493
     * @param category marker string to indicate which category provider is calling this
493
     * @param category marker string to indicate which category provider is calling this
494
     * @return instance of JFXProjectProperties shared among category panels in the current Project Properties dialog only
494
     * @return instance of JFXProjectProperties shared among category panels in the current Project Properties dialog only
495
     * @deprecated J2SECustomPropertyHandler handles cleanup of project properties both after OK and Cancel
495
     */
496
     */
497
    @Deprecated
496
    public static JFXProjectProperties getInstancePerSession(Lookup context, String category) {
498
    public static JFXProjectProperties getInstancePerSession(Lookup context, String category) {
497
        Project proj = context.lookup(Project.class);
499
        Project proj = context.lookup(Project.class);
498
        String projDir = proj.getProjectDirectory().getPath();
500
        String projDir = proj.getProjectDirectory().getPath();
(-)a/javafx2.project/src/org/netbeans/modules/javafx2/project/layer.xml (+12 lines)
Lines 45-50 Link Here
45
-->
45
-->
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
46
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
47
<filesystem>
47
<filesystem>
48
    <folder name="Projects">
49
        <folder name="org-netbeans-modules-java-j2seproject">
50
            <folder name="Lookup">
51
                <file name="org-netbeans-modules-javafx2-project-ui-JFXProjectPropertiesHandler.instance">
52
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.javafx2.project.ui.JFXProjectPropertiesHandler"/>
53
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.projectapi.LazyLookupProviders.forProjectServiceProvider"/>
54
                    <attr name="instanceOf" stringvalue="org.netbeans.modules.java.j2seproject.api.J2SECustomPropertyHandler"/>
55
                </file>
56
                <file name="org-netbeans-modules-javafx2-project-ui-JFXProjectPropertiesSaver.instance_hidden"/>
57
            </folder>
58
        </folder>
59
    </folder>
48
    <folder name="Templates">
60
    <folder name="Templates">
49
        <folder name="JFX">
61
        <folder name="JFX">
50
            <attr name="position" intvalue="0"/>
62
            <attr name="position" intvalue="0"/>
(-)f28958b14e16 (+84 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.javafx2.project.ui;
43
44
import java.io.IOException;
45
import org.netbeans.api.project.Project;
46
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertyHandler;
47
import org.netbeans.modules.javafx2.project.JFXProjectProperties;
48
import org.netbeans.spi.project.ProjectServiceProvider;
49
import org.openide.util.Exceptions;
50
51
/**
52
 * Provides handler service for JavaFX 2.0 specific project properties
53
 * for use in standard J2SE Project Properties dialog so that all properties
54
 * can be properly saved in project.properties and private.properties when 
55
 * OK button is pressed and memory is cleaned on dialog close.
56
 * 
57
 * @author Petr Somol
58
 */
59
@ProjectServiceProvider(service=J2SECustomPropertyHandler.class, projectType="org-netbeans-modules-java-j2seproject")
60
public class JFXProjectPropertiesHandler implements J2SECustomPropertyHandler {
61
   
62
    public JFXProjectPropertiesHandler() {}
63
    
64
    @Override
65
    public void save(Project project) {
66
        JFXProjectProperties prop = JFXProjectProperties.getInstanceIfExists(project.getLookup());
67
        if(prop != null) {
68
            try {
69
                prop.store();
70
            } catch (IOException ex) {
71
                Exceptions.printStackTrace(ex);
72
            }
73
        }
74
    }
75
76
    @Override
77
    public void cleanup(Project project) {
78
        JFXProjectProperties prop = JFXProjectProperties.getInstanceIfExists(project.getLookup());
79
        if(prop != null) {
80
            JFXProjectProperties.cleanup(project.getLookup());
81
        }
82
    }
83
    
84
}
(-)a/javafx2.project/src/org/netbeans/modules/javafx2/project/ui/JFXProjectPropertiesSaver.java (-73 lines)
Removed Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common Development and
11
 * Distribution License("CDDL") (collectively, the "License"). You may not use
12
 * this file except in compliance with the License. You can obtain a copy of
13
 * the License at http://www.netbeans.org/cddl-gplv2.html or
14
 * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
15
 * governing permissions and limitations under the License. When distributing
16
 * the software, include this License Header Notice in each file and include
17
 * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
18
 * particular file as subject to the "Classpath" exception as provided by
19
 * Oracle in the GPL Version 2 section of the License file that accompanied
20
 * this code. If applicable, add the following below the License Header, with
21
 * the fields enclosed by brackets [] replaced by your own identifying
22
 * information: "Portions Copyrighted [year] [name of copyright owner]"
23
 *
24
 * If you wish your version of this file to be governed by only the CDDL or
25
 * only the GPL Version 2, indicate your decision by adding "[Contributor]
26
 * elects to include this software in this distribution under the [CDDL or GPL
27
 * Version 2] license." If you do not indicate a single choice of license, a
28
 * recipient has the option to distribute your version of this file under
29
 * either the CDDL, the GPL Version 2 or to extend the choice of license to its
30
 * licensees as provided above. However, if you add GPL Version 2 code and
31
 * therefore, elected the GPL Version 2 license, then the option applies only
32
 * if the new code is made subject to such option by the copyright holder.
33
 *
34
 * Contributor(s):
35
 *
36
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
37
 */
38
package org.netbeans.modules.javafx2.project.ui;
39
40
import java.io.IOException;
41
import org.netbeans.api.project.Project;
42
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertySaver;
43
import org.netbeans.modules.javafx2.project.JFXProjectProperties;
44
import org.netbeans.spi.project.ProjectServiceProvider;
45
import org.openide.util.Exceptions;
46
47
/**
48
 * Provides saver service for JavaFX 2.0 specific project properties
49
 * for use in standard J2SE Project Properties dialog so that all properties
50
 * can be properly saved in project.properties and private.properties when 
51
 * OK button is pressed.
52
 * 
53
 * @author Petr Somol
54
 */
55
@ProjectServiceProvider(service=J2SECustomPropertySaver.class, projectType="org-netbeans-modules-java-j2seproject")
56
public class JFXProjectPropertiesSaver implements J2SECustomPropertySaver {
57
   
58
    public JFXProjectPropertiesSaver() {}
59
    
60
    @Override
61
    public void save(Project project) {
62
        JFXProjectProperties prop = JFXProjectProperties.getInstanceIfExists(project.getLookup());
63
        if(prop != null) {
64
            try {
65
                prop.store();
66
                JFXProjectProperties.cleanup(project.getLookup());
67
            } catch (IOException ex) {
68
                Exceptions.printStackTrace(ex);
69
            }
70
        }
71
    }
72
    
73
}
(-)a/javafx2.project/src/org/netbeans/modules/javafx2/project/ui/JFXRunCategoryProvider.java (-4 / +1 lines)
Lines 56-63 Link Here
56
56
57
    private static final String CAT_RUN = "Run"; // NOI18N
57
    private static final String CAT_RUN = "Run"; // NOI18N
58
    
58
    
59
    private static JFXProjectProperties jfxProps = null;
60
       
61
    @Override
59
    @Override
62
    public Category createCategory(Lookup context) {
60
    public Category createCategory(Lookup context) {
63
        boolean fxProjectEnabled = true;
61
        boolean fxProjectEnabled = true;
Lines 68-74 Link Here
68
                    && !JFXProjectProperties.isTrue(j2sepe.evaluator().getProperty(JFXProjectProperties.JAVAFX_PRELOADER)); //NOI18N
66
                    && !JFXProjectProperties.isTrue(j2sepe.evaluator().getProperty(JFXProjectProperties.JAVAFX_PRELOADER)); //NOI18N
69
        }
67
        }
70
        if(fxProjectEnabled) {
68
        if(fxProjectEnabled) {
71
            jfxProps = JFXProjectProperties.getInstancePerSession(context, CAT_RUN);
72
            return ProjectCustomizer.Category.create(CAT_RUN,
69
            return ProjectCustomizer.Category.create(CAT_RUN,
73
                    NbBundle.getMessage(JFXRunCategoryProvider.class, "LBL_Category_Run"), null); //NOI18N
70
                    NbBundle.getMessage(JFXRunCategoryProvider.class, "LBL_Category_Run"), null); //NOI18N
74
        }
71
        }
Lines 77-83 Link Here
77
74
78
    @Override
75
    @Override
79
    public JComponent createComponent(Category category, Lookup context) {
76
    public JComponent createComponent(Category category, Lookup context) {
80
        return new JFXRunPanel(jfxProps);
77
        return new JFXRunPanel(JFXProjectProperties.getInstance(context));
81
    }
78
    }
82
79
83
}
80
}
(-)a/javawebstart/manifest.mf (-1 / +1 lines)
Lines 2-6 Link Here
2
OpenIDE-Module: org.netbeans.modules.javawebstart
2
OpenIDE-Module: org.netbeans.modules.javawebstart
3
OpenIDE-Module-Layer: org/netbeans/modules/javawebstart/layer.xml
3
OpenIDE-Module-Layer: org/netbeans/modules/javawebstart/layer.xml
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javawebstart/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/javawebstart/Bundle.properties
5
OpenIDE-Module-Specification-Version: 1.19
5
OpenIDE-Module-Specification-Version: 1.20
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/javawebstart/nbproject/project.xml (-1 / +1 lines)
Lines 90-96 Link Here
90
                    <compile-dependency/>
90
                    <compile-dependency/>
91
                    <run-dependency>
91
                    <run-dependency>
92
                        <release-version>1</release-version>
92
                        <release-version>1</release-version>
93
                        <specification-version>1.46</specification-version>
93
                        <specification-version>1.56</specification-version>
94
                    </run-dependency>
94
                    </run-dependency>
95
                </dependency>
95
                </dependency>
96
                <dependency>
96
                <dependency>
(-)a/javawebstart/src/org/netbeans/modules/javawebstart/layer.xml (+12 lines)
Lines 114-119 Link Here
114
            </folder>
114
            </folder>
115
        </folder>
115
        </folder>
116
    </folder>
116
    </folder>
117
    <folder name="Projects">
118
        <folder name="org-netbeans-modules-java-j2seproject">
119
            <folder name="Lookup">
120
                <file name="org-netbeans-modules-javawebstart-ui-customizer-JWSProjectPropertiesHandler.instance">
121
                    <attr name="instanceClass" stringvalue="org.netbeans.modules.javawebstart.ui.customizer.JWSProjectPropertiesHandler"/>
122
                    <attr name="instanceCreate" methodvalue="org.netbeans.modules.projectapi.LazyLookupProviders.forProjectServiceProvider"/>
123
                    <attr name="instanceOf" stringvalue="org.netbeans.modules.java.j2seproject.api.J2SECustomPropertyHandler"/>
124
                </file>
125
                <file name="org-netbeans-modules-javawebstart-ui-customizer-JWSProjectPropertiesSaver.instance_hidden"/>
126
            </folder>
127
        </folder>
128
    </folder>
117
    <folder name="Templates">
129
    <folder name="Templates">
118
        <folder name="JWS">
130
        <folder name="JWS">
119
            <attr name="position" intvalue="0"/>
131
            <attr name="position" intvalue="0"/>
(-)a/javawebstart/src/org/netbeans/modules/javawebstart/ui/customizer/JWSCompositeCategoryProvider.java (-4 / +1 lines)
Lines 62-69 Link Here
62
62
63
    private static final String CAT_WEBSTART = "WebStart"; // NOI18N
63
    private static final String CAT_WEBSTART = "WebStart"; // NOI18N
64
    
64
    
65
    private static JWSProjectProperties jwsProps = null;
66
67
    public JWSCompositeCategoryProvider() {}
65
    public JWSCompositeCategoryProvider() {}
68
    
66
    
69
    @Override
67
    @Override
Lines 74-87 Link Here
74
            final J2SEPropertyEvaluator j2sepe = project.getLookup().lookup(J2SEPropertyEvaluator.class);
72
            final J2SEPropertyEvaluator j2sepe = project.getLookup().lookup(J2SEPropertyEvaluator.class);
75
            fxOverride = JWSProjectProperties.isTrue(j2sepe.evaluator().getProperty("javafx.enabled")); //NOI18N
73
            fxOverride = JWSProjectProperties.isTrue(j2sepe.evaluator().getProperty("javafx.enabled")); //NOI18N
76
        }
74
        }
77
        jwsProps = JWSProjectProperties.getInstancePerSession(context, CAT_WEBSTART);
78
        return fxOverride ? null : ProjectCustomizer.Category.create(CAT_WEBSTART,
75
        return fxOverride ? null : ProjectCustomizer.Category.create(CAT_WEBSTART,
79
                    NbBundle.getMessage(JWSCompositeCategoryProvider.class, "LBL_Category_WebStart"), null); //NOI18N
76
                    NbBundle.getMessage(JWSCompositeCategoryProvider.class, "LBL_Category_WebStart"), null); //NOI18N
80
    }
77
    }
81
    
78
    
82
    @Override
79
    @Override
83
    public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) {
80
    public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) {
84
        return new JWSCustomizerPanel(jwsProps);
81
        return new JWSCustomizerPanel(JWSProjectProperties.getInstance(context));
85
    }
82
    }
86
83
87
}
84
}
(-)a/javawebstart/src/org/netbeans/modules/javawebstart/ui/customizer/JWSProjectProperties.java (-3 / +5 lines)
Lines 263-278 Link Here
263
263
264
    /** Factory method 
264
    /** Factory method 
265
     * This is to prevent reuse of the same instance after the properties dialog
265
     * This is to prevent reuse of the same instance after the properties dialog
266
     * has been cancelled. Called by each FX category provider at the time
266
     * has been cancelled. Called by each WS category provider at the time
267
     * when properties dialog is opened, it checks/stores category-specific marker strings. 
267
     * when properties dialog is opened, it checks/stores category-specific marker strings. 
268
     * Previous existence of marker string indicates that properties dialog had been opened
268
     * Previous existence of marker string indicates that properties dialog had been opened
269
     * before and ended by Cancel, otherwise this instance would not exist (OK would
269
     * before and ended by Cancel, otherwise this instance would not exist (OK would
270
     * cause properties to be saved and the instance deleted by a call to JFXProjectProperties.cleanup()).
270
     * cause properties to be saved and the instance deleted by a call to JWSProjectProperties.cleanup()).
271
     * (Note that this is a workaround to avoid adding listener to properties dialog close event.)
271
     * (Note that this is a workaround to avoid adding listener to properties dialog close event.)
272
     * 
272
     * 
273
     * @param category marker string to indicate which category provider is calling this
273
     * @param category marker string to indicate which category provider is calling this
274
     * @return instance of JFXProjectProperties shared among category panels in the current Project Properties dialog only
274
     * @return instance of JWSProjectProperties shared among category panels in the current Project Properties dialog only
275
     * @deprecated J2SECustomPropertyHandler handles cleanup of project properties both after OK and Cancel
275
     */
276
     */
277
    @Deprecated
276
    public static JWSProjectProperties getInstancePerSession(Lookup context, String category) {
278
    public static JWSProjectProperties getInstancePerSession(Lookup context, String category) {
277
        Project proj = context.lookup(Project.class);
279
        Project proj = context.lookup(Project.class);
278
        String projDir = proj.getProjectDirectory().getPath();
280
        String projDir = proj.getProjectDirectory().getPath();
(-)f28958b14e16 (+79 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2012 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2012 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.javawebstart.ui.customizer;
43
44
import org.netbeans.api.project.Project;
45
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertyHandler;
46
import org.netbeans.spi.project.ProjectServiceProvider;
47
48
/**
49
 * Provides handler service for WebStart specific project properties
50
 * for use in standard J2SE Project Properties dialog so that all properties
51
 * can be properly saved in project.properties and private.properties when
52
 * OK button is pressed, and memory gets cleaned when dialog gets closed. 
53
 * Note that this enables reaction to change of Java Platform.
54
 *
55
 * @author Petr Somol
56
 */
57
@ProjectServiceProvider(service=J2SECustomPropertyHandler.class, projectType="org-netbeans-modules-java-j2seproject")
58
public class JWSProjectPropertiesHandler implements J2SECustomPropertyHandler {
59
60
    public JWSProjectPropertiesHandler() {}
61
62
    @Override
63
    public void save(Project project) {
64
        JWSProjectProperties prop = JWSProjectProperties.getInstanceIfExists(project.getLookup());
65
        if(prop != null) {
66
            JWSProjectPropertiesUtils.updateMasterFiles(prop, project);
67
            JWSProjectPropertiesUtils.savePropsAndUpdateMetaFiles(prop, project);
68
        }
69
    }
70
71
    @Override
72
    public void cleanup(Project project) {
73
        JWSProjectProperties prop = JWSProjectProperties.getInstanceIfExists(project.getLookup());
74
        if(prop != null) {
75
            JWSProjectProperties.cleanup(project.getLookup());
76
        }
77
    }
78
79
}
(-)a/javawebstart/src/org/netbeans/modules/javawebstart/ui/customizer/JWSProjectPropertiesSaver.java (-71 lines)
Removed Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.javawebstart.ui.customizer;
43
44
import org.netbeans.api.project.Project;
45
import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertySaver;
46
import org.netbeans.spi.project.ProjectServiceProvider;
47
48
/**
49
 * Provides saver service for WebStart specific project properties
50
 * for use in standard J2SE Project Properties dialog so that all properties
51
 * can be properly saved in project.properties and private.properties when
52
 * OK button is pressed. Note that this enables reaction to change of Java Platform.
53
 *
54
 * @author Petr Somol
55
 */
56
@ProjectServiceProvider(service=J2SECustomPropertySaver.class, projectType="org-netbeans-modules-java-j2seproject")
57
public class JWSProjectPropertiesSaver implements J2SECustomPropertySaver {
58
59
    public JWSProjectPropertiesSaver() {}
60
61
    @Override
62
    public void save(Project project) {
63
        JWSProjectProperties prop = JWSProjectProperties.getInstanceIfExists(project.getLookup());
64
        if(prop != null) {
65
            JWSProjectPropertiesUtils.updateMasterFiles(prop, project);
66
            JWSProjectPropertiesUtils.savePropsAndUpdateMetaFiles(prop, project);
67
            JWSProjectProperties.cleanup(project.getLookup());
68
        }
69
    }
70
71
}

Return to bug 219827