1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.api.project; 21 22 import org.openide.filesystems.FileObject; 23 import org.openide.util.Lookup; 24 25 /** 26 * Represents one IDE project in memory. 27 * <p> 28 * <strong>Never cast a project instance</strong> to any subtype. 29 * (Nor call {@link Object#getClass} on the <code>Project</code> instance.) 30 * The project 31 * manager is free to wrap any project in an unspecified proxy for its own 32 * purposes. For extensibility, use {@link #getLookup}. 33 * </p> 34 * <div class="nonnormative"> 35 * <p>Note that this API is primarily of interest to project type provider 36 * modules, and to infrastructure and generic GUI. Most other modules providing 37 * tools or services should <em>not</em> need to explicitly model projects, and 38 * should not be using this API much or at all.</p> 39 * </div> 40 * @see <a HREF="http://projects.netbeans.org/buildsys/howto.html">NetBeans 4.0 Project & Build System How-To</a> 41 * @author Jesse Glick 42 */ 43 public interface Project extends Lookup.Provider { 44 45 /** 46 * Gets an associated directory where the project metadata and possibly sources live. 47 * In the case of a typical Ant project, this is the top directory, not the 48 * project metadata subdirectory. 49 * @return a directory 50 */ 51 FileObject getProjectDirectory(); 52 53 /** 54 * Get any optional abilities of this project. 55 * <div class="nonnormative"> 56 * <p>If you are <em>providing</em> a project, there are a number of interfaces 57 * which you should consider implementing and including in lookup, some of which 58 * are described below. If you are <em>using</em> a project from another module, 59 * there are some cases where you will want to ask a project for a particular 60 * object in lookup (e.g. <code>ExtensibleMetadataProvider</code>) but in most 61 * cases you should not; in the case of queries, always call the static query 62 * API helper method, rather than looking for the query implementation objects 63 * yourself. <strong>In the case of <code>ProjectInformation</code> and <code>Sources</code>, 64 * use {@link ProjectUtils} rather than directly searching the project lookup.</strong> 65 * </p> 66 * <p>The following abilities are recommended:</p> 67 * <ol> 68 * <li>{@link org.netbeans.api.project.ProjectInformation}</li> 69 * <li><a HREF="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/LogicalViewProvider.html"><code>LogicalViewProvider</code></a></li> 70 * <li><a HREF="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/CustomizerProvider.html"><code>CustomizerProvider</code></a></li> 71 * <li>{@link org.netbeans.api.project.Sources}</li> 72 * <li>{@link org.netbeans.spi.project.ActionProvider}</li> 73 * <li>{@link org.netbeans.spi.project.SubprojectProvider}</li> 74 * <li>{@link org.netbeans.spi.project.AuxiliaryConfiguration}</li> 75 * <li>{@link org.netbeans.spi.project.CacheDirectoryProvider}</li> 76 * </ol> 77 * <p>You might also have e.g.:</p> 78 * <ol> 79 * <li>{@link org.netbeans.spi.project.ProjectConfigurationProvider}</li> 80 * <li>{@link org.netbeans.spi.queries.FileBuiltQueryImplementation}</li> 81 * <li>{@link org.netbeans.spi.queries.SharabilityQueryImplementation}</li> 82 * <li><a HREF="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/ProjectOpenedHook.html"><code>ProjectOpenedHook</code></a></li> 83 * <li><a HREF="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/RecommendedTemplates.html"><code>RecommendedTemplates</code></a></li> 84 * <li><a HREF="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/PrivilegedTemplates.html"><code>PrivilegedTemplates</code></a></li> 85 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/classpath/ClassPathProvider.html"><code>ClassPathProvider</code></a></li> 86 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/queries/SourceForBinaryQueryImplementation.html"><code>SourceForBinaryQueryImplementation</code></a></li> 87 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/queries/SourceLevelQueryImplementation.html"><code>SourceLevelQueryImplementation</code></a></li> 88 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/queries/JavadocForBinaryQueryImplementation.html"><code>JavadocForBinaryQueryImplementation</code></a></li> 89 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/queries/AccessibilityQueryImplementation.html"><code>AccessibilityQueryImplementation</code></a></li> 90 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/queries/MultipleRootsUnitTestForSourceQueryImplementation.html"><code>MultipleRootsUnitTestForSourceQueryImplementation</code></a></li> 91 * <li><a HREF="@org-netbeans-modules-project-ant@/org/netbeans/spi/project/support/ant/ProjectXmlSavedHook.html"><code>ProjectXmlSavedHook</code></a></li> 92 * <li><a HREF="@org-netbeans-modules-project-ant@/org/netbeans/spi/project/ant/AntArtifactProvider.html"><code>AntArtifactProvider</code></a></li> 93 * <li><a HREF="@org-openidex-util@/org/openidex/search/SearchInfo.html"><code>SearchInfo</code></a></li> 94 * <li><a HREF="@org-netbeans-api-java@/org/netbeans/spi/java/queries/BinaryForSourceQueryImplementation.html"><code>BinaryForSourceQueryImplementation</code></a></li> 95 * </ol> 96 * <p>Typical implementation:</p> 97 * <pre> 98 * private final Lookup lookup = Lookups.fixed(new Object[] { 99 * new MyAbility1(this), 100 * // ... 101 * }); 102 * public Lookup getLookup() { 103 * return lookup; 104 * } 105 * </pre> 106 * </div> 107 * @return a set of abilities 108 */ 109 Lookup getLookup(); 110 111 } 112