01: // CvsRootResource.java
02: // $Id: CvsRootDirectory.java,v 1.3 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.3 $
19: * @author Benoît Mahé (bmahe@w3.org)
20: */
21: public class CvsRootDirectory 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.forName("org.w3c.jigedit.cvs.CvsRootDirectory");
35: } catch (Exception ex) {
36: ex.printStackTrace();
37: System.exit(1);
38: }
39: // The Cvs Root
40: a = new StringAttribute("cvs-root", null, Attribute.EDITABLE);
41: ATTR_CVSROOT = AttributeRegistry.registerAttribute(cls, a);
42: }
43:
44: protected String getCvsRoot() {
45: return getString(ATTR_CVSROOT, null);
46: }
47:
48: public void setValue(int idx, Object value) {
49: super .setValue(idx, value);
50: if (idx == ATTR_CVSROOT) {
51: //propagate it
52: CvsModule.setValue(getContext(), CvsModule.CVSROOT, value);
53: }
54: }
55:
56: /**
57: * Initialize this resource with the given set of attributes.
58: * @param values The attribute values.
59: */
60: public void initialize(Object values[]) {
61: super .initialize(values);
62: disableEvent();
63: //propagate the cvs root value (if any)
64: String cvsroot = getCvsRoot();
65: if (cvsroot != null)
66: CvsModule
67: .setValue(getContext(), CvsModule.CVSROOT, cvsroot);
68: enableEvent();
69: }
70: }
|