KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > refactoring > spi > ChangeExecutor


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.xml.refactoring.spi;
20
21 import java.io.IOException JavaDoc;
22 import org.netbeans.modules.xml.refactoring.RefactorRequest;
23 import org.netbeans.modules.xml.refactoring.impl.RefactoringUtil;
24 import org.netbeans.modules.xml.xam.Referenceable;
25
26 /**
27  * Executor of a refactor target change.
28  * A refactoring request processing consist of 2 steps:
29  * (1) making the change on the target component,
30  * (2) refactoring selected the usage components.
31  * The implementation of this class is reponsible for the first step.
32  *
33  * @author Nam Nguyen
34  */

35 public abstract class ChangeExecutor {
36
37     public abstract <T extends RefactorRequest> boolean canChange(Class JavaDoc<T> changeType, Referenceable target);
38
39     /**
40      * Perform a pre-change checking on the refactor request.
41      * Implementation should quietly ignore unsupported refactoring type.
42      */

43     public void precheck(RefactorRequest request) {
44     }
45
46     /**
47      * Perform the change specified by the refactor request. Any errors that would
48      * fail the overall refactoring should be reported throught #RefactoringRequest.addError
49      * Implementation should quietly ignore unsupported refactoring type.
50      */

51     public void doChange(RefactorRequest request) throws IOException JavaDoc {
52     }
53
54     /**
55      * Returns UI helper in displaying the usages. Implementation could override
56      * the default UI to help display usages in a more intuitive way than the
57      * generic helper.
58      */

59     public UIHelper getUIHelper() {
60         return new UIHelper();
61     }
62
63 }
64
65
Popular Tags