Difference between revisions of "JDT Core Programmer Guide"

From Eclipsepedia

Jump to: navigation, search
m (JDT Core User Guide moved to JDT Core Programmer Guide: This is more for the implementation details than the usage details)
(Overview)
Line 1: Line 1:
 
= Overview =
 
= Overview =
[http://help.eclipse.org/indigo/index.jsp?nav=/3 JDT Core] in Eclipse Help
+
The purpose of this document is give insight into JDT Core internals.
  
[https://github.com/aupsy/org.eclipsecon2012.misc.tutorial/blob/master/Slides/How%20To%20Train%20the%20JDT%20Dragon%20combined.ppt How to Train the JDT Dragon] by Ayushman Jain and Stephan Herrmann
+
If you're looking for information on JDT APIs you'd better start from visiting [http://help.eclipse.org/indigo/index.jsp?nav=/3 JDT Core] section in Eclipse Help. You can also check [https://github.com/aupsy/org.eclipsecon2012.misc.tutorial/blob/master/Slides/How%20To%20Train%20the%20JDT%20Dragon%20combined.ppt How to Train the JDT Dragon] presentation by Ayushman Jain and Stephan Herrmann. Instructions for the tutorial can be found [https://github.com/aupsy/org.eclipsecon2012.misc.tutorial/tree/master/Handouts here].
 
+
JDT Tutorial from EclipseCon 2012 by Ayushman and Stephan is available on github - Please follow instructions here [https://github.com/aupsy/org.eclipsecon2012.misc.tutorial/tree/master/Handouts Tutorial handouts]
+
  
 +
If the answer to your question is neither there nor here, [http://wiki.eclipse.org/JDT/FAQ#If_your_question_is_not_answered_above ask the question].
 
== Java Model ==
 
== Java Model ==
 
Java model is a lightweight model for views.
 
Java model is a lightweight model for views.

Revision as of 07:12, 19 June 2012

Contents

Overview

The purpose of this document is give insight into JDT Core internals.

If you're looking for information on JDT APIs you'd better start from visiting JDT Core section in Eclipse Help. You can also check How to Train the JDT Dragon presentation by Ayushman Jain and Stephan Herrmann. Instructions for the tutorial can be found here.

If the answer to your question is neither there nor here, ask the question.

Java Model

Java model is a lightweight model for views.

Search Engine

Indexes of declarations, references and type hierarchy relationships.

Searching steps:

  1. Get the file names from indexes
  2. Parse the file and find out matching nodes
  3. Resolve types and narrow down matches reported from index
  4. Create the appropriate model element

Using the APIs, an example

Create a search pattern:

SearchPattern pattern = SearchPattern.createPattern(
 "foo(*) int", 
 IJavaSearchConstants.METHOD, 
 IJavaSearchConstants.DECLARATIONS, 
 SearchPattern.R_PATTERN_MATCH
);

Create a search scope:

IJavaSearchScope scope = SearchEngine.createWorkspaceScope();

Collect results using SearchRequestor subclass:

SearchRequestor requestor = new SearchRequestor() {
 public void acceptSearchMatch(SearchMatch match) {
   System.out.println(match.getElement());
 }
};

Start search:

new SearchEngine().search(
 pattern, 
 new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant()}, 
 scope, 
 requestor, 
 null /*progress monitor*/
);

AST

Precise, fully resolved compiler parse tree.