Bug 125450 - Enable conditional loading of APT
Summary: Enable conditional loading of APT
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Martin Aeschlimann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-27 05:59 EST by Jerome Lanneluc CLA
Modified: 2006-02-10 05:39 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2006-01-27 05:59:34 EST
I20060125

When developping 1.4 code in Eclipse running on a 5.0 SDK the APT UI plug-in
gets loaded (activated state) through ContributedProcessorDescriptor#getProcessor(ICompilationUnit).. It should only be loaded when needed.

The JDT UI extension point should allow to express the required source level.

See also bug 125291.
Comment 1 Tom Hofmann CLA 2006-01-31 05:04:44 EST
ContributedProcessorDescriptor is part of the quick fix framework - what is the part jdt-text plays here?
Comment 2 Martin Aeschlimann CLA 2006-02-09 02:55:39 EST
I'll add that to the quickFixProcessor/quickAssistProcessor extension point
Comment 3 Martin Aeschlimann CLA 2006-02-09 13:34:36 EST
added a new property to test on: 'sourceCompliance'

      <quickFixProcessor
            name="%exampleQuickFixProcessor.name"
            class="org.eclipse.jdt.ui.examples.MyQuickFixProcessor"
            id="org.eclipse.jdt.ui.examples.MyQuickFixProcessor">
         <enablement>
	           <with variable="sourceCompliance">
	              <or>
	                 <equals value="'1.5'"/>
	                 <equals value="'1.6'"/>
	               </or>
	           </with>      
         </enablement>
      </quickFixProcessor>
Comment 4 Martin Aeschlimann CLA 2006-02-09 13:36:03 EST
(for the quickFixProcessor and for the quickAssistProcessor).

BTW, you can use this mechanism also to test on a project nature.
      <quickAssistProcessor
            name="%exampleQuickAssistProcessor.name"
            class="org.eclipse.jdt.ui.examples.MyQuickAssistProcessor"
            id="org.eclipse.jdt.ui.examples.MyQuickAssistProcessor">
         <enablement>
           <with variable="projectNatures">
              <iterate operator="or">
                 <equals value="org.eclipse.jdt.core.javanature"/>
              </iterate>
           </with>
         </enablement>
      </quickAssistProcessor>
Comment 5 Martin Aeschlimann CLA 2006-02-10 05:39:22 EST
I also added a direct attribute 'requiredSourceLevel' to quickFix/AssistProcessors
This is similar to what Ferome added for 'compilationParticipant.exsd' and should be preferred as it is more performant.

The enablement property is also still there, It can be used for more complex enablement expressions. But I renamed it to 'sourceLevel':

 <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.spelling"/>
   </handledMarkerTypes>
   <enablement>
      <with variable="projectNatures">
         <iterate operator="or">
            <equals value="org.eclipse.jdt.core.javanature"/>
         </iterate>
      </with>
   </enablement>
  </quickFixProcessor>
 </extension>