eclipse-jdt

Reuse Eclipse's Plugin Manifest Editor

I want to have the PluginManifestEditor functionality in my view(not in a editor). Also I need to add some extra pages to it(along with the existing ones like Overview, Dependencies, runtime etc.). I know that its implemented in org.eclipse.pde.ui plugin. I just started diggin in to the code and found that the javadoc is sparse and not ...

How to make an Eclipse debug launcher that launches a Class

I'm trying to make an Eclipse launch configuration that I can launch programmatically, kind of building a custom debugger if you like. I've already got an org.eclipse.debug.core.launchConfigurationTypes extension, as well as .core.launchDelegates, .ui.launchConfigurationTabGroups and .core.sourcePathComputers extensions. I've got a bu...

Can I use eclipse JDT/EST for other programming languages?

Can I use the AST / JDT for other languages? for example to write my own parser for C# that uses somehow the AST technology? ...

Problem using the Eclipse Abtract Syntax Tree

I'm trying to use AST parser in a non-plugin environment. The code compiles, but I get the following runtime error: Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/resources/IResource at org.eclipse.jdt.core.dom.ASTParser.(ASTParser.java:189) at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java: 118...

Weird JavaCore IType cache problem

Hi, I'm developing a plugin that takes all enums in workspace that implements certain interface (IDomain) parses the code (Using AST) does some modification over the enum and marks it as processed with an annotation (@IDomainInfo). For example, it takes someting like this: public enum SomeEnum implements IDomain { // ... } And gene...

Adding method/variable declarations to org.eclipse.jdt.core.dom.CompilationUnit

Hi, i am trying to add method or variable declarations to org.eclipse.jdt.core.dom.CompilationUnit, but I can't figure out how to achieve that. If I am using CompilationUnit.types().add(...) the element is added as a sibling, not as a child element. I've really searched a lot now, but I don't believe it's such a big deal. Thanks for ...

Why does resolveBinding() return null even though I setResolveBindings(true) on my ASTParser?

I am writing an Eclipse plug-in that uses JDT AST's ASTParser to parse a method. I am looking within that method for the creation of a particular type of object. When I find a ClassInstanceCreation, I call getType() on it to see what type is being instantiated. I want to be sure that the fully-resolved type being dealt with there is t...

Is there a way to replace the Eclipse JDT's code completion list with a multi-level tree?

I know that the eclipse code completion widget can be customized to add new suggestions and even to change the order. I'm wondering whether there's a way to replace the current list format (or single-level tree, if this is a tree control) with a tree of multiple levels. Thus, for example, instead of selecting from a list of methods so...

Integrating Eclipse JDT Core into a new editor

I'm building a Java IDE and am trying to implement autocompletion or intellisense. After looking around for something that will do most of the work for me (not reinventing the wheel etc) I've pulled the code for Eclipse JDT core and am trying to figure out how to implement it in my own IDE. I'm obviously working under the assumption that...

Eclipse JDT: Call 'correct indentation' programmatically?

Hello folks, I am working on an Eclipse plugin that modifies Java code in a user's project. Basically the result of this plugin is that Java annotations are added to some methods, so void foo() { ... } becomes @MyAnnotation void foo() { ... } Except that it doesn't quite look like that; the indentation on the newly inserted anno...

How to find an anonymous class or a local type using the JDT Java Search Engine?

Hi, I want to programmatically get the model of an anonymous class or locally declared type (i.e. an instance of IType) from the JDT Java Search Engine, known by fully qualified name. So far, I did well with the following when searching for "usual" types that were not nested in other types: SearchPattern pattern = SearchPattern.createP...

What is the difference between javac and the Eclipse compiler?

I asked this in a comment, but figured it's a separate question: Is Eclipse's compiler just a wrapper around the same compiler core that the javac program is wrapped around, or is it a separate compiler altogether? If the latter, why would they reinvent the (possibly inferior) wheel? ...

Why is IJavaProject.findPackageFragmentRoots returning an empty array?

Every time I call IJavaProject.findPackageFragmentRoots(IClasspathEntry cpe) and pass it an IClasspathEntry of kind CPE_PROJECT, it returns an empty list. I paused the debugger and ran the following lines in the Eclipse Display view to see what was going on: IClasspathEntry cpe = javaProject.getRawClasspath()[8]; cpe.toString(); (ja...

Using Eclipse's JDT, how does one get an IType from a class name?

Is there a simple, straightforward way to get an IType from a class name? I think there must be some static method somewhere. Basically, I'd like to do something like: IType objectType = Somewhere.getType("java.lang.Object") Does anybody know of something like this? I have been searching in vain. ...

Eclipse autocomplete broken

Eclipse autocomplete is not working and is always telling me merely "No Default Proposals". This is true whether I try to autocomplete for code under java.util or in my own project. I'm running Eclipse 3.5.2 on Lucid Lynx using java-6-openjdk. Any ideas? ...

Eclipse Javadocs: How to *easily* create @see links?

I often want to use @see when writing classes & methods but I usually end up not doing so because it's so annoying trying to write out @see links by hand. Is there some easy way to do this, built into Eclipse JDT? ...

Getting field type in a method in eclipse

How do I programmatically get the field type from a statement inside a method like this : Foo foo = getSomeFoo(); If it is field, I can know the type of the element. ...

Is it possible to run the Eclipse JDT compiler from the command line, like javac?

I'd like to do some command-line Java compiling of individual Java source files on a machine that has Eclipse installed. However, I don't have permissions to install a full Java SDK on this machine. I understand that Eclipse compiles through its JDT, not using javac. Is is possible to use the Eclipse compiler from the command line? ...