KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > versioning > spi > VCSAnnotator


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.spi;
20
21 import javax.swing.*;
22 import java.awt.Image JavaDoc;
23
24 /**
25  * Anntoator provides these services based on files' versioning status:
26  * - coloring for labels (file and folder names, editor tabs, etc.)
27  * - badging (modification of node icons)
28  * - provides set of Actions
29  *
30  * @author Maros Sandor
31  */

32 public abstract class VCSAnnotator {
33
34     /**
35      * Specifies destination of returned actions.
36      * @link #getActions
37      */

38     public enum ActionDestination { MainMenu, PopupMenu };
39
40     /**
41      * Allows a versioning system to decorate given name with HTML markup. This can be used to hilight file status.
42      *
43      * @param name text to decorate
44      * @param context a context this name represents
45      * @return decorated name or the same name left undecorated
46      */

47     public String JavaDoc annotateName(String JavaDoc name, VCSContext context) {
48         return name;
49     }
50
51     /**
52      * Allows a versioning system to decorate given icon (badging). This can be used to hilight file status.
53      *
54      * @param icon an icon to decorate
55      * @param context a context this icon represents
56      * @return decorated icon or the same icon left undecorated
57      */

58     public Image JavaDoc annotateIcon(Image JavaDoc icon, VCSContext context) {
59         return icon;
60     }
61
62     /**
63      * Returns set of actions to offer to the user use on a given context.
64      *
65      * @param context context on which returned actions should operate
66      * @param destination where this actions will be used
67      * @return Action[] array of actions to display for the given context, use null for separators
68      */

69     public Action[] getActions(VCSContext context, ActionDestination destination) {
70         return new Action[0];
71     }
72 }
73
Popular Tags