eclipse-jdt

Runtime error using the Eclipse Abstract Syntax Tree

…衆ロ難τιáo~ 提交于 2019-12-05 08:52:07
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) Here is the code I'm running: import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.dom.*; public class TestAST { private void runTest() { String helloStr ="\n"+ "public class HelloWorld {\n"+ "\n"+ " private String name=\"\"\n\n"+ " /*

Use JDT to get full method name

只谈情不闲聊 提交于 2019-12-05 08:45:38
I am new to eclipse plugin development and I am trying to convert a IMethod to a string representation of the full method name. I.E. my.full.package.ClassName.methodName(int param, String string) so far I have had to hand roll my own solution. Is there a better way? private static String getMethodFullName(IMethod iMethod) { String packageString = "[Default Package]"; try { IPackageDeclaration[] declarations = iMethod.getCompilationUnit().getPackageDeclarations(); if(declarations.length > 0) { packageString = declarations[0].getElementName(); } } catch (JavaModelException e) { } String

What does “Computing additional info” mean?

我们两清 提交于 2019-12-05 04:35:35
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 something meaningful. Maybe this bug is related: Bug 293856 - [Browser] "Computing additional info" lag during content assist executions Other than that: Disable the virus scanner for Eclipse files (projects and the folder where Eclipse is installed). On demand

JDT without Eclipse?

痴心易碎 提交于 2019-12-05 01:44:11
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 JDT library that provide the same API / functionality but work independently of Eclipse? Any help will be greatly appreciated. Thanks. The JDT is divided into two distinct parts. The parsing parts should all be in plugins which have no UI-dependencies at all. I

Eclipse Helios ignores breakpoints

可紊 提交于 2019-12-05 01:01:20
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. As you might have guessed, this isn't strictly a graphical problem ;) The breakpoints are simply ignored while debugging. The breakpoint's properties aren't helpful either. Any hint is very well appreciated! EDIT: I've tested different JDKs without success. I've successfully debugged projects in another workspace Okay, so it's not about the JDK or the installed plugins. Seems to be workspace

How to specifically suppress “Comparing identical expressions” in Eclipse-Helios JDT

只谈情不闲聊 提交于 2019-12-05 00:51:38
I tried annotating the enclosing method with @SuppressWarnings("compareIdentical") but this does not work (worse yet, the annotation results in its own Unsupported @SuppressWarnings("compareIdentical") warning!) I know that I can always use @SuppressWarnings("all") but that'd be more warning-suppression than I want. FWIW, I got the "compareIdentical" string from the "Warning Options" table in http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm (a hail-mary pass, to be sure). Thanks! The list of tokens that can be used inside an SuppressWarning

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

[亡魂溺海] 提交于 2019-12-04 11:43:57
问题 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 bring this project into Eclipse and have it compile in Eclipse such that the type bindings and variable bindings (nomenclature from Eclipse JDT) are correctly resolved. I

Why I got no super classes with getAllSuperclasses() in JDT API?

筅森魡賤 提交于 2019-12-04 09:01:39
I have class A, and class B that inherits A in Eclipse workspace. The issue that I have is that I got nothing when I tried to get the super types of type B using eclipse JDT API. This is the code (I got the code from - List all subclasses with fully qualified names ): IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); java.io.File workspaceDirectory = root.getLocation().toFile(); // 1. The name of the project in the workspace IProgressMonitor pm = new NullProgressMonitor(); IProject orig = root.getProject(this.projectName); orig.open(pm); this.javaProject = JavaCore.create(orig);

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

跟風遠走 提交于 2019-12-03 08:13:42
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 bring this project into Eclipse and have it compile in Eclipse such that the type bindings and variable bindings (nomenclature from Eclipse JDT) are correctly resolved. I need this because I need to run a static analysis on the code that is built on top of Eclipse JDT. The

How can I add an Eclipse Quick Fix for a custom Java marker?

柔情痞子 提交于 2019-12-03 05:59:09
问题 I'd like to report custom problems for Java files to the Problems View of Eclipse and provide Quick Fixes for them. The standard way to do is to use the extension point org.eclipse.core.resources.markers to declare a custom marker and add markers by calling org.eclipse.core.resources.IResource.createMarker(String) . Then, one can use the extension point org.eclipse.ui.ide.markerResolution to provide a Quick Fix for the custom markers. The above approach is a language-independent method of