KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > filesystems > FileRenameEvent


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 package org.openide.filesystems;
20
21
22 /** Event indicating a file rename.
23 *
24 * @author Petr Hamernik
25 */

26 public class FileRenameEvent extends FileEvent {
27     /** generated Serialized Version UID */
28     private static final long serialVersionUID = -3947658371806653711L;
29
30     /** Original name of the file. */
31     private String JavaDoc name;
32
33     /** Original extension of the file. */
34     private String JavaDoc ext;
35
36     /** Creates new <code>FileRenameEvent</code>. The <code>FileObject</code> where the action took place
37     * is assumed to be the same as the source object.
38     * @param src source file which sent this event
39     * @param name original file name
40     * @param ext original file extension
41     */

42     public FileRenameEvent(FileObject src, String JavaDoc name, String JavaDoc ext) {
43         this(src, src, name, ext);
44     }
45
46     /** Creates new <code>FileRenameEvent</code>, specifying an event location.
47     * @param src source file which sent this event
48     * @param file file object where the action took place
49     * @param name original file name
50     * @param ext original file extension
51     */

52     public FileRenameEvent(FileObject src, FileObject file, String JavaDoc name, String JavaDoc ext) {
53         this(src, file, name, ext, false);
54     }
55
56     /** Creates new <code>FileRenameEvent</code>, specifying an event location
57     * and whether the event was expected by the system.
58     * @param src source file which sent this event
59     * @param file file object where the action took place
60     * @param name original file name
61     * @param ext original file extension
62     * @param expected whether the value was expected
63     */

64     public FileRenameEvent(FileObject src, FileObject file, String JavaDoc name, String JavaDoc ext, boolean expected) {
65         super(src, file, expected);
66         this.name = name;
67         this.ext = ext;
68     }
69
70     /** Get original name of the file.
71     * @return old name of the file
72     */

73     public String JavaDoc getName() {
74         return name;
75     }
76
77     /** Get original extension of the file.
78     * @return old extension of the file
79     */

80     public String JavaDoc getExt() {
81         return ext;
82     }
83
84     @Override JavaDoc
85     void insertIntoToString(StringBuilder JavaDoc b) {
86         b.append(",name.ext=");
87         b.append(name);
88         b.append('.');
89         b.append(ext);
90     }
91
92 }
93
Popular Tags