KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > subversion > SubversionVCS


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.modules.subversion;
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 import java.beans.PropertyChangeListener JavaDoc;
34 import java.beans.PropertyChangeEvent JavaDoc;
35
36 /**
37  * @author Maros Sandor
38  */

39 public class SubversionVCS extends VersioningSystem implements VersioningListener, PreferenceChangeListener JavaDoc, PropertyChangeListener JavaDoc {
40
41     public SubversionVCS() {
42         Subversion.getInstance().getStatusCache().addVersioningListener(this);
43         Subversion.getInstance().addPropertyChangeListener(this);
44         SvnModuleConfig.getDefault().getPreferences().addPreferenceChangeListener(this);
45     }
46
47     public String JavaDoc getDisplayName() {
48         return NbBundle.getMessage(SubversionVCS.class, "CTL_Subversion_MainMenu");
49     }
50
51     public File JavaDoc getTopmostManagedParent(File JavaDoc file) {
52         return Subversion.getInstance().getTopmostManagedParent(file);
53     }
54
55     public VCSAnnotator getVCSAnnotator() {
56         return Subversion.getInstance().getVCSAnnotator();
57     }
58
59     public VCSInterceptor getVCSInterceptor() {
60         return Subversion.getInstance().getVCSInterceptor();
61     }
62
63     public OriginalContent getVCSOriginalContent(File JavaDoc file) {
64         return Subversion.getInstance().getVCSOriginalContent(file);
65     }
66
67     public void versioningEvent(VersioningEvent event) {
68         if (event.getId() == FileStatusCache.EVENT_FILE_STATUS_CHANGED) {
69             File JavaDoc file = (File JavaDoc) event.getParams()[0];
70             fireStatusChanged(file);
71         }
72     }
73
74     public void preferenceChange(PreferenceChangeEvent JavaDoc evt) {
75         if (evt.getKey().startsWith(SvnModuleConfig.PROP_COMMIT_EXCLUSIONS)) {
76             fireStatusChanged((Set<File JavaDoc>) null);
77         } else if (evt.getKey().startsWith(SvnModuleConfig.PROP_TEXT_ANNOTATIONS_FORMAT)) {
78             fireAnnotationsChanged((Set<File JavaDoc>) null);
79         }
80     }
81
82     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
83         if (evt.getPropertyName().equals(Subversion.PROP_ANNOTATIONS_CHANGED)) {
84             fireAnnotationsChanged((Set<File JavaDoc>) evt.getNewValue());
85         } else if (evt.getPropertyName().equals(Subversion.PROP_VERSIONED_FILES_CHANGED)) {
86             fireVersionedFilesChanged();
87         }
88     }
89 }
90
Popular Tags