diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/AnnotationProcessingQueryImpl.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/AnnotationProcessingQueryImpl.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/AnnotationProcessingQueryImpl.java Tue Apr 30 12:01:46 2013 +0200 @@ -147,7 +147,7 @@ final Map added = new HashMap(); final Map retained = new HashMap(); - final Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + final Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java != null) { for (Element compilationUnit : XMLUtil.findSubElements(java)) { assert compilationUnit.getLocalName().equals("compilation-unit") : compilationUnit; @@ -281,8 +281,8 @@ if (ap != null) { for (Element e : XMLUtil.findSubElements(ap)) { if (e.getLocalName().equals(EL_PROCESSOR_OPTION)) { - final Element keyElement = XMLUtil.findElement(e, "key", JavaProjectNature.NS_JAVA_3); //NOI18N - final Element valueElement = XMLUtil.findElement(e, "value", JavaProjectNature.NS_JAVA_3); //NOI18N + final Element keyElement = XMLUtil.findElement(e, "key", JavaProjectNature.NS_JAVA_LASTEST); //NOI18N + final Element valueElement = XMLUtil.findElement(e, "value", JavaProjectNature.NS_JAVA_LASTEST); //NOI18N if (keyElement == null || valueElement == null) { continue; } @@ -322,7 +322,7 @@ } private Element findAP(final Element cu) { - return cu == null ? null : XMLUtil.findElement(cu, AnnotationProcessingQueryImpl.EL_ANNOTATION_PROCESSING, JavaProjectNature.NS_JAVA_3); + return cu == null ? null : XMLUtil.findElement(cu, AnnotationProcessingQueryImpl.EL_ANNOTATION_PROCESSING, JavaProjectNature.NS_JAVA_LASTEST); } } diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/Classpaths.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/Classpaths.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/Classpaths.java Tue Apr 30 12:01:46 2013 +0200 @@ -193,7 +193,7 @@ } } // Need to create it. - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java == null) { return null; } @@ -258,7 +258,7 @@ for (String type : TYPES) { _registeredClasspaths.put(type, new HashSet()); } - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java == null) { return; } @@ -490,9 +490,9 @@ } private List createProcessorClasspath(Element compilationUnitEl) { - final Element ap = XMLUtil.findElement(compilationUnitEl, AnnotationProcessingQueryImpl.EL_ANNOTATION_PROCESSING, JavaProjectNature.NS_JAVA_3); + final Element ap = XMLUtil.findElement(compilationUnitEl, AnnotationProcessingQueryImpl.EL_ANNOTATION_PROCESSING, JavaProjectNature.NS_JAVA_LASTEST); if (ap != null) { - final Element path = XMLUtil.findElement(ap, AnnotationProcessingQueryImpl.EL_PROCESSOR_PATH, JavaProjectNature.NS_JAVA_3); + final Element path = XMLUtil.findElement(ap, AnnotationProcessingQueryImpl.EL_PROCESSOR_PATH, JavaProjectNature.NS_JAVA_LASTEST); if (path != null) { return createClasspath(path); } @@ -573,7 +573,7 @@ } private Element findCompilationUnit() { - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java == null) { return null; } diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/JavaActions.java Tue Apr 30 12:01:46 2013 +0200 @@ -775,7 +775,7 @@ } private List compilationUnits() { - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java == null) { return Collections.emptyList(); } @@ -909,7 +909,7 @@ String findSourceLevel(String sources) { Element compilationUnitEl = findCompilationUnit(sources); if (compilationUnitEl != null) { - Element sourceLevel = XMLUtil.findElement(compilationUnitEl, "source-level", JavaProjectNature.NS_JAVA_3); + Element sourceLevel = XMLUtil.findElement(compilationUnitEl, "source-level", JavaProjectNature.NS_JAVA_LASTEST); if (sourceLevel != null) { return XMLUtil.findText(sourceLevel); } diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/JavaFreeformFileBuiltQuery.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/JavaFreeformFileBuiltQuery.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/JavaFreeformFileBuiltQuery.java Tue Apr 30 12:01:46 2013 +0200 @@ -97,7 +97,7 @@ ERR.log(ErrorManager.INFORMATIONAL, "JavaFreeformFileBuiltQuery.createDelegateTo start"); // NOI18N } - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); List from = new ArrayList(); List to = new ArrayList(); diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/JavaProjectGenerator.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/JavaProjectGenerator.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/JavaProjectGenerator.java Tue Apr 30 12:01:46 2013 +0200 @@ -375,14 +375,11 @@ * @return {@link Element} representing JavaCompilationUnit instances or null */ public static Element getJavaCompilationUnits (final AuxiliaryConfiguration aux) { - Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); - if (data == null) { - data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_2, true); + for (String ns : JavaProjectNature.JAVA_NAMESPACES) { + Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, ns, true); + if (data != null) return data; } - if (data == null) { - data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_1, true); - } - return data; + return null; } /** @@ -436,7 +433,7 @@ continue; } if ("annotation-processing".equals(el.getLocalName())&& //NOI18N - JavaProjectNature.NS_JAVA_3.equals(el.getNamespaceURI())) { + JavaProjectNature.namespaceAtLeast(el.getNamespaceURI(), JavaProjectNature.NS_JAVA_3)) { cu.annotationPorocessing = new JavaCompilationUnit.AnnotationProcessing(); cu.annotationPorocessing.trigger = EnumSet.noneOf(AnnotationProcessingQuery.Trigger.class); cu.annotationPorocessing.processors = new ArrayList(); @@ -445,17 +442,17 @@ final String localName = apEl.getLocalName(); if ("scan-trigger".equals(localName)) { //NOI18N cu.annotationPorocessing.trigger.add(AnnotationProcessingQuery.Trigger.ON_SCAN); - } else if ("editor-trigger".equals(localName) && JavaProjectNature.NS_JAVA_3.equals(el.getNamespaceURI())) { //NOI18N + } else if ("editor-trigger".equals(localName)) { //NOI18N cu.annotationPorocessing.trigger.add(AnnotationProcessingQuery.Trigger.IN_EDITOR); - } else if ("source-output".equals(localName) && JavaProjectNature.NS_JAVA_3.equals(el.getNamespaceURI())) { + } else if ("source-output".equals(localName)) { cu.annotationPorocessing.sourceOutput = XMLUtil.findText(apEl); - } else if ("processor-path".equals(localName) && JavaProjectNature.NS_JAVA_3.equals(el.getNamespaceURI())) { //NOI18N + } else if ("processor-path".equals(localName)) { //NOI18N cu.annotationPorocessing.processorPath = XMLUtil.findText(apEl); - } else if ("processor".equals(localName) && JavaProjectNature.NS_JAVA_3.equals(el.getNamespaceURI())) { //NOI18N + } else if ("processor".equals(localName)) { //NOI18N cu.annotationPorocessing.processors.add(XMLUtil.findText(apEl)); - } else if ("processor-option".equals(localName) && JavaProjectNature.NS_JAVA_3.equals(el.getNamespaceURI())) { //NOI18N - final Element keyEl = XMLUtil.findElement(apEl, "key", JavaProjectNature.NS_JAVA_3); //NOI18N - final Element valueEl = XMLUtil.findElement(apEl, "value", JavaProjectNature.NS_JAVA_3); //NOI18N + } else if ("processor-option".equals(localName)) { //NOI18N + final Element keyEl = XMLUtil.findElement(apEl, "key", el.getNamespaceURI()); //NOI18N + final Element valueEl = XMLUtil.findElement(apEl, "value", el.getNamespaceURI()); //NOI18N if (keyEl != null && valueEl != null) { final String key = XMLUtil.findText(keyEl); final String value = XMLUtil.findText(valueEl); @@ -486,63 +483,30 @@ public static void putJavaCompilationUnits(AntProjectHelper helper, AuxiliaryConfiguration aux, List compUnits) { //assert ProjectManager.mutex().isWriteAccess(); - // First check if we need /3 data. - boolean need3 = false; + int requiredVersion = 1; + + // detect minimal required namespace: for (JavaCompilationUnit unit : compUnits) { - if (needsNS3(unit)) { - need3 = true; - break; + requiredVersion = Math.max(requiredVersion, minimalNS(unit)); + } + + String namespace; + + switch (requiredVersion) { + case 4: namespace = JavaProjectNature.NS_JAVA_4; break; + case 3: namespace = JavaProjectNature.NS_JAVA_3; break; + case 2: namespace = JavaProjectNature.NS_JAVA_2; break; + default: namespace = JavaProjectNature.NS_JAVA_1; break; + } + + Element data = getJavaCompilationUnits(aux); + + if (data == null || !JavaProjectNature.namespaceAtLeast(data.getNamespaceURI(), namespace)) { + if (data != null) { + aux.removeConfigurationFragment(JavaProjectNature.EL_JAVA, data.getNamespaceURI(), true); } - } - // Second check whether we need /2 data. - boolean need2 = false; - for (JavaCompilationUnit unit : compUnits) { - if (unit.isTests || (unit.javadoc != null && !unit.javadoc.isEmpty())) { - need2 = true; - break; - } - } - String namespace; - // Look for existing /3 data. - Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); - if (data != null) { - namespace = JavaProjectNature.NS_JAVA_3; - } - else { - // Look for existing /2 data and possibly update to /3 - data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_2, true); - if (data != null) { - namespace = need3 ? JavaProjectNature.NS_JAVA_3 : JavaProjectNature.NS_JAVA_2; - if (need3) { - // Have to upgrade to /3 - aux.removeConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_2, true); - data = Util.getPrimaryConfigurationData(helper).getOwnerDocument(). - createElementNS(JavaProjectNature.NS_JAVA_3, JavaProjectNature.EL_JAVA); - } - } else { - //Look for existing /1 and possibly update to /2 or /3 as needed - data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_1, true); - namespace = need3 ? JavaProjectNature.NS_JAVA_3 : need2 ? JavaProjectNature.NS_JAVA_2 : JavaProjectNature.NS_JAVA_1; - if (data != null) { - - if (need3) { - // Have to upgrade to /3 - aux.removeConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_1, true); - data = Util.getPrimaryConfigurationData(helper).getOwnerDocument(). - createElementNS(JavaProjectNature.NS_JAVA_3, JavaProjectNature.EL_JAVA); - } - else if (need2) { - // Have to upgrade to /2 - aux.removeConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_1, true); - data = Util.getPrimaryConfigurationData(helper).getOwnerDocument(). - createElementNS(JavaProjectNature.NS_JAVA_2, JavaProjectNature.EL_JAVA); - } // else can use it as is - } else { - // Create a new /1, /2 or /3 data acc. to need. - data = Util.getPrimaryConfigurationData(helper).getOwnerDocument(). - createElementNS(namespace, JavaProjectNature.EL_JAVA); - } - } + data = Util.getPrimaryConfigurationData(helper).getOwnerDocument(). + createElementNS(namespace, JavaProjectNature.EL_JAVA); } Document doc = data.getOwnerDocument(); for (Element cuEl : XMLUtil.findSubElements(data)) { @@ -560,7 +524,7 @@ } } if (cu.isTests) { - assert namespace.equals(JavaProjectNature.NS_JAVA_2) || namespace.equals(JavaProjectNature.NS_JAVA_3); + assert JavaProjectNature.namespaceAtLeast(namespace, JavaProjectNature.NS_JAVA_2); cuEl.appendChild(doc.createElementNS(namespace, "unit-tests")); // NOI18N } if (cu.classpath != null) { @@ -584,7 +548,7 @@ Iterator it3 = cu.javadoc.iterator(); while (it3.hasNext()) { String javadoc = (String) it3.next(); - assert namespace.equals(JavaProjectNature.NS_JAVA_2) || namespace.equals(JavaProjectNature.NS_JAVA_3); + assert JavaProjectNature.namespaceAtLeast(namespace, JavaProjectNature.NS_JAVA_2); el = doc.createElementNS(namespace, "javadoc-built-to"); // NOI18N el.appendChild(doc.createTextNode(javadoc)); cuEl.appendChild(el); @@ -1099,23 +1063,30 @@ props.setProperty(key, value); } - private static boolean needsNS3(final JavaCompilationUnit unit) { + private static int minimalNS(final JavaCompilationUnit unit) { + if (unit.isTests || (unit.javadoc != null && !unit.javadoc.isEmpty())) { + return 2; + } if (unit.classpath != null) { for (JavaCompilationUnit.CP cp : unit.classpath) { if ("processor".equals(cp.mode)) { //NOI18N - return true; + return 3; } } } if (unit.sourceLevel != null) { + final SpecificationVersion JAVA_8 = new SpecificationVersion("1.8"); //NOI18N + final SpecificationVersion current = new SpecificationVersion(unit.sourceLevel); + if (JAVA_8.compareTo(current) >= 0) { + return 4; + } final SpecificationVersion JAVA_6 = new SpecificationVersion("1.6"); //NOI18N final SpecificationVersion JAvA_7 = new SpecificationVersion("1.7"); //NOI18N - final SpecificationVersion current = new SpecificationVersion(unit.sourceLevel); if (JAVA_6.equals(current) || JAvA_7.equals(current)) { - return true; + return 3; } } - return false; + return 1; } - + } diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/JavaProjectNature.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/JavaProjectNature.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/JavaProjectNature.java Tue Apr 30 12:01:46 2013 +0200 @@ -72,6 +72,14 @@ public static final String NS_JAVA_1 = "http://www.netbeans.org/ns/freeform-project-java/1"; // NOI18N public static final String NS_JAVA_2 = "http://www.netbeans.org/ns/freeform-project-java/2"; // NOI18N public static final String NS_JAVA_3 = "http://www.netbeans.org/ns/freeform-project-java/3"; //NOI18N + public static final String NS_JAVA_4 = "http://www.netbeans.org/ns/freeform-project-java/4"; //NOI18N + public static final String NS_JAVA_LASTEST = NS_JAVA_4; + public static final String[] JAVA_NAMESPACES = { + NS_JAVA_4, + NS_JAVA_3, + NS_JAVA_2, + NS_JAVA_1 + }; public static final String EL_JAVA = "java-data"; // NOI18N public static final String STYLE_PACKAGES = "packages"; // NOI18N @@ -99,7 +107,13 @@ return PackageView.findPath(root, target); } - + public static boolean namespaceAtLeast(String nsToTest, String expected) { + for (String ns : JAVA_NAMESPACES) { + if (ns.equals(nsToTest)) return true; + if (ns.equals(expected)) return false; + } + return false;//??? + } private static class SourceGroupImpl implements SourceGroup { diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/JavadocQuery.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/JavadocQuery.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/JavadocQuery.java Tue Apr 30 12:01:46 2013 +0200 @@ -75,7 +75,7 @@ } public JavadocForBinaryQuery.Result findJavadoc(URL binaryRoot) { - Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (data != null) { for (Element cu : XMLUtil.findSubElements(data)) { assert cu.getLocalName().equals("compilation-unit") : cu; diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/LookupProviderImpl.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/LookupProviderImpl.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/LookupProviderImpl.java Tue Apr 30 12:01:46 2013 +0200 @@ -147,26 +147,19 @@ public Element getConfigurationFragment(String elementName, String namespace, boolean shared) { if (elementName.equals(JavaProjectNature.EL_JAVA) && shared) { Element nue = null; - if (namespace.equals(JavaProjectNature.NS_JAVA_3)) { - nue = delegate.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); - if (nue == null) { - Element old = delegate.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_2, true); - if (old != null) { - nue = upgradeSchema(old); - } else { - old = delegate.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_1, true); - if (old != null) { - nue = upgradeSchema(old); + for (int nsIndex = 0; nsIndex < JavaProjectNature.JAVA_NAMESPACES.length; nsIndex++) { + if (namespace.equals(JavaProjectNature.JAVA_NAMESPACES[nsIndex])) { + for (int nsLookup = nsIndex; nsLookup < JavaProjectNature.JAVA_NAMESPACES.length; nsLookup++) { + nue = delegate.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.JAVA_NAMESPACES[nsLookup], true); + if (nue != null) { + if (nsLookup != nsIndex) { + nue = upgradeSchema(nue, JavaProjectNature.JAVA_NAMESPACES[nsIndex]); + } + break; } } - } - } else if (namespace.equals(JavaProjectNature.NS_JAVA_2)) { - nue = delegate.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_2, true); - if (nue == null) { - Element old = delegate.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_1, true); - if (old != null) { - nue = upgradeSchema(old, JavaProjectNature.NS_JAVA_2); - } + + break; } } return nue; @@ -185,10 +178,6 @@ } - static Element upgradeSchema(Element old) { - return upgradeSchema(old, JavaProjectNature.NS_JAVA_3); - } - static Element upgradeSchema(final Element old, final String to) { Document doc = old.getOwnerDocument(); Element nue = doc.createElementNS(to, JavaProjectNature.EL_JAVA); diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/SourceForBinaryQueryImpl.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/SourceForBinaryQueryImpl.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/SourceForBinaryQueryImpl.java Tue Apr 30 12:01:46 2013 +0200 @@ -99,7 +99,7 @@ if (roots == null) { // Need to compute it. Easiest to compute them all at once. roots = new HashMap(); - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java == null) { return null; } diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/SourceLevelQueryImpl.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/SourceLevelQueryImpl.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/SourceLevelQueryImpl.java Tue Apr 30 12:01:46 2013 +0200 @@ -134,7 +134,7 @@ return Collections.unmodifiableMap(new HashMap(sourceLevels)); } } - Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element java = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (java != null) { for (Element compilationUnitEl : XMLUtil.findSubElements(java)) { assert compilationUnitEl.getLocalName().equals("compilation-unit") : compilationUnitEl; @@ -172,7 +172,7 @@ * Get the source level indicated in a compilation unit (or null if none is indicated). */ private String getLevel(Element compilationUnitEl) { - Element sourceLevelEl = XMLUtil.findElement(compilationUnitEl, "source-level", JavaProjectNature.NS_JAVA_3); + Element sourceLevelEl = XMLUtil.findElement(compilationUnitEl, "source-level", JavaProjectNature.NS_JAVA_LASTEST); if (sourceLevelEl != null) { return XMLUtil.findText(sourceLevelEl); } else { diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/TestQuery.java Tue Apr 30 12:01:46 2013 +0200 @@ -118,11 +118,11 @@ private URL[][] findSourcesAndTests() { List sources = new ArrayList(); List tests = new ArrayList(); - Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_3, true); + Element data = aux.getConfigurationFragment(JavaProjectNature.EL_JAVA, JavaProjectNature.NS_JAVA_LASTEST, true); if (data != null) { for (Element cu : XMLUtil.findSubElements(data)) { assert cu.getLocalName().equals("compilation-unit") : cu; - boolean isTests = XMLUtil.findElement(cu, "unit-tests", JavaProjectNature.NS_JAVA_3) != null; // NOI18N + boolean isTests = XMLUtil.findElement(cu, "unit-tests", JavaProjectNature.NS_JAVA_LASTEST) != null; // NOI18N for (Element pr : XMLUtil.findSubElements(cu)) { if (pr.getLocalName().equals("package-root")) { // NOI18N String rawtext = XMLUtil.findText(pr); diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/resources/freeform-project-java-4.xsd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/resources/freeform-project-java-4.xsd Tue Apr 30 12:01:46 2013 +0200 @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Annotation processing support + + + + + + + When this element exists the annotation processors are invoked during the scan + of the project and when a file is saved + + + + + + + + When this element exists the annotation processors are also invoked during + typing in the editor which may slow down editing. This element requires presence + of the scan-trigger element + + + + + + + + The folder to which annotation processors generate files + + + + + + + Explicit classpath holding the annotation processors. When available + this classpath is used to lookup the processors otherwise the compile + classpath is used + + + + + + + Explicit processor(s) to be invoked. If available these processor(s) + are executed otherwise the processors are looked up in META-INF/services + + + + + + + Processor specific options + + + + + + + + + + + + + + + + + + + + + + + Name of the option + + + + + + + Option value + + + + + + + + diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/resources/layer.xml --- a/java.freeform/src/org/netbeans/modules/java/freeform/resources/layer.xml Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/resources/layer.xml Tue Apr 30 12:01:46 2013 +0200 @@ -65,6 +65,7 @@ + diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/ui/Bundle.properties --- a/java.freeform/src/org/netbeans/modules/java/freeform/ui/Bundle.properties Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/ui/Bundle.properties Tue Apr 30 12:01:46 2013 +0200 @@ -80,6 +80,7 @@ LBL_SourceFoldersPanel_JDK15=JDK 1.5 LBL_SourceFoldersPanel_JDK16=JDK 1.6 LBL_SourceFoldersPanel_JDK17=JDK 1.7 +LBL_SourceFoldersPanel_JDK18=JDK 1.8 LBL_SourceFoldersPanel_Package=Package Folder LBL_SourceFoldersPanel_Label=Label BTN_SourceFoldersPanel_addTestFolder=Add F&older... diff -r 197ada535977 java.freeform/src/org/netbeans/modules/java/freeform/ui/SourceFoldersPanel.java --- a/java.freeform/src/org/netbeans/modules/java/freeform/ui/SourceFoldersPanel.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/src/org/netbeans/modules/java/freeform/ui/SourceFoldersPanel.java Tue Apr 30 12:01:46 2013 +0200 @@ -151,6 +151,7 @@ sourceLevel.addItem(NbBundle.getMessage(SourceFoldersPanel.class, "LBL_SourceFoldersPanel_JDK15")); // NOI18N sourceLevel.addItem(NbBundle.getMessage(SourceFoldersPanel.class, "LBL_SourceFoldersPanel_JDK16")); // NOI18N sourceLevel.addItem(NbBundle.getMessage(SourceFoldersPanel.class, "LBL_SourceFoldersPanel_JDK17")); // NOI18N + sourceLevel.addItem(NbBundle.getMessage(SourceFoldersPanel.class, "LBL_SourceFoldersPanel_JDK18")); // NOI18N } private void updateButtons() { @@ -185,6 +186,8 @@ sourceLevel.setSelectedIndex(3); } else if (sourceLevelValue.equals("1.7")) { // NOI18N sourceLevel.setSelectedIndex(4); + } else if (sourceLevelValue.equals("1.8")) { // NOI18N + sourceLevel.setSelectedIndex(5); }else { // user specified some other value in project.xml sourceLevel.addItem(sourceLevelValue); @@ -204,6 +207,7 @@ case 2: return "1.5"; // NOI18N case 3: return "1.6"; // NOI18N case 4: return "1.7"; // NOI18N + case 5: return "1.8"; // NOI18N default: return null; } } diff -r 197ada535977 java.freeform/test/unit/src/org/netbeans/modules/java/freeform/JavaProjectNatureTest.java --- a/java.freeform/test/unit/src/org/netbeans/modules/java/freeform/JavaProjectNatureTest.java Tue Apr 30 10:01:46 2013 +0200 +++ b/java.freeform/test/unit/src/org/netbeans/modules/java/freeform/JavaProjectNatureTest.java Tue Apr 30 12:01:46 2013 +0200 @@ -73,6 +73,18 @@ public void testUpgradeSchema1to3() throws Exception { upgradeSchemaTestImpl(JavaProjectNature.NS_JAVA_1, JavaProjectNature.NS_JAVA_3); } + + public void testUpgradeSchema1to4() throws Exception { + upgradeSchemaTestImpl(JavaProjectNature.NS_JAVA_1, JavaProjectNature.NS_JAVA_4); + } + + public void testUpgradeSchema2to4() throws Exception { + upgradeSchemaTestImpl(JavaProjectNature.NS_JAVA_2, JavaProjectNature.NS_JAVA_4); + } + + public void testUpgradeSchema3to4() throws Exception { + upgradeSchemaTestImpl(JavaProjectNature.NS_JAVA_3, JavaProjectNature.NS_JAVA_4); + } private void upgradeSchemaTestImpl(String from, String to) throws Exception { // Formatting has to be the same as Xerces' formatter produces for this test to pass: