jdt

Can I use JDT to rename a working copy of a Java source file?

I'm using Eclipse JDT to build a Java refactoring platform, for exploring different refactorings in memory before choosing one and saving it. I can create working copies of the source files and edit them (for example to rename a type, using ASTRewrite), and I also want to rename one or more of the working copies. I'd hoped that the renam...

Can I use Eclipse JDT to create new 'working copies' of source files in memory only?

I'm using Eclipse JDT to build a Java refactoring platform, for exploring different refactorings in memory before choosing one and saving it. I can create collections of working copies of the source files, edit them in memory, and commit the changes to disk using the JDT framework. However, I also want to generate new 'working copy' sou...

How can i define a custom action for "Open Declaration" (shortcut F3) in Eclipse

How do i register an additional handler/action/command for "Open Declaration" (aka F3) in a plugin? I want to use F3 on String literals in Java code to navigate to the files declaring resource bundle keys. I already have a context menu action ready that does the job. All that's missing is a way to bind it to the key that users are used ...

Generate bytecode from Eclipse's CompilationUnit

I am not working on an Eclipse plug-in project; however, I use an external library that generates an instance of org.eclipse.jdt.core.dom.CompilationUnit. Is there a way to generate Java bytecode from it? Some searching revealed that CompilationUnit's are typically built by registering a custom builder for the Eclipse project, then lett...

In Eclipse, how to set JavaDoc URL on a classpath entry programmatically?

I have an Eclipse plugin, that among other things, can create a project and give it several classpath entries. This in and of itself works fine. These jars do not have source included in the, however there is a URL that can be used for Javadoc. I want to set this up programmatically for these classpath entries that the plug-in creates...

JDT without Eclipse?

Some time ago I wrote an Eclipse plugin which makes use of JDT to do some parsing. Now I am thinking of making a command-line version of this app. Naturally, I hope to reuse the parsing code, so I need to get JDT to work outside Eclipse. Is there any way I can accomplish this (maybe build some wrappers, etc)? Are there any ports of the J...

How do I set the Eclipse build path and class path from an Ant build file?

Hey folks, There's a lot of discussion about Ant and Eclipse, but no previously answered seems to help me. Here's the deal: I am trying to build a Java program that compiles successfully with Ant from the command-line. (To confuse matters further, the program I am attempting to compile is Ant itself.) What I really want to do is to br...

What does "Computing additional info" mean?

Eclipse Helios periodically starts running a job which displays "Computing additional info". During this time, Eclipse is very sluggish, bordering on unusable. What does this job do? Can I shut it off? I just hope that someone in the JDT team comes to sense and gets rid of it, make it go faster, or at the very least change it to somethi...

Eclipse JDT API documentation, preferrably CHM format

I am going to need to do some development with Eclipse JDT while on holiday. I will be off-line for the most of the time and therefore I will not be able to access the Eclipse JDT API documentation on the Web. I can't find a link to download the documentation in ZIP or PDF or, best of all, CHM format. Does anyone have a copy? Could you p...

How to install jdt.core in eclipse locally?

Hi all, I'm needing to install the eclipse JDT.Core plugin locally (eg download the file with site.xml etc), as opposed to installing it remotely due to the horrible firewall at work. Can anyone suggest where to download it so i can do the local install? Thanks ...

How to use ASTRewrite split one field declaration into two?

For example: private long p, q, g, h; I want to split this field declaration as: private long p; private long q, g, h; How can I use ASTRewrite to do it? I tried to use ASTNode copyFd = rewriter.createCopyTarget(fd) to copy the field declaration, modify it, then add to field declaration list, but my modification on copyFd is not ...

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

Simplifying fully qualified names in Eclipse

Does someone know a plugin for Eclipse that replaces fully qualified Java class names with the simple one and the corresponding import where possible? It would be even better if it could be performed as a Save Action. ...

Get the value of a selected java field in a eclipse view.

Hi, I making a eclipse view that is working with selected elements from other views. Let say I have opened a java file in the editor that has the following fields in it: private String world = " world!" private String hello = "hello" + world; When I select "hello" in the Outline view I'm able to get IFiled selection and I have access to...

Unable to incorporate Eclispe JDT codeAssist facilities outside a Plug-in

Using Eclipse jdt facilities, you can traverse the AST of java code snippets as follows: ASTParser ASTparser = ASTParser.newParser(AST.JLS3); ASTparser.setSource("package x;class X{}".toCharArray()); ASTparser.createAST(null).accept(...); But when trying to perform code complete & code selection it seems that I have to do it in a plug...

Is there any way to run eclipse plug-in applications without fully start the eclipse platform

Consider a simple "Hello world" plug-in, how can I run it without having to fully launch the eclipse platform? ...

eclipse: calling organizeimports programmatcally

Hi, I'm trying to execute 'OrganizeImports' programmatically on files that I'm editing programmatically. My code looks like this: final ICommandService cmdService = (ICommandService)PlatformUI.getWorkbench().getService (ICommandService.class); if (cmdService != null) { final Command cmd = cmdService.getCommand(IJavaE...

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

Eclipse project artefacts in Maven repository

I want to use some of the libraries produced by the Eclipse project through Maven. I 've had a look at the main Maven repo and while it looks like that there are a few projects already imported, their versions are old and some important ones are missing (e.g. cdt). Is there any Eclipse project official Maven repository? If not, what woul...