# HG changeset patch
# Parent 7b5b85f654629ffccfbc43126c5d603fef85e46e
diff -r 7b5b85f65462 java.j2seproject/apichanges.xml
--- a/java.j2seproject/apichanges.xml Tue Aug 09 11:35:50 2011 +0200
+++ b/java.j2seproject/apichanges.xml Tue Aug 09 11:37:52 2011 +0200
@@ -127,6 +127,25 @@
+ Enable extending existing JSE Project category panels in Project Properties dialog
+
+
+
+
+
+ Replace the existing J2SERunConfigProvider
interface by
+ J2SECategoryExtensionProvider
. The old interface was hardwired
+ to enable extension of Run panel only with one extension panel only. The
+ new interface provides this mechanism for any category and allows
+ multiple extension panels per category. The new functionality is needed
+ for JavaFX 2.0 support module, but is not limited to it.
+
+
+
+
+
+
+
Added class for accessing PropertyEvaluator for given JSE Project
diff -r 7b5b85f65462 java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SECategoryExtensionProvider.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SECategoryExtensionProvider.java Tue Aug 09 11:37:52 2011 +0200
@@ -0,0 +1,110 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2010 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]"
+ *
+ * Contributor(s):
+ *
+ * The Original Software is NetBeans. The Initial Developer of the Original
+ * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
+ * Microsystems, Inc. All Rights Reserved.
+ *
+ * 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.
+ */
+
+package org.netbeans.modules.java.j2seproject.api;
+
+import java.util.Map;
+import javax.swing.JComponent;
+
+import org.netbeans.api.project.Project;
+
+/**
+ * Provider of component that will be added to customizer panel of category specified
+ * by getCategory() return value. Component will be used for additional customization
+ * of a set of additional properties not customized by standard J2SE Project controls.
+ * Implementation of the interface should be registered using {@link org.netbeans.spi.project.ProjectServiceProvider}.
+ *
+ * @author Petr Somol
+ * @author Milan Kubec
+ * @since 1.46
+ */
+public interface J2SECategoryExtensionProvider {
+
+ /**
+ * Enumeration of categories for which extension is currently allowed
+ */
+ enum ExtendableCategory { PACKAGING, RUN }
+
+ /**
+ * Provides identifier of category whose panel should be extended by this component provider
+ *
+ * @returns identifier of the category to be extended
+ */
+ ExtendableCategory getCategory();
+
+ /**
+ * Provides component that is added to the customizer panel of j2seproject
+ * selected by getCategory() return value
+ *
+ * @param proj project to create the customizer component for
+ * @param listener listener to be notified when properties should be updated
+ * @returns extension panel to be added to the specified category
+ */
+ JComponent createComponent(Project proj, ConfigChangeListener listener);
+
+ /**
+ * Method is called when properties exposed by the provided component
+ * get changed externally and the component needs to be updated accordingly
+ *
+ * @param props all properties (shared + private);
+ * properites are not evaluated
+ */
+ void configUpdated(Map props);
+
+ /**
+ * Callback listener for setting properties that are changed by interaction
+ * with the component
+ */
+ interface ConfigChangeListener {
+ /**
+ * Method is called when properties should be updated, null prop value
+ * means property will be removed from the property file, only shared
+ * properties are updated; properties are not evaluated
+ *
+ * @param updates map holding updated properties
+ */
+ void propertiesChanged(Map updates);
+ }
+
+}
diff -r 7b5b85f65462 java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SERunConfigProvider.java
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SERunConfigProvider.java Tue Aug 09 11:35:50 2011 +0200
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/api/J2SERunConfigProvider.java Tue Aug 09 11:37:52 2011 +0200
@@ -53,10 +53,13 @@
* Provider of component that will be added to Run customizer panel that will
* be used for additional customization of set of properties affected by given
* run configuration. Implementation of the interface should be registered using {@link org.openide.util.lookup.ServiceProvider}.
+ * This interface is deprecated, use {@link org.netbeans.modules.java.j2seproject.api.J2SECategoryExtensionProvider} instead.
*
+ * @deprecated
* @author Milan Kubec
* @since 1.10
*/
+@Deprecated
public interface J2SERunConfigProvider {
/**
diff -r 7b5b85f65462 java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.form
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.form Tue Aug 09 11:35:50 2011 +0200
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.form Tue Aug 09 11:37:52 2011 +0200
@@ -1,4 +1,4 @@
-
+
diff -r 7b5b85f65462 java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.java
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.java Tue Aug 09 11:35:50 2011 +0200
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.java Tue Aug 09 11:37:52 2011 +0200
@@ -44,16 +44,38 @@
package org.netbeans.modules.java.j2seproject.ui.customizer;
+import java.awt.Dimension;
+import java.util.LinkedList;
+import javax.swing.Box;
+import javax.swing.JComponent;
import javax.swing.JPanel;
+import org.netbeans.api.project.Project;
+import org.netbeans.modules.java.j2seproject.J2SEProject;
import org.openide.util.HelpCtx;
+import org.netbeans.modules.java.j2seproject.api.J2SECategoryExtensionProvider;
/** Customizer for general project attributes.
*/
public class CustomizerJar extends JPanel implements HelpCtx.Provider {
+ private J2SEProject project;
+ private java.util.List compProviders = new LinkedList();
+
public CustomizerJar( J2SEProjectProperties uiProperties ) {
initComponents();
+ int nextExtensionYPos = 0;
+ this.project = uiProperties.getProject();
+ for (J2SECategoryExtensionProvider compProvider : project.getLookup().lookupAll(J2SECategoryExtensionProvider.class)) {
+ if( compProvider.getCategory() == J2SECategoryExtensionProvider.ExtendableCategory.PACKAGING ) {
+ if( addExtPanel(project,compProvider,nextExtensionYPos) ) {
+ compProviders.add(compProvider);
+ nextExtensionYPos++;
+ }
+ }
+ }
+ addPanelFiller(nextExtensionYPos);
+
distDirField.setDocument(uiProperties.DIST_JAR_MODEL);
excludeField.setDocument(uiProperties.BUILD_CLASSES_EXCLUDES_MODEL);
@@ -67,13 +89,16 @@
copyLibs.setModel(uiProperties.COPY_LIBS_MODEL);
}
+ @Override
public HelpCtx getHelpCtx() {
return new HelpCtx( CustomizerJar.class );
}
// //GEN-BEGIN:initComponents
private void initComponents() {
+ java.awt.GridBagConstraints gridBagConstraints;
+ mainPanel = new javax.swing.JPanel();
distDirLabel = new javax.swing.JLabel();
distDirField = new javax.swing.JTextField();
excludeLabel = new javax.swing.JLabel();
@@ -82,6 +107,9 @@
compressCheckBox = new javax.swing.JCheckBox();
doJarCheckBox = new javax.swing.JCheckBox();
copyLibs = new javax.swing.JCheckBox();
+ extPanel = new javax.swing.JPanel();
+
+ setLayout(new java.awt.GridBagLayout());
distDirLabel.setLabelFor(distDirField);
org.openide.awt.Mnemonics.setLocalizedText(distDirLabel, org.openide.util.NbBundle.getMessage(CustomizerJar.class, "LBL_CustomizeJar_DistDir_JTextField")); // NOI18N
@@ -101,56 +129,78 @@
org.openide.awt.Mnemonics.setLocalizedText(copyLibs, org.openide.util.NbBundle.getMessage(CustomizerJar.class, "TXT_CopyLibraries")); // NOI18N
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
- this.setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
+ javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 404, Short.MAX_VALUE)
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addGap(0, 0, 0)
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(compressCheckBox)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(doJarCheckBox)
+ .addGap(245, 245, 245))
+ .addComponent(copyLibs)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(excludeLabel)
+ .addComponent(distDirLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(excludeMessage)
+ .addComponent(excludeField, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE)
+ .addComponent(distDirField, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE))))
+ .addGap(0, 0, 0)))
+ );
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 161, Short.MAX_VALUE)
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(distDirLabel)
- .addGap(88, 88, 88)
- .addComponent(distDirField, javax.swing.GroupLayout.DEFAULT_SIZE, 391, Short.MAX_VALUE))
+ .addComponent(distDirField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(excludeLabel)
+ .addComponent(excludeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(excludeMessage)
+ .addGap(8, 8, 8)
.addComponent(compressCheckBox)
- .addGroup(layout.createSequentialGroup()
- .addComponent(excludeLabel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(excludeMessage)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 209, Short.MAX_VALUE))
- .addComponent(excludeField, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)))
- .addGroup(layout.createSequentialGroup()
- .addComponent(doJarCheckBox)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 340, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(copyLibs))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(distDirLabel)
- .addComponent(distDirField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(excludeLabel)
- .addComponent(excludeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(excludeMessage)
- .addGap(8, 8, 8)
- .addComponent(compressCheckBox)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(doJarCheckBox)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(copyLibs)
- .addContainerGap(163, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(doJarCheckBox)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(copyLibs)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
);
distDirField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(CustomizerJar.class).getString("AD_jTextFieldDistDir")); // NOI18N
excludeField.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(CustomizerJar.class).getString("AD_jTextFieldExcludes")); // NOI18N
compressCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(CustomizerJar.class).getString("AD_jCheckBoxCompress")); // NOI18N
doJarCheckBox.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerJar.class, "ACSD_BuildJarAfterCompile")); // NOI18N
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 0;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ add(mainPanel, gridBagConstraints);
+
+ extPanel.setLayout(new java.awt.GridBagLayout());
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 1;
+ gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ gridBagConstraints.weightx = 0.1;
+ gridBagConstraints.weighty = 0.1;
+ add(extPanel, gridBagConstraints);
}// //GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
@@ -162,6 +212,38 @@
private javax.swing.JTextField excludeField;
private javax.swing.JLabel excludeLabel;
private javax.swing.JLabel excludeMessage;
+ private javax.swing.JPanel extPanel;
+ private javax.swing.JPanel mainPanel;
// End of variables declaration//GEN-END:variables
+ private boolean addExtPanel(Project p, J2SECategoryExtensionProvider compProvider, int gridY) {
+ if (compProvider != null) {
+ JComponent comp = compProvider.createComponent(p, null);
+ if (comp != null) {
+ java.awt.GridBagConstraints constraints = new java.awt.GridBagConstraints();
+ constraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ constraints.gridx = 0;
+ constraints.gridy = gridY;
+ constraints.weightx = 1.0;
+ extPanel.add(comp, constraints);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void addPanelFiller(int gridY) {
+ java.awt.GridBagConstraints constraints = new java.awt.GridBagConstraints();
+ constraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
+ constraints.gridx = 0;
+ constraints.gridy = gridY;
+ constraints.weightx = 1.0;
+ constraints.weighty = 1.0;
+ extPanel.add( new Box.Filler(
+ new Dimension(),
+ new Dimension(),
+ new Dimension(10000,10000) ),
+ constraints);
+ }
+
}
diff -r 7b5b85f65462 java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerRun.form
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerRun.form Tue Aug 09 11:35:50 2011 +0200
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerRun.form Tue Aug 09 11:37:52 2011 +0200
@@ -1,4 +1,4 @@
-
+