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.ui; 20 21 import javax.swing.event.ChangeListener; 22 import org.netbeans.modules.refactoring.api.AbstractRefactoring; 23 import org.netbeans.modules.refactoring.api.Problem; 24 import org.openide.util.HelpCtx; 25 26 /** Interface representing UI for a refactoring. 27 * 28 * @author Martin Matula 29 */ 30 public interface RefactoringUI { 31 /** Returns name of the refactoring. 32 * @return Refactoring name. 33 */ 34 String getName(); 35 36 /** Returns description of the refactoring. 37 * @return Refactoring description. 38 */ 39 String getDescription(); 40 41 /** Indicates whether this class represents a real refactoring that changes 42 * code or whether it is just a query (e.g. all usages for a class). 43 * @return <code>true</code> if the class represents only a query, 44 * <code>false</code> if the class represents a real refactoring. 45 */ 46 boolean isQuery(); 47 48 /** Returns refactoring-specific panel containing input fields for 49 * refactoring parameters. This method is called by ParametersPanel 50 * which is responsible for displaying refactoring parameters dialog. 51 * Name of the panel returned from this method will be used as the dialog 52 * name. This panel can use setPreviewEnabled method of the passed 53 * ParametersPanel to enable/disable Preview button of the refactoring 54 * parameters dialog. 55 * this method might return null if hasParameters return false. 56 * @param parent ParametersPanel that the returned panel will be displayed in. 57 * @see #hasParameters 58 * @return Refactoring-specific parameters panel. 59 */ 60 CustomRefactoringPanel getPanel(ChangeListener parent); 61 62 /** Implementation of this method should set the refactoring parameters entered 63 * by user into the refactoring-specific parameters panel (returned from getPanel 64 * method) into the underlying refactoring object. 65 * @return Chain of problems returned from the underlying refactoring object 66 * when trying to set its parameters. 67 */ 68 Problem setParameters(); 69 70 /** 71 * check parameters of refactoring 72 * @return Chain of problems returned from the underlying refactoring object 73 * when trying to check its parameters. 74 */ 75 Problem checkParameters(); 76 77 /** 78 * true, if refactoring has parameters 79 * false otherwise. In this case {@link #getPanel} method can return null 80 * @return false if this UI does not require any parameters. True otherwise. 81 */ 82 boolean hasParameters(); 83 84 /** Returns underlying refactoring object. 85 * @return Underlying refactoring object. 86 */ 87 AbstractRefactoring getRefactoring(); 88 89 /** 90 * @return helpcontext 91 */ 92 public HelpCtx getHelpCtx(); 93 } 94