Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Extending PDT"

m (Code Assist)
m (Type inference hinting)
Line 11: Line 11:
 
In this case PDT type inference engine is unable to detect the type of $myObject variable, so we'll have to add a specific rule that helps him.
 
In this case PDT type inference engine is unable to detect the type of $myObject variable, so we'll have to add a specific rule that helps him.
  
org.eclipse.php.core.goalEvaluatorFactories extension point allows to provide additional rules to the PHP type inference engine. For example:
+
org.eclipse.php.core.goalEvaluatorFactories extension point allows to provide additional rules to the PHP type inference engine. For our example what we'll need to contribute is:
 +
 
 +
  <extension point="org.eclipse.php.core.goalEvaluatorFactories">
 +
      <factory
 +
            class="com.xyz.php.fmwrk.XYZGoalEvaluatorFactory"
 +
            priority="100">
 +
      </factory>
 +
  </extension>
 +
 
 +
Please note the priority is set to 100 in order to override the default PHP goal evaluator (its priority is 10).
  
 
=== CTRL + click ===
 
=== CTRL + click ===
 
=== Outline and PHP Explorer ===
 
=== Outline and PHP Explorer ===

Revision as of 04:45, 30 November 2009

Purpose

There are different purposes for extending PDT. One of them is adding support for specific PHP framework to the IDE features like: Code Assist, Navigation (CTRL + click), Presentation (Outline, PHP Explorer). In this document we'll describe how to achieve these goals using PDT extension points.

Extending

Code Assist

Type inference hinting

Suppose your framework uses the following language structure for object instantiation:

 $myObject = ClassRegistry::init('MyObject');

In this case PDT type inference engine is unable to detect the type of $myObject variable, so we'll have to add a specific rule that helps him.

org.eclipse.php.core.goalEvaluatorFactories extension point allows to provide additional rules to the PHP type inference engine. For our example what we'll need to contribute is:

 <extension point="org.eclipse.php.core.goalEvaluatorFactories">
     <factory
           class="com.xyz.php.fmwrk.XYZGoalEvaluatorFactory"
           priority="100">
     </factory>
  </extension>

Please note the priority is set to 100 in order to override the default PHP goal evaluator (its priority is 10).

CTRL + click

Outline and PHP Explorer

Back to the top