eclipse-jdt

Programming Java 8 in Eclipse

丶灬走出姿态 提交于 2019-11-29 02:02:28
问题 The development of Eclipse support for Java 8 is ongoing in a branch (http://wiki.eclipse.org/JDT_Core/Java8). To try out the current Eclipse support for Java 8, I did the following: I installed a build of JDK 8 (This step is optional). I checked out branch BETA_JAVA8 of git://git.eclipse.org/gitroot/jdt/eclipse.jdt.core.git . I imported the checked out projects in an instance of Eclipse Juno SR1 (Build ID: 20120920-0800). I ran a new instance of Eclipse from my running Eclipse. To use the

How can I add build path items to Eclipse 3.5 using relative paths?

喜欢而已 提交于 2019-11-29 00:42:59
问题 Eclipse 3.5 added support for relative buildpath/classpath items, yet I cannot seem to find a graphical way to add relatively pathed items. The example in new and noteworthy (search the page for 'relative', about 40% of the way down) seems to indicate that I have to manually edit the .classpath file. Am I just missing something? Edit 2015: Updated link as it had went away. To preserve the "new and noteworthy" indefinitely, here's a screenshot of the mentioned section. 回答1: The actual way to

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

拜拜、爱过 提交于 2019-11-28 23:04:52
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! There is a way. Focus on the attribute, right click. Select "Refactor" -> "Encapsulate Field". (Edited to explain why it works, even though the menu's title doesn't imply it) The "Encapsulate Field" dialog-box will create getters/setters for you if they don't exist, and will change field-access to go through the getters

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

我们两清 提交于 2019-11-28 13:37:32
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 called setResolveBindings(true) on my ASTParser . I gave my ASTParser (via setSource() ) the

How do I disable auto-indent in Eclipse Helios (Java)?

旧巷老猫 提交于 2019-11-28 09:05:52
问题 I swear I looked everywhere, and disabled almost everything (insertion of matching brackets etc), but when I type an opening brace and hit enter, it auto-indents the next line with a tab. Is there a way to disable this "handy" "commodity"? 回答1: From the menu go to Project > Properties Select Java Code Style > Formatter Check the box for Enable project specific settings OR click Configure Workspace Settings Click the Edit... button for the active profile On the Indentation tab uncheck all of

Quick fix many problems at once

↘锁芯ラ 提交于 2019-11-27 21:48:11
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) 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 editor and wait for a popup; it should say "fix 70 other errors of this type". Doing it this way applies only

Eclipse shows empty error message with Java 9

拈花ヽ惹草 提交于 2019-11-27 19:31:04
问题 I have installed the Java 9 plugin. My project hasn't changed, but when I try to run, I get this: If you need anything else, feel free to comment that you don't have enough info. My .log file: https://pastebin.com/SQXZVcQk 回答1: Seems like a configuration issue as per my understanding. There are two possible causes/solution to it: From the logs: Root exception: java.lang.ExceptionInInitializerError at com.jniwrapper.util.ProcessorInfo.b(SourceFile:95) Caused by: com.jniwrapper

Eclipse create CompilationUnit from .java file

怎甘沉沦 提交于 2019-11-27 15:42:14
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. 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 workspace = ResourcesPlugin.getWorkspace(); IWorkspaceRoot root = workspace.getRoot(); // Get all projects in the

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

对着背影说爱祢 提交于 2019-11-27 14:30:46
问题 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! 回答1: There is a way. Focus on the attribute, right click. Select "Refactor" -> "Encapsulate Field". (Edited to explain why it works, even though the menu's title doesn't imply it) The "Encapsulate Field" dialog-box will

Install Eclipse JDT on top of CDT

非 Y 不嫁゛ 提交于 2019-11-27 11:10:52
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? John Paulett 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://download.eclipse.org/releases/galileo "), and under the Programming Languages section,