# Quick Fix Processor

###### Identifier:

org.eclipse.jdt.ui.quickFixProcessors

###### Since:

Extension point since 3.0. Element `handledMarkerTypes` since 3.2.

###### Description:

This extension point allows to add a Quick Fix processor to offer new Quick Fixes on Java problems.

Since 3.2, an extension can specify which problem marker types it can handle. It will only get problems of these types to process. If no handled marker types are specified, the processor will only get problems of types org.eclipse.jdt.core.problem, org.eclipse.jdt.core.buildpath_problem and org.eclipse.jdt.core.task (compatible to the behaviour prior to 3.2).

This extension point supports the `<enablement>` element. The default variable is the containing `org.eclipse.jdt.core.ICompilationUnit`.
Defined variables for `<with>` expressions are:

- "compilationUnit": type `org.eclipse.jdt.core.ICompilationUnit`; the compilation unit the quick assist is applied on (same as the default variable)
- "projectNatures": type `java.util.Collection<String>`; all project natures of the current project
- "sourceLevel": type `java.lang.String`; the source compliance level of the current project

###### Configuration Markup:

<!ELEMENT extension (quickFixProcessor+)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

- point - a fully qualified identifier of the target extension point
- id - an optional identifier of the extension instance
- name - an optional name of the extension instance

<!ELEMENT quickFixProcessor (enablement? , handledMarkerTypes*)>

<!ATTLIST quickFixProcessor

id CDATA #REQUIRED

name CDATA #IMPLIED

class CDATA #REQUIRED

requiredSourceLevel CDATA #IMPLIED>

- id - a unique identifier for the Quick Fix processor
- name - a localized name of the Quick Fix processor
- class - the name of the class that implements this Quick Fix processor. The class must be public and implement `org.eclipse.jdt.ui.text.java.IQuickFixProcessor` with a public 0-argument constructor.
- requiredSourceLevel - an optional attribute to specify the minimal source compliance this processor requires

<!ELEMENT handledMarkerTypes (markerType+)>

Specifies the marker types of the problems this quick fix processor can handle. If no handled marker type are specified, the processor will get problems of types org.eclipse.jdt.core.problem, org.eclipse.jdt.core.buildpath_problem and org.eclipse.jdt.core.task.

<!ELEMENT markerType EMPTY>

<!ATTLIST markerType

id IDREF #REQUIRED>

- id - the marker type id of the marker type that can be handled by this processor. The processor will not handle marker subtypes.

###### Examples:

The following is an example of a Quick Fix processor contribution:

     <extension point="org.eclipse.jdt.ui.quickFixProcessors">
      <quickFixProcessor
       id="AdvancedQuickFixProcessor"
       name="Advanced Quick Fix Processor"
       requiredSourceLevel="1.5"
       class="com.example.AdvancedQuickFixProcessor">
       <handledMarkerTypes>
          <markerType id="org.eclipse.myplugin.audits"/>
       </handledMarkerTypes>
       <enablement>
          <with variable="projectNatures">
             <iterate operator="or">
                <equals value="org.eclipse.jdt.core.javanature"/>
             </iterate>
          </with>
       </enablement>
      </quickFixProcessor>
     </extension>

###### API Information:

The contributed class must implement `org.eclipse.jdt.ui.text.java.IQuickFixProcessor`

Copyright (c) 2001, 2013 IBM Corporation and others.
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-v20.html/ SPDX-License-Identifier: EPL-2.0