KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > ruby > spi > project > support > rake > RakeProjectEvent


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.modules.ruby.spi.project.support.rake;
21
22 import java.util.EventObject JavaDoc;
23
24 /**
25  * Event object corresponding to a change made in an Ant project's metadata.
26  * The event source is an {@link RakeProjectHelper}.
27  * @see RakeProjectListener
28  * @author Jesse Glick
29  */

30 public final class RakeProjectEvent extends EventObject JavaDoc {
31
32     private final String JavaDoc path;
33     private final boolean expected;
34
35     RakeProjectEvent(RakeProjectHelper helper, String JavaDoc path, boolean expected) {
36         super(helper);
37         this.path = path;
38         this.expected = expected;
39     }
40     
41     /**
42      * Get the associated Ant project helper object.
43      * @return the project helper which fired the event
44      */

45     public RakeProjectHelper getHelper() {
46         return (RakeProjectHelper)getSource();
47     }
48     
49     /**
50      * Get the path to the modified (or created or deleted) file.
51      * Paths typically used are:
52      * <ol>
53      * <li>{@link RakeProjectHelper#PROJECT_PROPERTIES_PATH}
54      * <li>{@link RakeProjectHelper#PRIVATE_PROPERTIES_PATH}
55      * <li>{@link RakeProjectHelper#PROJECT_XML_PATH}
56      * <li>{@link RakeProjectHelper#PRIVATE_XML_PATH}
57      * </ol>
58      * However for properties files, other paths may exist if the project
59      * uses them for some purpose.
60      * @return a project-relative path
61      */

62     public String JavaDoc getPath() {
63         return path;
64     }
65     
66     /**
67      * Check whether the change was produced by calling methods on
68      * {@link RakeProjectHelper} or whether it represents a change
69      * detected on disk.
70      * @return true if the change was triggered by in-memory modification methods,
71      * false if occurred on disk in the metadata files and is being loaded
72      */

73     public boolean isExpected() {
74         return expected;
75     }
76     
77 }
78
Popular Tags