--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/LibrariesNodeFactory.java
+++ a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/LibrariesNodeFactory.java
@@ -61,6 +61,7 @@
import org.netbeans.spi.project.support.ant.ReferenceHelper;
import org.netbeans.spi.project.ui.support.NodeFactory;
import org.netbeans.spi.project.ui.support.NodeList;
+import org.netbeans.spi.project.ui.support.RegisteredNodeFactory;
import org.openide.nodes.Node;
import org.openide.util.ChangeSupport;
import org.openide.util.NbBundle;
@@ -70,9 +71,13 @@
* @author mkleint
*/
public final class LibrariesNodeFactory implements NodeFactory {
+
+@RegisteredNodeFactory(projectType="org-netbeans-modules-java-j2seproject", position=300)
+ static NodeFactory factory() {
+ return new LibrariesNodeFactory(42);
+ }
- /** Creates a new instance of LibrariesNodeFactory */
- public LibrariesNodeFactory() {
+ LibrariesNodeFactory(int whatever) {
}
public NodeList createNodes(Project p) {
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/SourceNodeFactory.java
+++ a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/SourceNodeFactory.java
@@ -60,6 +60,7 @@
import org.netbeans.spi.java.project.support.ui.PackageView;
import org.netbeans.spi.project.ui.support.NodeFactory;
import org.netbeans.spi.project.ui.support.NodeList;
+import org.netbeans.spi.project.ui.support.RegisteredNodeFactory;
import org.openide.filesystems.FileObject;
import org.openide.nodes.FilterNode;
import org.openide.nodes.Node;
@@ -70,6 +71,7 @@
*
* @author mkleint
*/
+@RegisteredNodeFactory(projectType="org-netbeans-modules-java-j2seproject", position=200)
public final class SourceNodeFactory implements NodeFactory {
public SourceNodeFactory() {
}
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/resources/layer.xml
+++ a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/ui/resources/layer.xml
@@ -131,15 +131,6 @@
-
-
-
-
-
-
-
-
-
--- a/projectuiapi/nbproject/project.properties
+++ a/projectuiapi/nbproject/project.properties
@@ -43,4 +43,4 @@
is.autoload=true
javadoc.arch=${basedir}/arch.xml
javadoc.apichanges=${basedir}/apichanges.xml
-
+cp.extra=${nb_all}/libs.javacapi/external/javac-api-nb-7.0-b07.jar
--- a/projectuiapi/src/org/netbeans/modules/project/uiapi/RegisteredNodeFactoryProcessor.java
+++ a/projectuiapi/src/org/netbeans/modules/project/uiapi/RegisteredNodeFactoryProcessor.java
@@ -0,0 +1,80 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008 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.project.uiapi;
+
+import java.util.Set;
+import javax.annotation.processing.Processor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import org.netbeans.spi.project.ui.support.NodeFactory;
+import org.netbeans.spi.project.ui.support.RegisteredNodeFactory;
+import org.openide.filesystems.annotations.LayerBuilder;
+import org.openide.filesystems.annotations.LayerGeneratingProcessor;
+import org.openide.util.lookup.Service;
+
+@Service(Processor.class)
+@SupportedSourceVersion(SourceVersion.RELEASE_6)
+@SupportedAnnotationTypes("org.netbeans.spi.project.ui.support.RegisteredNodeFactory")
+public class RegisteredNodeFactoryProcessor extends LayerGeneratingProcessor {
+
+ @Override
+ protected boolean doProcess(Set extends TypeElement> annotations, RoundEnvironment roundEnv) {
+ if (roundEnv.processingOver()) {
+ return false;
+ }
+ for (Element e : roundEnv.getElementsAnnotatedWith(RegisteredNodeFactory.class)) {
+ RegisteredNodeFactory rnf = e.getAnnotation(RegisteredNodeFactory.class);
+ try {
+ instanceFile(new LayerBuilder(layer(e)), e, "Projects/" + rnf.projectType() + "/Nodes", null, NodeFactory.class).
+ position(rnf.position()).write();
+ } catch (IllegalArgumentException x) {
+ processingEnv.getMessager().printMessage(Kind.ERROR, x.getLocalizedMessage());
+ continue;
+ }
+ }
+ return true;
+ }
+
+}
--- a/projectuiapi/src/org/netbeans/spi/project/ui/support/RegisteredNodeFactory.java
+++ a/projectuiapi/src/org/netbeans/spi/project/ui/support/RegisteredNodeFactory.java
@@ -0,0 +1,57 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008 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.spi.project.ui.support;
+
+/**
+ * Annotation to register a {@link NodeFactory} among a project type's nodes.
+ */
+public @interface RegisteredNodeFactory {
+
+ /**
+ * Project type identifier, e.g. {@code "org-netbeans-modules-java-j2seproject"}
+ */
+ String projectType();
+
+ /**
+ * Optional position to order this factory.
+ */
+ int position() default Integer.MAX_VALUE;
+
+}