eclipse-jdt

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

寵の児 提交于 2019-11-27 07:48:12
问题 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 the one I think it is, so I tell the resultant Type object to resolveBinding() . I get null back even though there are no compilation errors and even though I

VariableDeclarationFragment node resolveBindind() returns null in eclipse/jdt/ast

社会主义新天地 提交于 2019-11-27 04:51:22
问题 I'm trying to try out eclipse jdt/ast following this article. This is the java code as an input: class Hello { int hello() { int a = 0, b = 3; /* hello */ { b = a * 3; } return a; } public static void main(String[] args) { int z = 0, i = 3; /* hello */ { i = z * 3; } } } With ASTView, it shows that VariableDeclarationFragment has corresponding binding. However, in this visitor code for VariableDeclarationFragment node , I always get null value for 4 local variables (a,b,z,i) as resolveBinding

Quick fix many problems at once

感情迁移 提交于 2019-11-26 23:06:05
问题 Is it possible to quick fix all errors in a class opened in Eclipse? I have 71 errors that are pretty much the same, I would rather not do it one-by-one. (Note: I am quick fixing a Java file) 回答1: Often, you can fix errors en masse. There are several ways. I recommend going to your Problems view, selecting one of the errors, and hitting Ctrl-1 (quick fix). It should offer you the chance to fix all the errors of the selected type, in all files. You can also mouse over the error in the text

Eclipse + Java 8 support?

雨燕双飞 提交于 2019-11-26 22:20:37
How can I get Java 8 to work with Eclipse? I have followed this guide but doesn't work. I've also seen the Eclipse Java 8 wiki page , but they don't explain what to do with the checked out git repositories. For Kepler SR2 (4.3.2) a feature patch needs to be installed in order to get JAVA 8 support. Follow these steps: Eclipse - Help (MENU) > Install New Software... enter the following URL into the 'Work with' field: http://download.eclipse.org/eclipse/updates/4.3-P-builds/ press 'Enter' select category 'Eclipse Java 8 Support (for Kepler SR2)' click 'Next' click 'Next' accept the license click

Install Eclipse JDT on top of CDT

佐手、 提交于 2019-11-26 22:20:04
问题 I have the eclipse CDT installed, and I would like to install Java development functionality (JDT) on top of my CDT installation. I've been Googling from an hour but I can't figure out how to do this. What plugin do I need to install? What update site do I need to use? 回答1: All versions of Eclipse have a standard base, then a specific set of plugins, depending on the version. All you have to do is go to the Help > Install New Software menu, select the Eclipse update site (e.g. "Galileo - http

Eclipse create CompilationUnit from .java file

我们两清 提交于 2019-11-26 17:16:11
问题 How can I load a .java file into a CompilationUnit? For example, lets say I have a A.java file in my current project. I would like to load it into a CompilationUnit and then pass it to the ASTParser. It is not an option just to load it as a plain text since it seems that in that case I will not get the binding information in the AST. 回答1: You can load the projects using jdt and eclipse core libraries. Using the following code you can load all the projects in the workspace. IWorkspace

Break when exception is thrown

ε祈祈猫儿з 提交于 2019-11-26 10:13:07
Visual Studio has an option to break automatically into the debugger when an unhandled exception is thrown, does Eclipse have similar functionality? You are able to define the precise list of Exception you want to have a breakpoint on, even if those exceptions are uncaught (which should be the equivalent of " unhandled ") Go to the breakpoints window, there's a button that looks like J!, there you can set breakpoints for Java exceptions, either caught or uncaught. You can reference classes or use pattern matchers for exception names. Also, under Window -> Preferences, Select Java -> Debug and

Eclipse + Java 8 support?

假装没事ソ 提交于 2019-11-26 09:38:44
问题 How can I get Java 8 to work with Eclipse? I have followed this guide but doesn\'t work. I\'ve also seen the Eclipse Java 8 wiki page, but they don\'t explain what to do with the checked out git repositories. 回答1: For Kepler SR2 (4.3.2) a feature patch needs to be installed in order to get JAVA 8 support. Follow these steps: Eclipse - Help (MENU) > Install New Software... enter the following URL into the 'Work with' field: http://download.eclipse.org/eclipse/updates/4.3-P-builds/ press 'Enter

Break when exception is thrown

安稳与你 提交于 2019-11-26 02:06:00
问题 Visual Studio has an option to break automatically into the debugger when an unhandled exception is thrown, does Eclipse have similar functionality? 回答1: You are able to define the precise list of Exception you want to have a breakpoint on, even if those exceptions are uncaught (which should be the equivalent of " unhandled ") 回答2: Go to the breakpoints window, there's a button that looks like J!, there you can set breakpoints for Java exceptions, either caught or uncaught. You can reference