diff --git a/j2ee.clientproject/nbproject/project.xml b/j2ee.clientproject/nbproject/project.xml
--- a/j2ee.clientproject/nbproject/project.xml
+++ b/j2ee.clientproject/nbproject/project.xml
@@ -178,7 +178,7 @@ made subject to such option by the copyr
0-1
- 1.0
+ 1.1
diff --git a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/AppClientProject.java b/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/AppClientProject.java
--- a/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/AppClientProject.java
+++ b/j2ee.clientproject/src/org/netbeans/modules/j2ee/clientproject/AppClientProject.java
@@ -87,6 +87,7 @@ import org.netbeans.modules.j2ee.deploym
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
import org.netbeans.modules.j2ee.spi.ejbjar.CarFactory;
import org.netbeans.modules.java.api.common.SourceRoots;
+import org.netbeans.modules.java.api.common.TemplateAttributesSupport;
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
import org.netbeans.modules.java.api.common.ant.UpdateImplementation;
import org.netbeans.modules.java.api.common.queries.QuerySupport;
@@ -118,6 +119,7 @@ import org.netbeans.spi.project.ui.Proje
import org.netbeans.spi.project.ui.ProjectOpenedHook;
import org.netbeans.spi.project.ui.RecommendedTemplates;
import org.netbeans.spi.project.ui.support.UILookupMergerSupport;
+import org.netbeans.spi.queries.FileEncodingQueryImplementation;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.filesystems.FileAttributeEvent;
@@ -296,6 +298,7 @@ public final class AppClientProject impl
sourcesHelper.registerExternalRoots(FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
}
});
+ FileEncodingQueryImplementation encodingQuery = QuerySupport.createFileEncodingQuery(evaluator(), AppClientProjectProperties.SOURCE_ENCODING);
Lookup base = Lookups.fixed(new Object[] {
new Info(),
aux,
@@ -317,7 +320,8 @@ public final class AppClientProject impl
QuerySupport.createSharabilityQuery(helper, evaluator(), getSourceRoots(), getTestSourceRoots(),
AppClientProjectProperties.META_INF),
QuerySupport.createFileBuiltQuery(helper, evaluator(), getSourceRoots(), getTestSourceRoots()),
- QuerySupport.createFileEncodingQuery(evaluator(), AppClientProjectProperties.SOURCE_ENCODING),
+ encodingQuery,
+ TemplateAttributesSupport.createTemplateAttributesProvider(helper, encodingQuery),
new RecommendedTemplatesImpl(this.updateHelper),
classPathExtender,
buildExtender,
diff --git a/j2ee.ejbjarproject/nbproject/project.xml b/j2ee.ejbjarproject/nbproject/project.xml
--- a/j2ee.ejbjarproject/nbproject/project.xml
+++ b/j2ee.ejbjarproject/nbproject/project.xml
@@ -212,7 +212,7 @@ made subject to such option by the copyr
0-1
- 1.0
+ 1.1
diff --git a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java
--- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java
+++ b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarProject.java
@@ -123,6 +123,7 @@ import org.netbeans.modules.j2ee.common.
import org.netbeans.modules.j2ee.common.project.ui.UserProjectSettings;
import org.netbeans.modules.j2ee.ejbjarproject.ui.customizer.CustomizerProviderImpl;
import org.netbeans.modules.java.api.common.SourceRoots;
+import org.netbeans.modules.java.api.common.TemplateAttributesSupport;
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
import org.netbeans.modules.java.api.common.ant.UpdateImplementation;
import org.netbeans.modules.java.api.common.queries.QuerySupport;
@@ -146,6 +147,7 @@ import org.netbeans.spi.project.support.
import org.netbeans.spi.project.support.LookupProviderSupport;
import org.netbeans.spi.project.support.ant.PropertyUtils;
import org.netbeans.spi.project.ui.support.UILookupMergerSupport;
+import org.netbeans.spi.queries.FileEncodingQueryImplementation;
import org.openide.NotifyDescriptor;
import org.openide.filesystems.FileEvent;
import org.openide.filesystems.FileRenameEvent;
@@ -377,6 +379,7 @@ public class EjbJarProject implements Pr
sourcesHelper.registerExternalRoots(FileOwnerQuery.EXTERNAL_ALGORITHM_TRANSIENT);
}
});
+ FileEncodingQueryImplementation encodingQuery = QuerySupport.createFileEncodingQuery(evaluator(), EjbJarProjectProperties.SOURCE_ENCODING);
Lookup base = Lookups.fixed(new Object[] {
EjbJarProject.this, // never cast an externally obtained Project to EjbJarProject - use lookup instead
buildExtender,
@@ -403,7 +406,7 @@ public class EjbJarProject implements Pr
QuerySupport.createSharabilityQuery(helper, evaluator(), getSourceRoots(), getTestSourceRoots(),
EjbJarProjectProperties.META_INF),
QuerySupport.createFileBuiltQuery(helper, evaluator(), getSourceRoots(), getTestSourceRoots()),
- QuerySupport.createFileEncodingQuery(evaluator(), EjbJarProjectProperties.SOURCE_ENCODING),
+ encodingQuery,
new RecommendedTemplatesImpl(updateHelper),
refHelper,
classPathExtender,
@@ -418,7 +421,7 @@ public class EjbJarProject implements Pr
UILookupMergerSupport.createPrivilegedTemplatesMerger(),
UILookupMergerSupport.createRecommendedTemplatesMerger(),
LookupProviderSupport.createSourcesMerger(),
- new EjbJarTemplateAttributesProvider(helper),
+ TemplateAttributesSupport.createTemplateAttributesProvider(helper, encodingQuery),
ExtraSourceJavadocSupport.createExtraSourceQueryImplementation(this, helper, eval),
LookupMergerSupport.createSFBLookupMerger(),
ExtraSourceJavadocSupport.createExtraJavadocQueryImplementation(this, helper, eval),
diff --git a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarTemplateAttributesProvider.java b/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarTemplateAttributesProvider.java
deleted file mode 100644
--- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/EjbJarTemplateAttributesProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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.j2ee.ejbjarproject;
-
-import java.util.Collections;
-import java.util.Map;
-import org.netbeans.spi.project.support.ant.AntProjectHelper;
-import org.netbeans.spi.project.support.ant.EditableProperties;
-import org.openide.loaders.CreateFromTemplateAttributesProvider;
-import org.openide.loaders.DataFolder;
-import org.openide.loaders.DataObject;
-
-/**
- * Provides attributes that can be used inside scripting templates.
- * project.license
- * - attribute containing license name.
- * The provider reads
project.license
property from build.properties
- * and returns it as the template attribute. In case the property is not available
- * the attribute is filled with "default"
value.
- *
- *
- * @author Jan Pokorsky
- */
-final class EjbJarTemplateAttributesProvider implements CreateFromTemplateAttributesProvider {
-
- private final AntProjectHelper helper;
-
- EjbJarTemplateAttributesProvider(AntProjectHelper helper) {
- this.helper = helper;
- }
-
- public Map attributesFor(DataObject template, DataFolder target, String name) {
- EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
- String license = props.getProperty("project.license"); // NOI18N
- if (license == null) {
- return null;
- } else {
- return Collections.singletonMap("project", Collections.singletonMap("license", license)); // NOI18N
- }
- }
-
-}
diff --git a/java.api.common/manifest.mf b/java.api.common/manifest.mf
--- a/java.api.common/manifest.mf
+++ b/java.api.common/manifest.mf
@@ -1,4 +1,4 @@ Manifest-Version: 1.0
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.modules.java.api.common/0
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.0
+OpenIDE-Module-Specification-Version: 1.1
diff --git a/java.api.common/nbproject/project.xml b/java.api.common/nbproject/project.xml
--- a/java.api.common/nbproject/project.xml
+++ b/java.api.common/nbproject/project.xml
@@ -93,11 +93,27 @@
+ org.openide.loaders
+
+
+
+ 6.9
+
+
+
org.openide.modules
7.4
+
+
+
+ org.openide.nodes
+
+
+
+ 7.3
diff --git a/java.api.common/src/org/netbeans/modules/java/api/common/TemplateAttributesSupport.java b/java.api.common/src/org/netbeans/modules/java/api/common/TemplateAttributesSupport.java
new file mode 100644
--- /dev/null
+++ b/java.api.common/src/org/netbeans/modules/java/api/common/TemplateAttributesSupport.java
@@ -0,0 +1,108 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * 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. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun 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 2008 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.java.api.common;
+
+import java.nio.charset.Charset;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import org.netbeans.spi.project.support.ant.AntProjectHelper;
+import org.netbeans.spi.project.support.ant.EditableProperties;
+import org.netbeans.spi.queries.FileEncodingQueryImplementation;
+import org.openide.loaders.CreateFromTemplateAttributesProvider;
+import org.openide.loaders.DataFolder;
+import org.openide.loaders.DataObject;
+import org.openide.util.Parameters;
+
+/**
+ * Provides support for creating implementations of {@link CreateFromTemplateAttributesProvider}.
+ *
+ * @author Andrei Badea
+ *
+ * @since 1.1
+ */
+public final class TemplateAttributesSupport {
+
+ private TemplateAttributesSupport() {}
+
+ /**
+ * Creates an implementation of {@link CreateFromTemplateAttributesProvider} providing
+ * attributes for the project license and encoding.
+ *
+ * @param helper {@link AntProjectHelper} used for reading the project properties.
+ * @param encodingQuery {@link FileEncodingQueryImplementation} used to obtain an encoding.
+ * @return a {@code CreateFromTemplateAttributesProvider}.
+ */
+ public static CreateFromTemplateAttributesProvider createTemplateAttributesProvider(AntProjectHelper helper, FileEncodingQueryImplementation encodingQuery) {
+ Parameters.notNull("helper", helper);
+ Parameters.notNull("encodingQuery", encodingQuery);
+ return new ProviderImpl(helper, encodingQuery);
+ }
+
+ private static final class ProviderImpl implements CreateFromTemplateAttributesProvider {
+
+ private final AntProjectHelper helper;
+ private final FileEncodingQueryImplementation encodingQuery;
+
+ public ProviderImpl(AntProjectHelper helper, FileEncodingQueryImplementation encodingQuery) {
+ this.helper = helper;
+ this.encodingQuery = encodingQuery;
+ }
+
+ public Map attributesFor(DataObject template, DataFolder target, String name) {
+ EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
+ String license = props.getProperty("project.license"); // NOI18N
+ Charset charset = encodingQuery.getEncoding(target.getPrimaryFile());
+ String encoding = (charset != null) ? charset.name() : null;
+ if (license == null && encoding == null) {
+ return null;
+ } else {
+ Map values = new HashMap();
+ if (license != null) {
+ values. put("license", license); // NOI18N
+ }
+ if (encoding != null) {
+ values. put("encoding", encoding); // NOI18N
+ }
+ return Collections.singletonMap("project", values); // NOI18N
+ }
+ }
+ }
+}
diff --git a/java.j2seproject/nbproject/project.xml b/java.j2seproject/nbproject/project.xml
--- a/java.j2seproject/nbproject/project.xml
+++ b/java.j2seproject/nbproject/project.xml
@@ -122,7 +122,7 @@ made subject to such option by the copyr
0-1
- 1.0
+ 1.1
diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProject.java
@@ -68,6 +68,7 @@ import org.netbeans.api.project.ant.AntA
import org.netbeans.api.project.ant.AntArtifact;
import org.netbeans.api.project.ant.AntBuildExtender;
import org.netbeans.modules.java.api.common.SourceRoots;
+import org.netbeans.modules.java.api.common.TemplateAttributesSupport;
import org.netbeans.modules.java.api.common.ant.UpdateHelper;
import org.netbeans.modules.java.api.common.ant.UpdateImplementation;
import org.netbeans.modules.java.api.common.queries.QuerySupport;
@@ -104,6 +105,7 @@ import org.netbeans.spi.project.ui.Proje
import org.netbeans.spi.project.ui.ProjectOpenedHook;
import org.netbeans.spi.project.ui.RecommendedTemplates;
import org.netbeans.spi.project.ui.support.UILookupMergerSupport;
+import org.netbeans.spi.queries.FileEncodingQueryImplementation;
import org.openide.DialogDisplayer;
import org.openide.ErrorManager;
import org.openide.NotifyDescriptor;
@@ -253,6 +255,7 @@ public final class J2SEProject implement
private Lookup createLookup(final AuxiliaryConfiguration aux,
final ActionProvider actionProvider) {
final SubprojectProvider spp = refHelper.createSubprojectProvider();
+ FileEncodingQueryImplementation encodingQuery = QuerySupport.createFileEncodingQuery(evaluator(), J2SEProjectProperties.SOURCE_ENCODING);
final Lookup base = Lookups.fixed(new Object[] {
J2SEProject.this,
new Info(),
@@ -285,9 +288,9 @@ public final class J2SEProject implement
UILookupMergerSupport.createPrivilegedTemplatesMerger(),
UILookupMergerSupport.createRecommendedTemplatesMerger(),
LookupProviderSupport.createSourcesMerger(),
- QuerySupport.createFileEncodingQuery(evaluator(), J2SEProjectProperties.SOURCE_ENCODING),
+ encodingQuery,
new J2SEPropertyEvaluatorImpl(evaluator()),
- new J2SETemplateAttributesProvider(this.helper),
+ TemplateAttributesSupport.createTemplateAttributesProvider(helper, encodingQuery),
ExtraSourceJavadocSupport.createExtraSourceQueryImplementation(this, helper, eval),
LookupMergerSupport.createSFBLookupMerger(),
ExtraSourceJavadocSupport.createExtraJavadocQueryImplementation(this, helper, eval),
diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SETemplateAttributesProvider.java b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SETemplateAttributesProvider.java
deleted file mode 100644
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SETemplateAttributesProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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;
-
-import java.util.Collections;
-import java.util.Map;
-import org.netbeans.spi.project.support.ant.AntProjectHelper;
-import org.netbeans.spi.project.support.ant.EditableProperties;
-import org.openide.loaders.CreateFromTemplateAttributesProvider;
-import org.openide.loaders.DataFolder;
-import org.openide.loaders.DataObject;
-
-/**
- * Provides attributes that can be used inside scripting templates.
- * project.license
- * - attribute containing license name.
- * The provider reads
project.license
property from build.properties
- * and returns it as the template attribute. In case the property is not available
- * the attribute is filled with "default"
value.
- *
- *
- * @author Jan Pokorsky
- */
-final class J2SETemplateAttributesProvider implements CreateFromTemplateAttributesProvider {
-
- private final AntProjectHelper helper;
-
- J2SETemplateAttributesProvider(AntProjectHelper helper) {
- this.helper = helper;
- }
-
- public Map attributesFor(DataObject template, DataFolder target, String name) {
- EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
- String license = props.getProperty("project.license"); // NOI18N
- if (license == null) {
- return null;
- } else {
- return Collections.singletonMap("project", Collections.singletonMap("license", license)); // NOI18N
- }
- }
-
-}
diff --git a/web.project/nbproject/project.xml b/web.project/nbproject/project.xml
--- a/web.project/nbproject/project.xml
+++ b/web.project/nbproject/project.xml
@@ -226,7 +226,7 @@ made subject to such option by the copyr
0-1
- 1.0
+ 1.1
diff --git a/web.project/src/org/netbeans/modules/web/project/WebProject.java b/web.project/src/org/netbeans/modules/web/project/WebProject.java
--- a/web.project/src/org/netbeans/modules/web/project/WebProject.java
+++ b/web.project/src/org/netbeans/modules/web/project/WebProject.java
@@ -50,7 +50,6 @@ import java.util.logging.Level;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
-import java.util.logging.Logger;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -61,12 +60,12 @@ import org.netbeans.modules.web.project.
import org.netbeans.modules.web.project.api.WebPropertyEvaluator;
import org.netbeans.modules.web.project.jaxws.WebProjectJAXWSClientSupport;
import org.netbeans.modules.web.project.jaxws.WebProjectJAXWSSupport;
+import org.netbeans.modules.web.spi.webmodule.WebPrivilegedTemplates;
import org.netbeans.modules.websvc.api.jaxws.client.JAXWSClientSupport;
import org.netbeans.modules.websvc.jaxws.api.JAXWSSupport;
import org.netbeans.modules.websvc.jaxws.spi.JAXWSSupportFactory;
import org.netbeans.modules.websvc.spi.client.WebServicesClientSupportFactory;
import org.netbeans.modules.websvc.spi.jaxws.client.JAXWSClientSupportFactory;
-import org.openide.util.lookup.Lookups;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -122,6 +121,7 @@ import org.netbeans.modules.j2ee.common.
import org.netbeans.modules.j2ee.common.ui.BrokenServerSupport;
import org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment;
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule;
+import org.netbeans.modules.java.api.common.TemplateAttributesSupport;
import org.netbeans.modules.web.api.webmodule.WebProjectConstants;
import org.netbeans.modules.web.project.classpath.ClassPathSupportCallbackImpl;
import org.netbeans.modules.web.project.classpath.WebProjectLibrariesModifierImpl;
@@ -129,7 +129,6 @@ import org.netbeans.modules.web.project.
import org.netbeans.modules.web.project.spi.BrokenLibraryRefFilter;
import org.netbeans.modules.web.project.spi.BrokenLibraryRefFilterProvider;
import org.netbeans.modules.web.project.ui.customizer.CustomizerProviderImpl;
-import org.netbeans.modules.web.spi.webmodule.WebPrivilegedTemplates;
import org.netbeans.spi.project.support.ant.EditableProperties;
import org.netbeans.modules.websvc.api.webservices.WebServicesSupport;
import org.netbeans.modules.websvc.api.client.WebServicesClientSupport;
@@ -138,6 +137,7 @@ import org.netbeans.spi.java.project.sup
import org.netbeans.spi.java.project.support.ExtraSourceJavadocSupport;
import org.netbeans.spi.java.project.support.LookupMergerSupport;
import org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport;
+import org.netbeans.spi.queries.FileEncodingQueryImplementation;
import org.openide.DialogDisplayer;
import org.openide.NotifyDescriptor;
import org.openide.filesystems.FileLock;
@@ -425,6 +425,7 @@ public final class WebProject implements
private Lookup createLookup(AuxiliaryConfiguration aux, ClassPathProviderImpl cpProvider) {
SubprojectProvider spp = refHelper.createSubprojectProvider();
final WebSources webSources = new WebSources(this.helper, evaluator(), getSourceRoots(), getTestSourceRoots());
+ FileEncodingQueryImplementation encodingQuery = QuerySupport.createFileEncodingQuery(evaluator(), WebProjectProperties.SOURCE_ENCODING);
Lookup base = Lookups.fixed(new Object[] {
new Info(),
aux,
@@ -468,8 +469,8 @@ public final class WebProject implements
new WebPropertyEvaluatorImpl(evaluator()),
WebProject.this, // never cast an externally obtained Project to WebProject - use lookup instead
libMod,
- QuerySupport.createFileEncodingQuery(evaluator(), WebProjectProperties.SOURCE_ENCODING),
- new WebTemplateAttributesProvider(this.helper),
+ encodingQuery,
+ TemplateAttributesSupport.createTemplateAttributesProvider(helper, encodingQuery),
ExtraSourceJavadocSupport.createExtraSourceQueryImplementation(this, helper, eval),
LookupMergerSupport.createSFBLookupMerger(),
ExtraSourceJavadocSupport.createExtraJavadocQueryImplementation(this, helper, eval),
diff --git a/web.project/src/org/netbeans/modules/web/project/WebTemplateAttributesProvider.java b/web.project/src/org/netbeans/modules/web/project/WebTemplateAttributesProvider.java
deleted file mode 100644
--- a/web.project/src/org/netbeans/modules/web/project/WebTemplateAttributesProvider.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * 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. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun 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.web.project;
-
-import java.util.Collections;
-import java.util.Map;
-import org.netbeans.spi.project.support.ant.AntProjectHelper;
-import org.netbeans.spi.project.support.ant.EditableProperties;
-import org.openide.loaders.CreateFromTemplateAttributesProvider;
-import org.openide.loaders.DataFolder;
-import org.openide.loaders.DataObject;
-
-/**
- * Provides attributes that can be used inside scripting templates.
- * project.license
- * - attribute containing license name.
- * The provider reads
project.license
property from build.properties
- * and returns it as the template attribute. In case the property is not available
- * the attribute is filled with "default"
value.
- *
- *
- * @author Jan Pokorsky
- */
-final class WebTemplateAttributesProvider implements CreateFromTemplateAttributesProvider {
-
- private final AntProjectHelper helper;
-
- WebTemplateAttributesProvider(AntProjectHelper helper) {
- this.helper = helper;
- }
-
- public Map attributesFor(DataObject template, DataFolder target, String name) {
- EditableProperties props = helper.getProperties(AntProjectHelper.PROJECT_PROPERTIES_PATH);
- String license = props.getProperty("project.license"); // NOI18N
- if (license == null) {
- return null;
- } else {
- return Collections.singletonMap("project", Collections.singletonMap("license", license)); // NOI18N
- }
- }
-
-}