001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.api.project;
043:
044: import org.openide.filesystems.FileObject;
045: import org.openide.util.Lookup;
046:
047: /**
048: * Represents one IDE project in memory.
049: * <p>
050: * <strong>Never cast a project instance</strong> to any subtype.
051: * (Nor call {@link Object#getClass} on the <code>Project</code> instance.)
052: * The project
053: * manager is free to wrap any project in an unspecified proxy for its own
054: * purposes. For extensibility, use {@link #getLookup}.
055: * </p>
056: * <div class="nonnormative">
057: * <p>Note that this API is primarily of interest to project type provider
058: * modules, and to infrastructure and generic GUI. Most other modules providing
059: * tools or services should <em>not</em> need to explicitly model projects, and
060: * should not be using this API much or at all.</p>
061: * </div>
062: * @see <a href="http://projects.netbeans.org/buildsys/howto.html">NetBeans 4.0 Project & Build System How-To</a>
063: * @author Jesse Glick
064: */
065: public interface Project extends Lookup.Provider {
066:
067: /**
068: * Gets an associated directory where the project metadata and possibly sources live.
069: * In the case of a typical Ant project, this is the top directory, not the
070: * project metadata subdirectory.
071: * @return a directory
072: */
073: FileObject getProjectDirectory();
074:
075: /**
076: * Get any optional abilities of this project.
077: * <div class="nonnormative">
078: * <p>If you are <em>providing</em> a project, there are a number of interfaces
079: * which you should consider implementing and including in lookup, some of which
080: * are described below. If you are <em>using</em> a project from another module,
081: * there are some cases where you will want to ask a project for a particular
082: * object in lookup (e.g. <code>ExtensibleMetadataProvider</code>) but in most
083: * cases you should not; in the case of queries, always call the static query
084: * API helper method, rather than looking for the query implementation objects
085: * yourself. <strong>In the case of <code>ProjectInformation</code> and <code>Sources</code>,
086: * use {@link ProjectUtils} rather than directly searching the project lookup.</strong>
087: * </p>
088: * <p>The following abilities are recommended:</p>
089: * <ol>
090: * <li>{@link org.netbeans.api.project.ProjectInformation}</li>
091: * <li><a href="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/LogicalViewProvider.html"><code>LogicalViewProvider</code></a></li>
092: * <li><a href="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/CustomizerProvider.html"><code>CustomizerProvider</code></a></li>
093: * <li>{@link org.netbeans.api.project.Sources}</li>
094: * <li>{@link org.netbeans.spi.project.ActionProvider}</li>
095: * <li>{@link org.netbeans.spi.project.SubprojectProvider}</li>
096: * <li>{@link org.netbeans.spi.project.AuxiliaryConfiguration}</li>
097: * <li>{@link org.netbeans.spi.project.CacheDirectoryProvider}</li>
098: * </ol>
099: * <p>You might also have e.g.:</p>
100: * <ol>
101: * <li>{@link org.netbeans.spi.project.ProjectConfigurationProvider}</li>
102: * <li>{@link org.netbeans.spi.queries.FileBuiltQueryImplementation}</li>
103: * <li>{@link org.netbeans.spi.queries.SharabilityQueryImplementation}</li>
104: * <li>{@link org.netbeans.spi.queries.FileEncodingQueryImplementation}</li>
105: * <li><a href="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/ProjectOpenedHook.html"><code>ProjectOpenedHook</code></a></li>
106: * <li><a href="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/RecommendedTemplates.html"><code>RecommendedTemplates</code></a></li>
107: * <li><a href="@org-netbeans-modules-projectuiapi@/org/netbeans/spi/project/ui/PrivilegedTemplates.html"><code>PrivilegedTemplates</code></a></li>
108: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/classpath/ClassPathProvider.html"><code>ClassPathProvider</code></a></li>
109: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/queries/SourceForBinaryQueryImplementation.html"><code>SourceForBinaryQueryImplementation</code></a></li>
110: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/queries/SourceLevelQueryImplementation.html"><code>SourceLevelQueryImplementation</code></a></li>
111: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/queries/JavadocForBinaryQueryImplementation.html"><code>JavadocForBinaryQueryImplementation</code></a></li>
112: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/queries/AccessibilityQueryImplementation.html"><code>AccessibilityQueryImplementation</code></a></li>
113: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/queries/MultipleRootsUnitTestForSourceQueryImplementation.html"><code>MultipleRootsUnitTestForSourceQueryImplementation</code></a></li>
114: * <li><a href="@org-netbeans-modules-project-ant@/org/netbeans/spi/project/support/ant/ProjectXmlSavedHook.html"><code>ProjectXmlSavedHook</code></a></li>
115: * <li><a href="@org-netbeans-modules-project-ant@/org/netbeans/spi/project/ant/AntArtifactProvider.html"><code>AntArtifactProvider</code></a></li>
116: * <li><a href="@org-openidex-util@/org/openidex/search/SearchInfo.html"><code>SearchInfo</code></a></li>
117: * <li><a href="@org-netbeans-api-java@/org/netbeans/spi/java/queries/BinaryForSourceQueryImplementation.html"><code>BinaryForSourceQueryImplementation</code></a></li>
118: * <li><a href="@org-netbeans-modules-project-ant@/org/netbeans/api/project/ant/AntBuildExtender.html"><code>AntBuildExtender</code></a></li>
119: * <li><a href="@org-openide-loaders@/org/openide/loaders/CreateFromTemplateAttributesProvider.html"><code>CreateFromTemplateAttributesProvider</code></a></li>
120: * </ol>
121: * <p>Typical implementation:</p>
122: * <pre>
123: * private final Lookup lookup = Lookups.fixed(new Object[] {
124: * new MyAbility1(this),
125: * // ...
126: * });
127: * public Lookup getLookup() {
128: * return lookup;
129: * }
130: * </pre>
131: * </div>
132: * @return a set of abilities
133: */
134: Lookup getLookup();
135:
136: }
|