KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > refactoring > spi > ui > ActionsImplementationProvider


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.refactoring.spi.ui;
21
22 import org.openide.util.Lookup;
23 /**
24  * Create your own provider of this class and register it in META-INF services, if you want to
25  * create your own implementations of refactorin actions.
26  * For instance Java module wants to have refactoring rename action for java files.
27  * So Java Refactoring module must implement 2 methods.
28  *
29  * <pre>
30  * public boolean canRename(Lookup lookup) {
31  * Node[] nodes = lookup.lookupAll(Node.class);
32  * if (..one node selected and the node belongs to java...)
33  * return true;
34  * else
35  * return false;
36  * }
37  *
38  * public void doRename(Lookup selectedNodes) {
39  * Node[] nodes = lookup.lookupAll(Node.class);
40  * final FileObject fo = getFileFromNode(nodes[0]);
41  * UI.openRefactoringUI(new RenameRefactoringUI(fo);
42  * }
43  * </pre>
44  *
45  * For help on creating and registering actions
46  * See <a HREF=http://wiki.netbeans.org/wiki/view/RefactoringFAQ>Refactoring FAQ</a>
47  *
48  * @author Jan Becicka
49  */

50 public abstract class ActionsImplementationProvider {
51     
52     /**
53      * @param lookup current context
54      * @return true if provider can handle rename
55      */

56     public boolean canRename(Lookup lookup) {
57         return false;
58     }
59
60     /**
61      * @param lookup current context
62      */

63     public void doRename(Lookup lookup) {
64         throw new UnsupportedOperationException JavaDoc("Not implemented!");
65     }
66
67     /**
68      * @param lookup current context
69      * @return true if provider can handle find usages
70      */

71     public boolean canFindUsages(Lookup lookup) {
72         return false;
73     }
74
75     /**
76      * @param lookup current context
77      */

78     public void doFindUsages(Lookup lookup) {
79         throw new UnsupportedOperationException JavaDoc("Not implemented!");
80     }
81
82     /**
83      * @param lookup current context
84      * @return true if provider can handle delete
85      */

86     public boolean canDelete(Lookup lookup) {
87         return false;
88     }
89     
90     /**
91      * @param lookup current context
92      */

93     public void doDelete(Lookup lookup) {
94         throw new UnsupportedOperationException JavaDoc("Not implemented!");
95     }
96
97     /**
98      * @param lookup current context
99      * @return true if provider can handle move
100      */

101     public boolean canMove(Lookup lookup) {
102         return false;
103     }
104
105     /**
106      * @param lookup current context
107      */

108     public void doMove(Lookup lookup) {
109         throw new UnsupportedOperationException JavaDoc("Not implemented!");
110     }
111
112     /**
113      * @param lookup current context
114      * @return true if provider can handle copy
115      */

116     public boolean canCopy(Lookup lookup) {
117         return false;
118     }
119
120     /**
121      * @param lookup current context
122      */

123     public void doCopy(Lookup lookup) {
124         throw new UnsupportedOperationException JavaDoc("Not implemented!");
125     }
126 }
127
Popular Tags