KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > versioning > system > cvss > CVS


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.versioning.system.cvss;
20
21 import org.netbeans.modules.versioning.spi.VersioningSystem;
22 import org.netbeans.modules.versioning.spi.VCSAnnotator;
23 import org.netbeans.modules.versioning.spi.VCSInterceptor;
24 import org.netbeans.modules.versioning.spi.OriginalContent;
25 import org.netbeans.modules.versioning.util.VersioningListener;
26 import org.netbeans.modules.versioning.util.VersioningEvent;
27 import org.openide.util.NbBundle;
28
29 import java.io.File JavaDoc;
30 import java.util.*;
31 import java.util.prefs.PreferenceChangeEvent JavaDoc;
32 import java.util.prefs.PreferenceChangeListener JavaDoc;
33
34 /**
35  * CVS registration class.
36  *
37  * @author Maros Sandor
38  */

39 public class CVS extends VersioningSystem implements VersioningListener, PreferenceChangeListener JavaDoc {
40
41     public CVS() {
42         CvsVersioningSystem.getInstance().addVersioningListener(this);
43         CvsVersioningSystem.getInstance().getStatusCache().addVersioningListener(this);
44         CvsModuleConfig.getDefault().getPreferences().addPreferenceChangeListener(this);
45     }
46     
47     public String JavaDoc getDisplayName() {
48         return NbBundle.getMessage(CVS.class, "CTL_CVS_MainMenu");
49     }
50
51     /**
52      * Returns the topmost parent folder of the given file that is managed by this versioning system.
53      *
54      * @param file
55      * @return null if this file is not managed by this versioning system or a topmpost File (folder) that is still versioned but its parent is not
56      */

57     public File JavaDoc getTopmostManagedParent(File JavaDoc file) {
58         return CvsVersioningSystem.getInstance().getTopmostManagedParent(file);
59     }
60
61     public VCSAnnotator getVCSAnnotator() {
62         return CvsVersioningSystem.getInstance().getVCSAnnotator();
63     }
64
65     public VCSInterceptor getVCSInterceptor() {
66         return CvsVersioningSystem.getInstance().getVCSInterceptor();
67     }
68
69     public OriginalContent getVCSOriginalContent(File JavaDoc workingCopy) {
70         return CvsVersioningSystem.getInstance().getVCSOriginalContent(workingCopy);
71     }
72
73     public void versioningEvent(VersioningEvent event) {
74         if (event.getId() == FileStatusCache.EVENT_FILE_STATUS_CHANGED) {
75             File JavaDoc file = (File JavaDoc) event.getParams()[0];
76             fireStatusChanged(file);
77         } else if (event.getId() == CvsVersioningSystem.EVENT_REFRESH_ANNOTATIONS) {
78             fireStatusChanged((Set<File JavaDoc>) null);
79         } else if (event.getId() == CvsVersioningSystem.EVENT_VERSIONED_FILES_CHANGED) {
80             fireVersionedFilesChanged();
81         }
82     }
83
84     public void preferenceChange(PreferenceChangeEvent JavaDoc evt) {
85         if (evt.getKey().startsWith(CvsModuleConfig.PROP_COMMIT_EXCLUSIONS)) {
86             fireStatusChanged((Set<File JavaDoc>) null);
87         } else if (evt.getKey().startsWith(CvsModuleConfig.PROP_ANNOTATIONS_VISIBLE)) {
88             fireAnnotationsChanged(null);
89         } else if (evt.getKey().startsWith(CvsModuleConfig.PROP_ANNOTATIONS_FORMAT)) {
90             fireAnnotationsChanged(null);
91         }
92     }
93 }
94
Popular Tags