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 java.util.Collection; 22 import org.netbeans.modules.refactoring.api.Problem; 23 import org.netbeans.modules.refactoring.spi.RefactoringElementsBag; 24 25 /** Interface implemented by refactoring plugins. Contains callback methods which a particular refactoring 26 * calls to check pre-conditions, validity of parameters and collect refactoring elements. 27 * It is expected that the refactoring that this plugin operates on is passed to the plugin 28 * in its constructor by a corresponding implementation of {@link RefactoringPluginFactory}. 29 * 30 * @author Martin Matula 31 */ 32 public interface RefactoringPlugin { 33 /** Checks pre-conditions of the refactoring and returns problems. 34 * @return Problems found or null (if no problems were identified) 35 */ 36 Problem preCheck(); 37 38 /** Checks parameters of the refactoring. 39 * @return Problems found or null (if no problems were identified) 40 */ 41 Problem checkParameters(); 42 43 /** Fast checks parameters of the refactoring. This method will be used for 44 * online error checking. 45 * @return Problems found or null (if no problems were identified) 46 */ 47 Problem fastCheckParameters(); 48 49 50 /** 51 * Asynchronous request to cancel ongoing long-term request (such as preCheck(), checkParameters() or prepare()) 52 */ 53 void cancelRequest(); 54 55 /** Collects refactoring elements for a given refactoring. 56 * @param refactoringElements RefactoringElementsBag of refactoring elements - the implementation of this method 57 * should add refactoring elements to this collections. It should make no assumptions about the collection 58 * content. 59 * @return Problems found or null (if no problems were identified) 60 */ 61 Problem prepare(RefactoringElementsBag refactoringElements); 62 } 63