diff -r fab8ea7d1591 bugtracking/nbproject/project.xml --- a/bugtracking/nbproject/project.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/bugtracking/nbproject/project.xml Tue Mar 31 16:47:09 2009 +0200 @@ -137,8 +137,13 @@ - 7.7 + 7.9 + + + org.netbeans.core.ide + + org.openide.text diff -r fab8ea7d1591 bugtracking/src/org/netbeans/modules/bugtracking/layer.xml --- a/bugtracking/src/org/netbeans/modules/bugtracking/layer.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/bugtracking/src/org/netbeans/modules/bugtracking/layer.xml Tue Mar 31 16:47:09 2009 +0200 @@ -49,16 +49,6 @@ - - - - - - - - - - diff -r fab8ea7d1591 bugtracking/src/org/netbeans/modules/bugtracking/ui/nodes/BugtrackingRootNode.java --- a/bugtracking/src/org/netbeans/modules/bugtracking/ui/nodes/BugtrackingRootNode.java Tue Mar 31 13:31:15 2009 +0200 +++ b/bugtracking/src/org/netbeans/modules/bugtracking/ui/nodes/BugtrackingRootNode.java Tue Mar 31 16:47:09 2009 +0200 @@ -51,6 +51,7 @@ import java.util.List; import javax.swing.AbstractAction; import javax.swing.Action; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; import org.netbeans.modules.bugtracking.BugtrackingManager; import org.netbeans.modules.bugtracking.spi.Repository; import org.netbeans.modules.bugtracking.util.BugtrackingUtil; @@ -89,6 +90,12 @@ * * @return default instance of BugtrackingRootNode */ + @ServiceTabNodeRegistration( + name="bugtracking", + displayName="org.netbeans.modules.bugtracking.ui.nodes.Bundle#LBL_BugtrackingNode", + iconResource="org/netbeans/modules/bugtracking/ui/resources/bugtracking.png", + position=588 + ) public static BugtrackingRootNode getDefault() { synchronized(LOCK_INIT) { if (defaultInstance == null) { diff -r fab8ea7d1591 core.ide/apichanges.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.ide/apichanges.xml Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,94 @@ + + + + + + + + Core IDE API + + + + + + Annotation to register Nodes into Services tab + + + + + +

+ Use + ServiceTabNodeRegistration to register your nodes + into Services in the IDE. +

+
+ +
+
+ + + + + + + Change History for the Core IDE API + + + + + + +

Introduction

+

This document lists changes made to the Core IDE API.

+ + +
+ +
+

@FOOTER@

+ + +
+ +
diff -r fab8ea7d1591 core.ide/arch.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.ide/arch.xml Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,1082 @@ + + +]> + + + + &api-questions; + + + + +

+ This module contains various generic IDE-like extensions. +

+
+ + + + + +

+ We have few unit tests. +

+
+ + + + + +

+ Module will be available for 6.7 version. +

+
+ + + + + +

+ + Use + ServiceTabNodeRegistration to register your nodes into Services in the IDE. + +

+
+ + + + + + + Right now this module provides handy + + ServiceTabNodeRegistration + accompanied with few UI elements. + + + + + + + + + + + + + + +

+ XXX no answer for compat-deprecation +

+
+ + + + + +

+ XXX no answer for compat-i18n +

+
+ + + + + +

+ XXX no answer for compat-standards +

+
+ + + + + +

+ XXX no answer for compat-version +

+
+ + + + + +

+ XXX no answer for dep-jre +

+
+ + + + + +

+ XXX no answer for dep-jrejdk +

+
+ + + + + + + + + + + + +

+ XXX no answer for dep-non-nb +

+
+ + + + + +

+ XXX no answer for dep-platform +

+
+ + + + + +

+ XXX no answer for deploy-dependencies +

+
+ + + + + +

+ XXX no answer for deploy-jar +

+
+ + + + + +

+ XXX no answer for deploy-nbm +

+
+ + + + + +

+ XXX no answer for deploy-packages +

+
+ + + + + +

+ XXX no answer for deploy-shared +

+
+ + + + + +

+ XXX no answer for exec-ant-tasks +

+
+ + + + + +

+ XXX no answer for exec-classloader +

+
+ + + + + +

+ XXX no answer for exec-component +

+
+ + + + + +

+ XXX no answer for exec-introspection +

+
+ + + + + +

+ XXX no answer for exec-privateaccess +

+
+ + + + + +

+ XXX no answer for exec-process +

+
+ + + + + +

+ XXX no answer for exec-property +

+
+ + + + + +

+ XXX no answer for exec-reflection +

+
+ + + + + +

+ XXX no answer for exec-threading +

+
+ + + + + +

+ XXX no answer for format-clipboard +

+
+ + + + + +

+ XXX no answer for format-dnd +

+
+ + + + + +

+ XXX no answer for format-types +

+
+ + + + + +

+ XXX no answer for lookup-lookup +

+
+ + + + + +

+ XXX no answer for lookup-register +

+
+ + + + + +

+ XXX no answer for lookup-remove +

+
+ + + + + +

+ XXX no answer for perf-exit +

+
+ + + + + +

+ XXX no answer for perf-huge_dialogs +

+
+ + + + + +

+ XXX no answer for perf-limit +

+
+ + + + + +

+ XXX no answer for perf-mem +

+
+ + + + + +

+ XXX no answer for perf-menus +

+
+ + + + + +

+ XXX no answer for perf-progress +

+
+ + + + + +

+ XXX no answer for perf-scale +

+
+ + + + + +

+ XXX no answer for perf-spi +

+
+ + + + + +

+ XXX no answer for perf-startup +

+
+ + + + + +

+ XXX no answer for perf-wakeup +

+
+ + + + + +

+ XXX no answer for resources-file +

+
+ + + + + +

+ XXX no answer for resources-layer +

+
+ + + + + +

+ XXX no answer for resources-mask +

+
+ + + + + +

+ XXX no answer for resources-preferences +

+
+ + + + + +

+ XXX no answer for resources-read +

+
+ + + + + +

+ XXX no answer for security-grant +

+
+ + + + + +

+ XXX no answer for security-policy +

+
+ +
diff -r fab8ea7d1591 core.ide/manifest.mf --- a/core.ide/manifest.mf Tue Mar 31 13:31:15 2009 +0200 +++ b/core.ide/manifest.mf Tue Mar 31 16:47:09 2009 +0200 @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.core.ide/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/core/ide/resources/Bundle.properties -OpenIDE-Module-Specification-Version: 1.13 +OpenIDE-Module-Specification-Version: 1.15 AutoUpdate-Show-In-Client: false OpenIDE-Module-Layer: org/netbeans/core/ide/resources/layer.xml diff -r fab8ea7d1591 core.ide/nbproject/project.properties --- a/core.ide/nbproject/project.properties Tue Mar 31 13:31:15 2009 +0200 +++ b/core.ide/nbproject/project.properties Tue Mar 31 16:47:09 2009 +0200 @@ -45,3 +45,6 @@ shortcuts.pdf javac.compilerargs=-Xlint -Xlint:-serial javac.source=1.5 +cp.extra=${nb_all}/apisupport.harness/external/openjdk-javac-6-b12.jar + +javadoc.arch=${basedir}/arch.xml diff -r fab8ea7d1591 core.ide/nbproject/project.xml --- a/core.ide/nbproject/project.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/core.ide/nbproject/project.xml Tue Mar 31 16:47:09 2009 +0200 @@ -61,6 +61,14 @@
+ org.openide.filesystems + + + + 7.21 + + + org.openide.nodes @@ -85,7 +93,9 @@ - + + org.netbeans.api.core.ide + diff -r fab8ea7d1591 core.ide/src/org/netbeans/api/core/ide/ServiceTabNodeRegistration.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.ide/src/org/netbeans/api/core/ide/ServiceTabNodeRegistration.java Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,86 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 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 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.api.core.ide; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Node; + +/** Annotation applicable to any class that extends {@link Node} or + * static method that returns {@link Node}. Its presence means that + * the node shall appear in the Services tab. + * + * @author Jaroslav Tulach + */ +@Retention(RetentionPolicy.SOURCE) +@Target({ ElementType.METHOD, ElementType.TYPE }) +public @interface ServiceTabNodeRegistration { + /** @return programatic name of the node */ + String name(); + /** Human readable name. Use #KEY to reference a key in + * Bundle.properties file next to the node class + * or factory method. + * + * @return human readable name or reference to bundle + */ + String displayName(); + + /** Description of the node. Use #KEY to reference a key in + * Bundle.properties file next to the node class + * or factory method. + * + * @return human readable short description or readable to bundle + */ + String shortDescription() default ""; + + /** Icon to use for the node. The icon can have additional variants + * see {@link AbstractNode#setIconBaseWithExtension(java.lang.String)} + * for more info. + * + */ + String iconResource(); + + /** Ordering location of the {@link Node}. + */ + int position() default Integer.MAX_VALUE; +} diff -r fab8ea7d1591 core.ide/src/org/netbeans/core/ide/ServiceTabProcessor.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.ide/src/org/netbeans/core/ide/ServiceTabProcessor.java Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,95 @@ +/* + * 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.core.ide; + +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.ElementKind; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.Modifier; +import javax.lang.model.element.TypeElement; +import javax.lang.model.type.TypeMirror; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; +import org.omg.PortableServer.POA; +import org.openide.filesystems.annotations.LayerBuilder.File; +import org.openide.filesystems.annotations.LayerGeneratingProcessor; +import org.openide.filesystems.annotations.LayerGenerationException; +import org.openide.nodes.Node; +import org.openide.util.lookup.ServiceProvider; + +/** + * processor for {@link ServiceTabNodeRegistration} annotation. + * @author Jaroslav Tulach + */ +@ServiceProvider(service=Processor.class) +@SupportedSourceVersion(SourceVersion.RELEASE_6) +@SupportedAnnotationTypes("org.netbeans.api.core.ide.ServiceTabNodeRegistration")//NOI18N +public class ServiceTabProcessor extends LayerGeneratingProcessor { + @Override + protected boolean handleProcess(Set annotations, RoundEnvironment roundEnv) throws LayerGenerationException { + if (roundEnv.processingOver()) { + return false; + } + for (Element e : roundEnv.getElementsAnnotatedWith(ServiceTabNodeRegistration.class)) { + ServiceTabNodeRegistration reg = e.getAnnotation(ServiceTabNodeRegistration.class); + File f = layer(e). + instanceFile("UI/Runtime", null, Node.class). + stringvalue("iconResource", reg.iconResource()). + stringvalue("name", reg.name()). + methodvalue("instanceCreate", "org.openide.nodes.NodeOp", "factory"). + bundlevalue("displayName", reg.displayName()). + instanceAttribute("original", Node.class); + if (!"".equals(reg.shortDescription())) { + f.bundlevalue("shortDescription", reg.shortDescription()); + } + if (reg.position() != Integer.MAX_VALUE) { + f.intvalue("position", reg.position()); + } + f.write(); + } + return true; + } + +} diff -r fab8ea7d1591 core.ide/test/unit/src/org/netbeans/core/ide/ServiceTabProcessorTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.ide/test/unit/src/org/netbeans/core/ide/ServiceTabProcessorTest.java Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,117 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 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 2009 Sun Microsystems, Inc. + */ + +package org.netbeans.core.ide; + +import java.awt.Image; +import java.beans.BeanInfo; +import java.util.Collection; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; +import org.openide.nodes.AbstractNode; +import org.openide.nodes.Children; +import org.openide.nodes.Node; +import org.openide.util.ImageUtilities; +import org.openide.util.lookup.Lookups; +import static org.junit.Assert.*; + +/** + * + * @author Jaroslav Tulach + */ +public class ServiceTabProcessorTest { + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void testNodesGeneratedCorrectly() throws Exception { + Collection arr = Lookups.forPath("UI/Runtime").lookupAll(Node.class); + assertEquals("One node is there: " + arr, 1, arr.size()); + Node n = arr.iterator().next(); + + assertEquals("my1", n.getName()); + assertEquals("disp1", n.getDisplayName()); + assertEquals("By default short description delegates to displayName", n.getDisplayName(), n.getShortDescription()); + + Image img1 = ImageUtilities.loadImage("org/netbeans/core/ide/TestIcon1.png"); + Image img2 = ImageUtilities.loadImage("org/netbeans/core/ide/TestIcon2.png"); + + assertSame("icon1 is in use", img1, n.getIcon(BeanInfo.ICON_COLOR_16x16)); + + Node[] subNodes = n.getChildren().getNodes(true); + assertEquals("Two subnodes", 2, subNodes.length); + + // now everything is initialized + + assertEquals("my2", n.getName()); + assertEquals("disp2", n.getDisplayName()); + assertEquals("short2", n.getShortDescription()); + assertSame("icon2 is in use", img2, n.getIcon(BeanInfo.ICON_COLOR_16x16)); + + } + + @ServiceTabNodeRegistration( + name="my1", displayName="org.netbeans.core.ide.TestBundle#NAME", position=10, + iconResource="org/netbeans/core/ide/TestIcon1.png" + ) + public static class MyNode extends AbstractNode { + public MyNode() { + this(true); + } + private MyNode(boolean addChildren) { + super(new Children.Array()); + setName("my2"); + setDisplayName("disp2"); + setShortDescription("short2"); + setIconBaseWithExtension("org/netbeans/core/ide/TestIcon2.png"); + + if (addChildren) { + getChildren().add(new Node[] { new MyNode(false), new MyNode(false) }); + } + } + } +} \ No newline at end of file diff -r fab8ea7d1591 core.ide/test/unit/src/org/netbeans/core/ide/TestBundle.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core.ide/test/unit/src/org/netbeans/core/ide/TestBundle.properties Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,39 @@ +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. +# +# Copyright 2009 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 2009 Sun Microsystems, Inc. + + +NAME=disp1 diff -r fab8ea7d1591 core.ide/test/unit/src/org/netbeans/core/ide/TestIcon1.png Binary file core.ide/test/unit/src/org/netbeans/core/ide/TestIcon1.png has changed diff -r fab8ea7d1591 core.ide/test/unit/src/org/netbeans/core/ide/TestIcon2.png Binary file core.ide/test/unit/src/org/netbeans/core/ide/TestIcon2.png has changed diff -r fab8ea7d1591 db/nbproject/project.xml --- a/db/nbproject/project.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/db/nbproject/project.xml Tue Mar 31 16:47:09 2009 +0200 @@ -151,8 +151,13 @@ - 6.2 + 7.9 + + + org.netbeans.core.ide + + org.openide.util diff -r fab8ea7d1591 db/src/org/netbeans/modules/db/explorer/node/RootNode.java --- a/db/src/org/netbeans/modules/db/explorer/node/RootNode.java Tue Mar 31 13:31:15 2009 +0200 +++ b/db/src/org/netbeans/modules/db/explorer/node/RootNode.java Tue Mar 31 16:47:09 2009 +0200 @@ -41,6 +41,7 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; import org.netbeans.api.db.explorer.node.BaseNode; import org.netbeans.api.db.explorer.node.ChildNodeFactory; import org.netbeans.lib.ddl.impl.SpecificationFactory; @@ -69,9 +70,15 @@ /** * Gets the singleton instance. - * + * * @return the singleton instance */ + @ServiceTabNodeRegistration( + name="Databases", + displayName="org/netbeans/modules/db/resources/Bundle#RootNode_DISPLAYNAME", + iconResource="org/netbeans/modules/db/resources/database.gif", + position=101 + ) public static RootNode instance() { if (instance == null) { NodeDataLookup lookup = new NodeDataLookup(); diff -r fab8ea7d1591 db/src/org/netbeans/modules/db/resources/mf-layer.xml --- a/db/src/org/netbeans/modules/db/resources/mf-layer.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/db/src/org/netbeans/modules/db/resources/mf-layer.xml Tue Mar 31 16:47:09 2009 +0200 @@ -550,27 +550,6 @@ - - - - - - - - - - - - - - - diff -r fab8ea7d1591 hudson/nbproject/project.xml --- a/hudson/nbproject/project.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/hudson/nbproject/project.xml Tue Mar 31 16:47:09 2009 +0200 @@ -120,8 +120,13 @@ - 7.1 + 7.9 + + + org.netbeans.core.ide + + org.openide.text diff -r fab8ea7d1591 hudson/src/org/netbeans/modules/hudson/layer.xml --- a/hudson/src/org/netbeans/modules/hudson/layer.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/hudson/src/org/netbeans/modules/hudson/layer.xml Tue Mar 31 16:47:09 2009 +0200 @@ -19,13 +19,4 @@ - - - - - - - - - diff -r fab8ea7d1591 hudson/src/org/netbeans/modules/hudson/ui/nodes/HudsonRootNode.java --- a/hudson/src/org/netbeans/modules/hudson/ui/nodes/HudsonRootNode.java Tue Mar 31 13:31:15 2009 +0200 +++ b/hudson/src/org/netbeans/modules/hudson/ui/nodes/HudsonRootNode.java Tue Mar 31 16:47:09 2009 +0200 @@ -45,6 +45,7 @@ import java.util.Collections; import java.util.List; import javax.swing.Action; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; import org.netbeans.modules.hudson.api.HudsonChangeListener; import org.netbeans.modules.hudson.impl.HudsonInstanceImpl; import org.netbeans.modules.hudson.impl.HudsonManagerImpl; @@ -84,6 +85,12 @@ * * @return default instance of HudsonRootNode */ + @ServiceTabNodeRegistration( + name="hudson", + displayName="org.netbeans.modules.hudson.ui.nodes.Bundle#LBL_HudsonNode", + iconResource="org/netbeans/modules/hudson/ui/resources/hudson.png", + position=488 + ) public static HudsonRootNode getDefault() { synchronized(LOCK_INIT) { if (null == defaultInstance) diff -r fab8ea7d1591 nbbuild/build.properties --- a/nbbuild/build.properties Tue Mar 31 13:31:15 2009 +0200 +++ b/nbbuild/build.properties Tue Mar 31 16:47:09 2009 +0200 @@ -160,6 +160,7 @@ config.javadoc.stable=\ api.annotations.common,\ autoupdate.services,\ + core.ide,\ openide.util,\ openide.actions,\ openide.awt,\ diff -r fab8ea7d1591 nbbuild/hudson/core-main --- a/nbbuild/hudson/core-main Tue Mar 31 13:31:15 2009 +0200 +++ b/nbbuild/hudson/core-main Tue Mar 31 16:47:09 2009 +0200 @@ -20,6 +20,7 @@ testmodule autoupdate.services testmodule autoupdate.ui testmodule core.execution + testmodule core.ide testmodule core.kit testmodule core.multiview testmodule core.output2 diff -r fab8ea7d1591 nbbuild/javadoctools/links.xml --- a/nbbuild/javadoctools/links.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/nbbuild/javadoctools/links.xml Tue Mar 31 16:47:09 2009 +0200 @@ -183,3 +183,4 @@ + diff -r fab8ea7d1591 nbbuild/javadoctools/properties.xml --- a/nbbuild/javadoctools/properties.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/nbbuild/javadoctools/properties.xml Tue Mar 31 16:47:09 2009 +0200 @@ -181,3 +181,4 @@ + diff -r fab8ea7d1591 nbbuild/javadoctools/replaces.xml --- a/nbbuild/javadoctools/replaces.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/nbbuild/javadoctools/replaces.xml Tue Mar 31 16:47:09 2009 +0200 @@ -181,3 +181,4 @@ + diff -r fab8ea7d1591 openide.nodes/apichanges.xml --- a/openide.nodes/apichanges.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/openide.nodes/apichanges.xml Tue Mar 31 16:47:09 2009 +0200 @@ -46,6 +46,24 @@ Nodes API + + + Support for declarative Node registrations + + + + + +

+ NodeOp.factory + is new method, particularly useful from + layers + that allows declarative definition of a root node. +

+
+ + +
Adding ChildFactory.Detachable to allow ChildFactory implementations to diff -r fab8ea7d1591 openide.nodes/nbproject/project.properties --- a/openide.nodes/nbproject/project.properties Tue Mar 31 13:31:15 2009 +0200 +++ b/openide.nodes/nbproject/project.properties Tue Mar 31 16:47:09 2009 +0200 @@ -44,4 +44,4 @@ javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml -spec.version.base=7.8.0 +spec.version.base=7.9.0 diff -r fab8ea7d1591 openide.nodes/src/org/openide/nodes/LazyNode.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openide.nodes/src/org/openide/nodes/LazyNode.java Tue Mar 31 16:47:09 2009 +0200 @@ -0,0 +1,103 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 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 2009 Sun Microsystems, Inc. + */ + +package org.openide.nodes; + +import java.util.List; +import java.util.Map; +import javax.swing.Action; + +/** Lazy delegating node. + * + * @author Jaroslav Tulach + */ +final class LazyNode extends FilterNode { + private Map map; + + LazyNode(Map map) { + this(new ChFactory(), map); + } + private LazyNode(ChFactory factory, Map map) { + super(new AbstractNode(Children.create(factory, true))); + factory.node = this; + this.map = map; + + AbstractNode an = (AbstractNode)getOriginal(); + + an.setName((String) map.get("name")); // NOI18N + an.setDisplayName((String) map.get("displayName")); // NOI18N + an.setShortDescription((String) map.get("shortDescription")); // NOI18N + an.setIconBaseWithExtension((String)map.get("iconResource")); // NOI18N + } + + @Override + public Action[] getActions(boolean context) { + switchToOriginal(); + return super.getActions(context); + } + + + final void switchToOriginal() { + Node n; + synchronized (this) { + if (map == null) { + return; + } + n = (Node)map.get("original"); // NOI18N + map = null; + } + changeOriginal(n, true); + } + + private static final class ChFactory extends ChildFactory { + LazyNode node; + + @Override + protected boolean createKeys(List toPopulate) { + LazyNode n = node; + node = null; + if (n != null) { + n.switchToOriginal(); + return true; + } else { + return false; + } + } + } +} diff -r fab8ea7d1591 openide.nodes/src/org/openide/nodes/NodeOp.java --- a/openide.nodes/src/org/openide/nodes/NodeOp.java Tue Mar 31 13:31:15 2009 +0200 +++ b/openide.nodes/src/org/openide/nodes/NodeOp.java Tue Mar 31 16:47:10 2009 +0200 @@ -442,6 +442,58 @@ return WeakListeners.create(NodeListener.class, l, source); } + /** Creates a lazy node - a node that displays basic information + * about the original node behind it, without touching it. As soon as + * the node is expanded, or a pop up menu is invoked on it, it switches + * to the real delegates and since then everything is being bridged to + * the real node. + *

+ * This method is especially useful when used from + * layers. + * Use following + * XML snippet to register your node into Services tab: + *

+     * <folder name="UI">
+     *   <folder name="Runtime">
+     *     <file name="org-yourorg-yourpgk-YourNode.instance">
+     *       <attr name="instanceCreate" methodvalue="org.openide.nodes.NodeOp.factory"/>
+     *       <attr name="name" stringvalue="YourNode"/>
+     *       <attr name="displayName" bundlevalue="org.yourorg.yourpkg.Bundle#NAME-KEY"/>
+     *       <attr name="shortDescription" bundlevalue="org.yourorg.yourpkg.Bundle#SHORT-KEY"/>
+     *       <attr name="iconResource" stringvalue="org/yourorg/yourpkg/image.png"/>
+     *       <attr name="original" newvalue="org.yourorg.yourpkg.YourNode"/>
+     *     <file/>
+     *   <folder/>
+     * <folder/>
+     * 
+ * + * @param original the real node behind the one created + * @param name programatic name of the node + * @param displayName human readable name of the node + * @param shortDescription short description for the node + * @param iconResource path to icon to use as in {@link AbstractNode#setIconBaseWithExtension(java.lang.String)} + * @return new node with preset defaults that can delegate to original + * + * @since 7.9 + */ + public static Node factory( + Node original, + String name, String displayName, String shortDescription, + String iconResource + ) { + Map map = new HashMap(); + map.put("original", original); // NOI18N + map.put("name", name); // NOI18N + map.put("displayName", displayName); // NOI18N + map.put("shortDescription", shortDescription); // NOI18N + map.put("iconResource", iconResource); // NOI18N + return new LazyNode(map); + } + + static Node factory(Map map) { + return new LazyNode(map); + } + /** Utility method to remove dependency of this package on * org.openide.actions. This method takes names of classes from * that package and creates their instances. diff -r fab8ea7d1591 openide.nodes/test/unit/src/org/openide/nodes/LazyNodeTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/openide.nodes/test/unit/src/org/openide/nodes/LazyNodeTest.java Tue Mar 31 16:47:10 2009 +0200 @@ -0,0 +1,186 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2009 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 2009 Sun Microsystems, Inc. + */ + +package org.openide.nodes; + +import java.util.HashMap; +import javax.swing.Action; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openide.util.HelpCtx; +import org.openide.util.actions.CallbackSystemAction; +import org.openide.util.actions.SystemAction; +import static org.junit.Assert.*; + +/** + * + * @author Jaroslav Tulach + */ +public class LazyNodeTest { + + public LazyNodeTest() { + } + + @BeforeClass + public static void setUpClass() throws Exception { + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + @Test + public void testCreateOriginalAfterNodeExpansion() { + doCreateOriginal(true); + } + + @Test + public void testCreateOriginalAfterGetActions() { + doCreateOriginal(false); + } + + private void doCreateOriginal(boolean askForChildren) { + AbstractNode realNode = new AbstractNode(new Children.Array()) { + @Override + public Action[] getActions(boolean context) { + return getActions(); + } + + @SuppressWarnings("deprecation") + @Override + public SystemAction[] getActions() { + return new SystemAction[] { + A1.get(A1.class), + A2.get(A2.class), + A3.get(A3.class) + }; + } + }; + realNode.setName("RealNode"); + realNode.setDisplayName("Real Node"); + realNode.setShortDescription("Real Node for Test"); + realNode.getChildren().add(new Node[] { + new AbstractNode(Children.LEAF), + new AbstractNode(Children.LEAF), + new AbstractNode(Children.LEAF), + }); + + CntHashMap chm = new CntHashMap("original"); + chm.put("name", "ANode"); + chm.put("displayName", "A Node"); + chm.put("shortDescription", "A Node for Test"); + chm.put("iconResource", "org/openide/nodes/beans.gif"); + chm.put("original", realNode); + + Node instance = NodeOp.factory(chm); + assertEquals("ANode", instance.getName()); + assertEquals("A Node", instance.getDisplayName()); + assertEquals("A Node for Test", instance.getShortDescription()); + assertEquals("No real node queried yet", 0, chm.cnt); + + if (askForChildren) { + Node[] arr = instance.getChildren().getNodes(true); + assertEquals("Three children", 3, arr.length); + } else { + Action[] arr = instance.getActions(true); + assertEquals("Three actions", 3, arr.length); + } + + assertEquals("Real node queried now", 1, chm.cnt); + + assertEquals("RealNode", instance.getName()); + assertEquals("Real Node", instance.getDisplayName()); + assertEquals("Real Node for Test", instance.getShortDescription()); + } + + private static class CntHashMap extends HashMap { + private final Object keyToWatch; + int cnt; + + public CntHashMap(Object keyToWatch) { + this.keyToWatch = keyToWatch; + } + + @Override + public Object get(Object key) { + if (keyToWatch.equals(key)) { + cnt++; + } + return super.get(key); + } + + + } + + public static class A1 extends CallbackSystemAction { + @Override + public String getName() { + return "A1"; + } + + @Override + public HelpCtx getHelpCtx() { + throw new UnsupportedOperationException("Not supported yet."); + } + + } + public static final class A2 extends A1 { + @Override + public String getName() { + return "A2"; + } + } + public static final class A3 extends A1 { + @Override + public String getName() { + return "A3"; + } + } +} \ No newline at end of file diff -r fab8ea7d1591 server/nbproject/project.xml --- a/server/nbproject/project.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/server/nbproject/project.xml Tue Mar 31 16:47:10 2009 +0200 @@ -100,8 +100,13 @@ - 7.3 + 7.9 + + + org.netbeans.core.ide + + org.openide.util diff -r fab8ea7d1591 server/src/org/netbeans/modules/server/resources/layer.xml --- a/server/src/org/netbeans/modules/server/resources/layer.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/server/src/org/netbeans/modules/server/resources/layer.xml Tue Mar 31 16:47:10 2009 +0200 @@ -43,16 +43,6 @@ --> - - - - - - - - - - diff -r fab8ea7d1591 server/src/org/netbeans/modules/server/ui/node/RootNode.java --- a/server/src/org/netbeans/modules/server/ui/node/RootNode.java Tue Mar 31 13:31:15 2009 +0200 +++ b/server/src/org/netbeans/modules/server/ui/node/RootNode.java Tue Mar 31 16:47:10 2009 +0200 @@ -49,6 +49,7 @@ import javax.swing.Action; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; import org.netbeans.api.server.ServerInstance; import org.netbeans.modules.server.ServerRegistry; import org.netbeans.spi.server.ServerInstanceProvider; @@ -75,6 +76,13 @@ setIconBaseWithExtension(SERVERS_ICON); } + @ServiceTabNodeRegistration( + name = "servers", + displayName = "org.netbeans.modules.server.ui.node.Bundle#Server_Registry_Node_Name", + shortDescription = "org.netbeans.modules.server.ui.node.Bundle#Server_Registry_Node_Short_Description", + iconResource = "org/netbeans/modules/server/ui/resources/servers.png", + position = 400 + ) public static synchronized RootNode getInstance() { if (node == null) { ChildFactory factory = new ChildFactory(); diff -r fab8ea7d1591 websvc.saas.ui/manifest.mf --- a/websvc.saas.ui/manifest.mf Tue Mar 31 13:31:15 2009 +0200 +++ b/websvc.saas.ui/manifest.mf Tue Mar 31 16:47:10 2009 +0200 @@ -1,6 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.websvc.saas.ui -OpenIDE-Module-Layer: org/netbeans/modules/websvc/saas/ui/layer.xml OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/websvc/saas/ui/Bundle.properties OpenIDE-Module-Specification-Version: 1.2 AutoUpdate-Show-In-Client: false diff -r fab8ea7d1591 websvc.saas.ui/nbproject/project.xml --- a/websvc.saas.ui/nbproject/project.xml Tue Mar 31 13:31:15 2009 +0200 +++ b/websvc.saas.ui/nbproject/project.xml Tue Mar 31 16:47:10 2009 +0200 @@ -30,6 +30,15 @@ 1 1.6 + + + + org.netbeans.modules.websvc.jaxwsmodelapi + + + + 1 + 1.0 @@ -103,8 +112,13 @@ - 7.3 + 7.9 + + + org.netbeans.core.ide + + org.openide.text diff -r fab8ea7d1591 websvc.saas.ui/src/org/netbeans/modules/websvc/saas/ui/layer.xml --- a/websvc.saas.ui/src/org/netbeans/modules/websvc/saas/ui/layer.xml Tue Mar 31 13:31:15 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ - - - - - - - - - - - - - diff -r fab8ea7d1591 websvc.saas.ui/src/org/netbeans/modules/websvc/saas/ui/nodes/SaasServicesRootNode.java --- a/websvc.saas.ui/src/org/netbeans/modules/websvc/saas/ui/nodes/SaasServicesRootNode.java Tue Mar 31 13:31:15 2009 +0200 +++ b/websvc.saas.ui/src/org/netbeans/modules/websvc/saas/ui/nodes/SaasServicesRootNode.java Tue Mar 31 16:47:10 2009 +0200 @@ -43,6 +43,7 @@ import java.beans.PropertyChangeEvent; import java.util.List; import javax.swing.Action; +import org.netbeans.api.core.ide.ServiceTabNodeRegistration; import org.netbeans.modules.websvc.saas.model.SaasGroup; import org.netbeans.modules.websvc.saas.model.SaasServicesModel; import org.netbeans.modules.websvc.saas.ui.actions.AddGroupAction; @@ -60,6 +61,13 @@ * * @author nam */ +@ServiceTabNodeRegistration( + position=210, + name="rootSaasGroup", + displayName="org.netbeans.modules.websvc.saas.ui.nodes.Bundle#Web_Services", + shortDescription="org.netbeans.modules.websvc.saas.ui.nodes.Bundle#Web_Services_Desc", + iconResource="org/netbeans/modules/websvc/saas/ui/resources/webservicegroup.png" +) public class SaasServicesRootNode extends AbstractNode { public SaasServicesRootNode() {