KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > refactoring > api > SafeDeleteRefactoring


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.api;
21
22 import org.openide.util.Lookup;
23
24 /**
25  * Refactoring to Safely Delete an element after checking its usages.
26  * @see org.netbeans.modules.refactoring.spi.RefactoringPlugin
27  * @see org.netbeans.modules.refactoring.spi.RefactoringPluginFactory
28  * @see AbstractRefactoring
29  * @see RefactoringSession
30  * @author Bharath Ravikumar, Jan Becicka
31  */

32 public final class SafeDeleteRefactoring extends AbstractRefactoring {
33     private boolean checkInComments;
34
35     /**
36      * Creates a new instance of SafeDeleteRefactoring, passing Lookup containing the candidate
37      * elements as parameter.
38      *
39      * Safe Delete Refactoring implementations currently understand following types:
40      * <table border="1">
41      * <tr><th>Module</th><th>Types the Module Understands</th><th>Implementation</th></tr>
42      * <tr><td>Refactoring API (Default impl.)</td><td>FileObject</td><td>Does file delete</td></tr>
43      * <tr><td>Java Refactoring</td><td><ul><li>{@link org.openide.filesystems.FileObject}(s) with content type text/x-java (safly delete class)
44      * <li>{@link org.netbeans.api.java.source.TreePathHandle} (class, field, method)</td>
45      * <td>Check for usages and does refactoring inside .java files.</td></tr>
46      * </table>
47      * @param namedElements The elements to be safely deleted
48      */

49     public SafeDeleteRefactoring(Lookup namedElements) {
50         super(namedElements);
51     }
52     
53     /**
54      * Indicates whether the usage of the elements will also be checked
55      * in comments before deleting the elements
56      * @return Returns the value of the field checkInComments
57      */

58     public boolean isCheckInComments() {
59         return checkInComments;
60     }
61     
62     /**
63      * Sets whether or not the usage of the elements will be checked
64      * in comments before deleting the elements
65      * @param checkInComments Sets the checInComments field of this class
66      */

67     public void setCheckInComments(boolean checkInComments) {
68         this.checkInComments = checkInComments;
69     }
70 }
71
Popular Tags