KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > cvsclient > command > watch > WatchMode


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.netbeans.lib.cvsclient.command.watch;
20
21 import org.netbeans.lib.cvsclient.request.*;
22
23 /**
24  * @author Thomas Singer
25  * @version Dec 29, 2001
26  */

27 public class WatchMode {
28     /**
29      * This is the WatchMode that enables watching.
30      */

31     public static final WatchMode ON = new WatchMode("on", // NOI18N
32
CommandRequest.WATCH_ON,
33                                                      false);
34
35     /**
36      * This is the WatchMode that disables watching.
37      */

38     public static final WatchMode OFF = new WatchMode("off", // NOI18N
39
CommandRequest.WATCH_OFF,
40                                                       false);
41
42     /**
43      * This is the WatchMode that adds watching for the specified Watch.
44      */

45     public static final WatchMode ADD = new WatchMode("add", // NOI18N
46
CommandRequest.WATCH_ADD,
47                                                       true);
48
49     /**
50      * This is the WatchMode that removes watching for the specified Watch.
51      */

52     public static final WatchMode REMOVE = new WatchMode("remove", // NOI18N
53
CommandRequest.WATCH_REMOVE,
54                                                          true);
55
56     private final String JavaDoc name;
57     private final CommandRequest command;
58     private final boolean watchOptionAllowed;
59
60     private WatchMode(String JavaDoc name, CommandRequest command, boolean watchOptionAllowed) {
61         this.name = name;
62         this.command = command;
63         this.watchOptionAllowed = watchOptionAllowed;
64     }
65
66     /**
67      * Returns the CommandRequest that is used when executing the WatchCommand
68      * with this WatchMode.
69      */

70     public CommandRequest getCommand() {
71         return command;
72     }
73
74     /**
75      * Indicated, whether a non-null watch-option is allowed in the WatchCommand.
76      */

77     public boolean isWatchOptionAllowed() {
78         return watchOptionAllowed;
79     }
80
81     /**
82      * Returns the name of this WatchMode ("on", "off", "add", "remove").
83      */

84     public String JavaDoc toString() {
85         return name;
86     }
87 }
88
Popular Tags