KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > ui > text > java > IQuickFixProcessor


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *
11  *******************************************************************************/

12 package org.eclipse.jdt.ui.text.java;
13
14 import org.eclipse.core.runtime.CoreException;
15
16 import org.eclipse.jdt.core.ICompilationUnit;
17
18
19 /**
20  * Interface to be implemented by contributors to the extension point
21  * <code>org.eclipse.jdt.ui.quickFixProcessors</code>.
22  * <p>Since 3.2, each extension specifies the marker types it can handle, and {@link #hasCorrections(ICompilationUnit, int)} and
23  * {@link #getCorrections(IInvocationContext, IProblemLocation[])} are called if (and only if) quick fix is
24  * required for a problem of these types.</p>
25  * <p>Note, if a extension does not specify marker types it will be only called for problem of type
26  * <code>org.eclipse.jdt.core.problem</code>, <code>org.eclipse.jdt.core.buildpath_problem</code>
27  * and <code>org.eclipse.jdt.core.task</code>; compatible with the behavior prior to 3.2</p>
28  *
29  * @since 3.0
30  */

31 public interface IQuickFixProcessor {
32
33     /**
34      * Returns <code>true</code> if the processor has proposals for the given problem. This test should be an
35      * optimistic guess and be very cheap.
36      *
37      * @param unit the compilation unit
38      * @param problemId the problem Id. The id is of a problem of the problem type(s) this processor specified in
39      * the extension point.
40      * @return <code>true</code> if the processor has proposals for the given problem
41      */

42     boolean hasCorrections(ICompilationUnit unit, int problemId);
43
44     /**
45      * Collects corrections or code manipulations for the given context.
46      *
47      * @param context Defines current compilation unit, position and a shared AST
48      * @param locations Problems are the current location.
49      * @return the corrections applicable at the location or <code>null</code> if no proposals
50      * can be offered
51      * @throws CoreException CoreException can be thrown if the operation fails
52      */

53     IJavaCompletionProposal[] getCorrections(IInvocationContext context, IProblemLocation[] locations) throws CoreException;
54
55 }
56
Popular Tags