01: // CvsRootResource.java
02: // $Id: CvsRootPassDirectory.java,v 1.2 2000/08/16 21:37:32 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1998.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigedit.cvs;
07:
08: import org.w3c.tools.resources.Attribute;
09: import org.w3c.tools.resources.AttributeHolder;
10: import org.w3c.tools.resources.AttributeRegistry;
11: import org.w3c.tools.resources.FramedResource;
12: import org.w3c.tools.resources.Resource;
13: import org.w3c.tools.resources.StringAttribute;
14:
15: import org.w3c.jigsaw.resources.PassDirectory;
16:
17: /**
18: * @version $Revision: 1.2 $
19: * @author Benoît Mahé (bmahe@w3.org)
20: */
21: public class CvsRootPassDirectory extends
22: org.w3c.jigsaw.resources.PassDirectory {
23:
24: /**
25: * Attribute index, The cvs root.
26: */
27: public static int ATTR_CVSROOT = -1;
28:
29: static {
30: Attribute a = null;
31: Class cls = null;
32:
33: try {
34: cls = Class
35: .forName("org.w3c.jigedit.cvs.CvsRootPassDirectory");
36: } catch (Exception ex) {
37: ex.printStackTrace();
38: System.exit(1);
39: }
40: // The Cvs Root
41: a = new StringAttribute("cvs-root", null, Attribute.EDITABLE);
42: ATTR_CVSROOT = AttributeRegistry.registerAttribute(cls, a);
43: }
44:
45: protected String getCvsRoot() {
46: return getString(ATTR_CVSROOT, null);
47: }
48:
49: public void setValue(int idx, Object value) {
50: super .setValue(idx, value);
51: if (idx == ATTR_CVSROOT) {
52: //propagate it
53: CvsModule.setValue(getContext(), CvsModule.CVSROOT, value);
54: }
55: }
56:
57: /**
58: * Initialize this resource with the given set of attributes.
59: * @param values The attribute values.
60: */
61: public void initialize(Object values[]) {
62: super .initialize(values);
63: disableEvent();
64: //propagate the cvs root value (if any)
65: String cvsroot = getCvsRoot();
66: if (cvsroot != null)
67: CvsModule
68: .setValue(getContext(), CvsModule.CVSROOT, cvsroot);
69: enableEvent();
70: }
71: }
|