KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > refactoring > spi > RefactoringElementImplementation


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.refactoring.spi;
20
21 import org.netbeans.modules.refactoring.api.RefactoringElement;
22 import org.openide.filesystems.FileObject;
23 import org.openide.text.PositionBounds;
24
25 /** Interface representing a refactoring element (object affected by a refactoring)
26  * returned in a collection from {@link org.netbeans.modules.refactoring.api.AbstractRefactoring#prepare} operation.
27  * <p>
28  *
29  * @author Martin Matula
30  * @author Jan Becicka
31  * @see RefactoringElement
32  * @see SimpleRefactoringElementImpl
33  * @see RefactoringSession
34  * @see RefactoringElementsBag
35  */

36 public interface RefactoringElementImplementation {
37     /** Status corresponding to a normal element */
38     int NORMAL = RefactoringElement.NORMAL;
39     /** Status corresponding to an element that has a warning associated with it */
40     int WARNING = RefactoringElement.WARNING;
41     /** Status flag that indicates that the element cannot be enabled (if a fatal
42      * problem is associated with it) */

43     int GUARDED = RefactoringElement.GUARDED;
44     /** This element is in read-only file */
45     int READ_ONLY = RefactoringElement.READ_ONLY;
46     
47     /** Returns text describing the refactoring element.
48      * @return Text.
49      */

50     String JavaDoc getText();
51     
52     /** Returns text describing the refactoring formatted for display (using HTML tags).
53      * @return Formatted text.
54      */

55     String JavaDoc getDisplayText();
56     
57     /** Indicates whether this refactoring element is enabled.
58      * @return <code>true</code> if this element is enabled, otherwise <code>false</code>.
59      */

60     boolean isEnabled();
61     
62     /** Enables/disables this element.
63      * @param enabled If <code>true</code> the element is enabled, otherwise it is disabled.
64      */

65     void setEnabled(boolean enabled);
66     
67     /**
68      * Performs the change represented by this refactoring element.
69      * Implementation can be impty if the change is done using some high level
70      * transaction model
71      * @see BackupFacility
72      * @see RefactoringElementsBag#registerFileChange
73      * @see RefactoringElementsBag#registerTransaction
74      * @see Transaction
75      * @see RefactoringElementImplementation#performChange
76      * @see RefactoringElementImplementation#undoChange
77      */

78     void performChange();
79     
80     /**
81      * Undo change done by performChange
82      * Implementation can be impty if the change is done using some high level
83      * transaction model
84      * @see BackupFacility
85      * @see RefactoringElementsBag#registerFileChange
86      * @see RefactoringElementsBag#registerTransaction
87      * @see Transaction
88      * @see RefactoringElementImplementation#performChange
89      * @see RefactoringElementImplementation#undoChange
90      */

91     void undoChange();
92     
93     /** Returns element containing this refactoring element.
94      * @see org.netbeans.modules.refactoring.spi.ui.TreeElement
95      * @see org.netbeans.modules.refactoring.spi.ui.TreeElementFactory
96      * @see org.netbeans.modules.refactoring.spi.ui.TreeElementFactoryImplementation
97      * @return element.
98      */

99     Object JavaDoc getComposite();
100     
101     /** Returns file that the element affects (relates to)
102      * @return File
103      */

104     FileObject getParentFile();
105     
106     /** Returns position bounds of the text to be affected by this refactoring element.
107      * @return position bounds
108      */

109     PositionBounds getPosition();
110     
111     /** Returns the status of this refactoring element (whether it is a normal element,
112      * or a warning.
113      * @return Status of this element.
114      */

115     int getStatus();
116     
117     /**
118      * Setter for property status
119      * @param status new value of propery status
120      */

121     void setStatus(int status);
122     
123     /**
124      * opens this RefactoringElement in the editor
125      * @since 1.5.0
126      */

127     void openInEditor();
128     
129     /**
130      * Shows this element in refactoring preview are
131      * @see org.netbeans.modules.refactoring.api.ui.UI#setComponentForRefactoringPreview
132      */

133     void showPreview();
134     
135 }
136
Popular Tags