KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > project > SourceGroup


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.api.project;
21
22 import java.beans.PropertyChangeListener JavaDoc;
23 import javax.swing.Icon JavaDoc;
24 import org.openide.filesystems.FileObject;
25
26 // XXX should be PROP_* constants for rootFolder, name, displayName, icon
27

28 /**
29  * Representation of one area of sources.
30  * @author Jesse Glick
31  * @see Sources
32  */

33 public interface SourceGroup {
34
35     /**
36      * Pseudo-property used to indicate changes in containership of some subfiles.
37      * (The old and new value should be left null.)
38      */

39     String JavaDoc PROP_CONTAINERSHIP = "containership"; // NOI18N
40

41     /**
42      * Get the folder forming the root of this group of sources.
43      * @return the root folder (must be a folder, not a file)
44      */

45     FileObject getRootFolder();
46     
47     /**
48      * Get a code name suitable for internal identification of this source group.
49      * Should be unique among the source groups of a given type
50      * contained in a single {@link Sources} object.
51      * @return a code name
52      */

53     String JavaDoc getName();
54
55     /**
56      * Get a display name suitable for presentation to a user.
57      * Should preferably be unique among the source groups of a given type
58      * contained in a single {@link Sources} object.
59      * @return a display name
60      */

61     String JavaDoc getDisplayName();
62
63     /**
64      * Get an icon for presentation to a user.
65      * @param opened if true, may select an alternative "open" variant
66      * @return an icon, or null if no specific icon is needed
67      */

68     Icon JavaDoc getIcon(boolean opened);
69
70     /**
71      * Check whether the given file is contained in this group.
72      * <p>
73      * A constraint is that the root folder must be contained and
74      * if any file or folder (other than the root folder) is contained then
75      * its parent must be as well. Therefore, while the return value is precise
76      * for files, and a false return value means what it sounds like for folders,
77      * a true return value for folders may mean that just parts of the folder are
78      * contained in the group.
79      * </p>
80      * @param file a file or folder; must be a descendant of the root folder
81      * @return true if the group contains that file, false if it is to be excluded
82      * @throws IllegalArgumentException if a file is passed which is not inside the root
83      */

84     boolean contains(FileObject file) throws IllegalArgumentException JavaDoc;
85     
86     /**
87      * Add a listener to changes in aspects of the source group.
88      * The property names used may be normal JavaBean names
89      * (<code>rootFolder</code>, <code>name</code>, <code>displayName</code>,
90      * <code>icon</code>) or {@link #PROP_CONTAINERSHIP}.
91      * @param listener a listener to add
92      */

93     void addPropertyChangeListener(PropertyChangeListener JavaDoc listener);
94
95     /**
96      * Remove a listener to changes in aspects of the source group.
97      * @param listener a listener to remove
98      */

99     void removePropertyChangeListener(PropertyChangeListener JavaDoc listener);
100
101 }
102
Popular Tags