# HG changeset patch
# Parent ed6c13e8359ad0445cf20e6155098198f7881f10
diff -r ed6c13e8359a java.j2seproject/apichanges.xml
--- a/java.j2seproject/apichanges.xml Tue Aug 09 13:53:06 2011 +0200
+++ b/java.j2seproject/apichanges.xml Tue Aug 09 13:54:53 2011 +0200
@@ -109,6 +109,24 @@
+ Enable correct handling of properties in Project Property dialog of an extension of JSE Project
+
+
+
+
+
+ Added interface J2SECustomPropertySaver
with method save()
+ to enable correct saving of properties added by JSE Project extending modules.
+ If a JSE Project extending module adds/modifies panels in Project Property
+ panels, then a mechanism is needed to ensure that all user-modified properties
+ are correctly stored in project.properties and private.properties when OK pressed.
+
+
+
+
+
+
+
Added class for accessing PropertyEvaluator for given JSE Project
diff -r ed6c13e8359a java.j2seproject/manifest.mf
--- a/java.j2seproject/manifest.mf Tue Aug 09 13:53:06 2011 +0200
+++ b/java.j2seproject/manifest.mf Tue Aug 09 13:54:53 2011 +0200
@@ -2,6 +2,6 @@
OpenIDE-Module: org.netbeans.modules.java.j2seproject/1
OpenIDE-Module-Layer: org/netbeans/modules/java/j2seproject/ui/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/j2seproject/Bundle.properties
-OpenIDE-Module-Implementation-Version: 45
+OpenIDE-Module-Implementation-Version: 46
AutoUpdate-Show-In-Client: false
diff -r ed6c13e8359a java.j2seproject/nbproject/project.properties
--- a/java.j2seproject/nbproject/project.properties Tue Aug 09 13:53:06 2011 +0200
+++ b/java.j2seproject/nbproject/project.properties Tue Aug 09 13:54:53 2011 +0200
@@ -42,7 +42,7 @@
javac.compilerargs=-Xlint -Xlint:-serial
javac.source=1.6
-spec.version.base=1.45.0
+spec.version.base=1.46.0
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml
diff -r ed6c13e8359a java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SECustomPropertySaver.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SECustomPropertySaver.java Tue Aug 09 13:54:53 2011 +0200
@@ -0,0 +1,64 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
+ *
+ * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+ * Other names may be trademarks of their respective owners.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development and
+ * Distribution License("CDDL") (collectively, the "License"). You may not use
+ * this file except in compliance with the License. You can obtain a copy of
+ * the License at http://www.netbeans.org/cddl-gplv2.html or
+ * nbbuild/licenses/CDDL-GPL-2-CP. See the License for the specific language
+ * governing permissions and limitations under the License. When distributing
+ * the software, include this License Header Notice in each file and include
+ * the License file at nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided by
+ * Oracle in the GPL Version 2 section of the License file that accompanied
+ * this code. If applicable, add the following below the License Header, with
+ * the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you do not indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to its
+ * licensees as provided above. However, if you add GPL Version 2 code and
+ * therefore, elected the GPL Version 2 license, then the option applies only
+ * if the new code is made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2011 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.java.j2seproject.api;
+
+import org.netbeans.api.project.Project;
+
+/**
+ * Property saver to be implemented by J2SE Project extension modules
+ * that introduce new project properties. Registered savers are
+ * used to save extended propertes in addition to standard J2SE Project properties
+ * if modified by user in Project Properties dialog.
+ * Implementation of the interface should be registered using {@link org.netbeans.spi.project.ProjectServiceProvider}.
+ *
+ * @author Petr Somol
+ * @since 1.46
+ */
+public interface J2SECustomPropertySaver {
+
+ /**
+ * Method is called when OK is pressed in JSE Project Properties dialog
+ * and properties supplied by JSE Project extension module
+ * (thus not handled by JSE Project itself)
+ * need to be stored in project.properties and private.properties.
+ *
+ * @param p project whose extension properties are to be saved
+ */
+ void save(Project p);
+
+}
diff -r ed6c13e8359a java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerProviderImpl.java
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerProviderImpl.java Tue Aug 09 13:53:06 2011 +0200
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerProviderImpl.java Tue Aug 09 13:54:53 2011 +0200
@@ -44,6 +44,7 @@
package org.netbeans.modules.java.j2seproject.ui.customizer;
+import org.netbeans.modules.java.j2seproject.api.J2SECustomPropertySaver;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dialog;
@@ -124,7 +125,7 @@
});
OptionListener listener = new OptionListener( project, uiProperties );
- StoreListener storeListener = new StoreListener(uiProperties);
+ StoreListener storeListener = new StoreListener( project, uiProperties );
dialog = ProjectCustomizer.createCustomizerDialog(CUSTOMIZER_FOLDER_PATH, context, preselectedCategory, listener, storeListener, null);
dialog.addWindowListener( listener );
dialog.setTitle( MessageFormat.format(
@@ -155,16 +156,20 @@
private class StoreListener implements ActionListener {
+ private Project project;
private J2SEProjectProperties uiProperties;
- StoreListener(J2SEProjectProperties uiProperties ) {
+ StoreListener(Project project, J2SEProjectProperties uiProperties ) {
+ this.project = project;
this.uiProperties = uiProperties;
}
public void actionPerformed(ActionEvent e) {
uiProperties.save();
+ for (J2SECustomPropertySaver saver : project.getLookup().lookupAll(J2SECustomPropertySaver.class)) {
+ saver.save(project);
+ }
}
-
}
/** Listens to the actions on the Customizer's option buttons */