blob: 9e404f5f5cc5ef26e8cfaaab7d427eed4b010d37 [file] [log] [blame]
/**
* Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Alexandra Buzila - initial API and implementation
*/
package org.eclipse.emf.ecp.quickfix;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.EObject;
/**
* Interface for model quick fixes.
*
* @author Alexandra Buzila
*
*/
public interface ModelQuickFix {
/** Priority for fixes that are not applicable to a given diagnostic. */
double NOT_APPLICABLE = 0;
/**
* Checks whether the quick fix is applicable for the provided Diagnostic.
*
* @param diagnostic - the diagnostic of the problem
* @return the priority of the fix, higher priority will be preferred
*/
double isApplicable(Diagnostic diagnostic);
/**
* Applies the fix to the {@link EObject}.
*
* @param target - the {@link EObject} that should be fixed
* @throws ModelQuickFixException if something went wrong while applying the fix.
*/
void applyFix(EObject target) throws ModelQuickFixException;
/**
* @param diagnostic the diagnostic for which the label should be returned
* @return the label for the quick fix, for the given diagnostic
*/
String getLabel(Diagnostic diagnostic);
}