jdt

JDT ASTParser to get the value of a string field

Is there a way to use jdt ASTParser to get the value of a String field declared in a java file. Actually what I need is to resolve any possible dependencies from other classes e.g. public String str = "somethig"+SomeTherClass.SOMETHING_ELSE. ...

Content Assist problem in eclipse 3.5 (solved)

I've got a Content Assist problem in eclipse 3.5, which is eclipse-java-galileo-win32.zip. When I press Alt+/(I've changed Ctrl+Space to this) in Java Editor, no assistant tips are shown up. I've solved this problem and I'd like to share my experience. Eclipse-->Preferences-->General-->Keys; Search 'Content Assist'; You'll find that ...

Place variable one context up in Eclipse JDT

I've been looking for the Eclipse JDT refactoring tool which allows me to quickly change if (...) { Object x = blablabla; } to Object x; if (...) { x = blablabla; } // insert code using x here But I can't find it. Does something like that exist? ...

How to programmatically specify JRE javadoc location in eclipse?

You can manually set it via _Package Explorer / JRE System Library / rt.jar -> contextmenu -> properties - Attach Javadoc.. And the settings are stored in .metadata.plugins\org.eclipse.core.runtime.settings\org.eclipse.jdt.launching.prefs. I wonder is there anyway I can programmatically specify it? Thanks a lot! ...

How to specify javaproject JDK version in eclipse plugins?

Any clue? Thanks a lot ...

Eclipse Helios ignores breakpoints

Eclipse is driving me nuts right now. It's probably something trivial but I just don't get it. Whenever I like to add a breakpoint, the regular icons are crossed out in the editor and breakpoints view. Here's a screenshot: As you might have guessed, this isn't strictly a graphical problem ;) The breakpoints are simply ignored while de...

How to generate class files manually in Eclipse plugin development?

I want to generate class files to some place(not the output folder in the build path) manually ,i found some classes like JavaBuilder,Compiler,IncrementalProjectBuilder,etc,but i still dont know how to use these classes to compile class files to a specified location.How to do this? Thanks. ...

How can I know in which IClasspathEntry an IJavaElement belongs to?

I have an IJavaElement and I wish to know which one of the IClasspathEntrys of an IJavaProject the element belongs to. I have a feeling that I'm missing something obvious, but I just couldn't find a simple solution to that. Thanks in advance for any forthcoming tips and answers. ...

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...

How do I get access to my java source model (from JDT) from a GEF editor?

I have a basic GEF editor where I want to use the model from the currently open/selected java source editor to display extra information, but I can't figure out how to get access to java model from inside my editor. Any ideas? I'm finding the Eclipse docs hard to navigate. ...

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? ...

Custom content assist template for java annotations on methods

In Eclipse 3.6, I can't seem to get the following content assist template to work: @Column(name="${cursor}") Whenever I try ctrl-spc on a start string such as @C it only shows me the usual type completions, no additional entries (like the one I see when starting a for for instance). The help seems to be light on detail on how the patt...

How do I browse JDT source code in eclipse?

My current attempt to browse the JDT source code in eclipse: installing Eclipse Helios RCP version. importing all plugins from installation as binary files into my workspace It does not work. ...

When to use becomeWorkingCopy in an eclipse plugin

We usually do this to make changed to a CompilationUnit. Question is do we alway have to call becomeWorkingCopy and then followed by discardWorkingCopy to make any changes to the CompilationUnit? ICompilationUnit testCU = findUnit(); testCU.becomeWorkingCopy(); // Do someting to testCU testCU.discardWorkingCopy(); ...

Incrementally compiling java source files

Hi , I want to compile my only changed changed java source files. I know that eclipse is doing this inside JDT plugin . But my question is that , is it possible to do without an eclipse installtion ? I meant is it possible to get a small subset of jars from eclipse plugins and use the Compiler from it to compile only changed java fi...

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. ...

Eclipse JDT: Is there a refactoring to replace direct field accesses with setter/getter methods?

I know I can generate setters and getters for fields in the Eclipse source menu, but I'm very surprised it doesn't offer to replace the direct field accessors with calls to the newly created methods. Does anyone know how to do this short of manual search and replace? Thanks! ...

Eclipse Extension Point for Updating the Classpath

Question Given a Classpath Container I've written as a plugin/extension, how do I add it to the classpath, automatically? Background Ok so I'm an experienced Java Developer but extremely new to writing Eclipse Plugins. I've been googling, following tutorials and reading source code of other plugins for a couple days. I know exactly ...