KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > subversion > ui > actions > AbstractAllAction


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
20 package org.netbeans.modules.subversion.ui.actions;
21
22 import org.netbeans.api.project.*;
23 import org.netbeans.api.project.ui.*;
24 import org.netbeans.modules.subversion.util.*;
25 import org.openide.util.*;
26 import org.openide.util.actions.SystemAction;
27
28 /**
29  * Abstract base for Show All Changes, Show All Diffs,
30  * Update All and Commit All actions.
31  *
32  * <p>TODO add context listening and resetting logic
33  * It means that opened Subversion view, Diff view
34  * should react to newly opened/closed projects.
35  *
36  * @author Petr Kuzel
37  */

38 public abstract class AbstractAllAction extends SystemAction {
39     
40     /** Creates a new instance of AbstractAllAction */
41     public AbstractAllAction() {
42         setIcon(null);
43         putValue("noIconInMenu", Boolean.TRUE); // NOI18N
44
}
45
46     /**
47      * Enabled for at least one opened project
48      */

49     public boolean isEnabled() {
50         if (super.isEnabled()) {
51             Project projects[] = OpenProjects.getDefault().getOpenProjects();
52             for (int i = 0; i < projects.length; i++) {
53                 Project project = projects[i];
54                 if (SvnUtils.isVersionedProject(project)) {
55                     return true;
56                 }
57             }
58         }
59         return false;
60     }
61     
62     public HelpCtx getHelpCtx() {
63         return new HelpCtx(getClass());
64     }
65     
66 }
67
Popular Tags