/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.netbeans.modules.csl.api;

/**
 * This interface is implemented by HintFix implementations that are also "previewable";
 * these fixes can provide their implementation as a list of edit operations that
 * can be used to compute diff views etc.
 * 
 * @todo Don't make this extend fix; perhaps I can use previewable elsewhere as well?
 * 
 * @author Tor Norbye
 */
public interface PreviewableFix extends HintFix {
    /**
     * Return true if this fix can provide a fix.
     * (This isn't determined only by implementing fix, since some fix implementations
     * may be previewable in some cases and not in others. For example, the CamelCaseNames
     * fix can preview name fixes for local variables, but not for global renames.)
     * 
     * @return true iff this fix can generate a preview.
     */
    boolean canPreview();
    
    /** 
     * Return a list of edits which the {@link #implement} method will
     * perform. You can return null (or an empty list) here, but if you
     * provide a list of edits, the IDE will use the edit list to offer
     * a preview of the hint.
     * <p>
     * This method will not be called for interactive hints (hints which
     * return true from {@link #isInteractive}.)
     * 
     * @return an EditList containing edits that can preview
     */
    EditList getEditList() throws Exception;
}
