Projects Tools Projects Hosted Projects
|
How to get the java projects?IJavaProject javaProject = (IJavaProject) .org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getProjects() How to invoke a wizard (and pass some parameters to it) after the completion of another wizard ?If so, the last page of you first first simply needs to return the firstpage of the second wizard when asked (getNextPage()). Note, you'll need to create an instance of the second wizard and call addPages() on it once (and only once). Simon I have an IFile in hand (for a .java file). How do I get access to some java information (types declared in that file etc.)?Use org.eclipse.jdt.core.JavaCore::create(IFile). This will give you an ICompilationUnit.How to search programatically for references to a given class/method etc. ?Use class SearchEngine from org.eclipse.jdt.core plugin.How to programatically format a fragment of code?Use the ToolFactory class from org.eclipse.jdt.core plugin to get ICodeFormatter.How to create an Abstract Syntax Tree for a given ICompilationUnit?Use the ASTParser class from the org.eclipse.jdt.core plugin (AST class for parsing CompilationUnits is deprecated).How to scan code for method comments?Use ISourceReference::getSourceRange to get the method code range and thenuse IScanner to find the exact offsets for the beginning and start of the comments. How do I instantiate a class from the runtime workspace?You shouldn't. It would be very dangerous if you did this, since the class would run code in the same VM that Eclipse is running in. Imagine what would happen if it has a static initializer that does a System.exit(0)! How do I programmatically, create a class, set it's superclass, add a constructor and a method, then "Organize Imports", format the source, and write out the resulting .java file? Last Modified 6/21/06 10:31 AM | Hide Tools |