--- projectapi/apichanges.xml +++ projectapi/apichanges.xml @@ -107,6 +107,30 @@ + + + + + + + + + +

+ Newly introduced interface DependencyProjectProvider is meant as less general replacement for SubprojectProvider + as it's explicitly declaring it's contract to be the project's dependency projects. Code using SubprojectProvider currently + should evaluate if DependencyProjectProvider contract suits their usage. Please note that DependencyProjectProvider is not + mandatory for project types to implement and if it's missing, SubprojectProvider should be used. +

+

+ Implementation note: In Maven based projects, SubprojectProvider no longer returns project dependendencies and only returns submodules for + projects with pom packaging. DependencyProjectProvider is now the one returning project dependencies as the list depends on currently opened project list. +

+
+ + +
+ New method createCompositeLookup(Lookup, Lookup) in LookupProviderSupport --- projectapi/manifest.mf +++ projectapi/manifest.mf @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.projectapi/1 -OpenIDE-Module-Specification-Version: 1.52 +OpenIDE-Module-Specification-Version: 1.53 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/projectapi/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/projectapi/layer.xml --- projectapi/src/org/netbeans/spi/project/DependencyProjectProvider.java +++ projectapi/src/org/netbeans/spi/project/DependencyProjectProvider.java @@ -0,0 +1,74 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 2013 Oracle and/or its affiliates. All rights reserved. + * + * Oracle and Java are registered trademarks of Oracle and/or its affiliates. + * Other names may be trademarks of their respective owners. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * 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 2013 Sun Microsystems, Inc. + */ + +package org.netbeans.spi.project; + +import java.util.Set; +import javax.swing.event.ChangeListener; +import org.netbeans.api.project.Project; + +/** + * This is a less vague variant of the SubprojectProvider for code + * that wants to access project's dependencies that are also projects. + * Unlike some java level API this doesn't distinguish between compile, runtime, test level dependencies. + * The implementation by project types is nonmandatory and if it's missing in the project's lookup, users should fallback to SubprojectProvider + * @see Project#getLookup + * @author mkleint + * @since 1.53 + */ +public interface DependencyProjectProvider { + + Set getDependencyProjects(); + + /** + * Add a listener to changes in the set of dependency projects. + * @param listener a listener to add + */ + void addChangeListener(ChangeListener listener); + + /** + * Remove a listener to changes in the set of dependency projects. + * @param listener a listener to remove + */ + void removeChangeListener(ChangeListener listener); + +} --- projectapi/src/org/netbeans/spi/project/SubprojectProvider.java +++ projectapi/src/org/netbeans/spi/project/SubprojectProvider.java @@ -54,6 +54,9 @@ * but typically subprojects would be "built" as part of this project or somehow * used in it as dependencies; or they may just be contained or agglomerated in * it somehow. + * Note:Since 1.53, there is a more specifically defined variant DependencyProjectProvider that if defined in project provides a list of + * projects the current project depends on. In some project types ( currently maven support) that is the preferred and supported way of getting project's dependency projects. + * The SubprojectProvider implementation is then used just to point to aggregator's module projects that are built together but have no direct dependencies on) * @see Project#getLookup * @see ReferenceHelper.createSubprojectProvider * @author Jesse Glick