Committer Status

Posted by Mike Haller on Tuesday, June 10. 2008 at 23:20 in Eclipse
After doing some paperwork, I got my full Eclipse Committer Status to the technology.soc projec today.

Java Code Generation with Eclipse and AST

Posted by Mike Haller on Sunday, June 8. 2008 at 23:52 in Eclipse
As Mateusz asked for how to add Newlines to generated code in Eclipse, i looked at how Eclipse JDT is doing it. And of course, the Eclipse guys eat their own dog food and use the abstract syntax tree (AST) feature.

For a showcase, let's assume we've got an open Java Editor with an empty class and we want to add a new method. For the sake of simplicity for the demo, i'm going to implement it in an action and use the current editor as target. That's not nice, but pretty simple for now:
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
IWorkbenchPage page = window.getActivePage();
IEditorPart editor = page.getActiveEditor();
IEditorInput input = editor.getEditorInput();
IJavaElement element = JavaUI.getEditorInputJavaElement(input);

About

My name is Mike Haller and I'm a software developer and architect at Innovations Software Technology in Germany. I love programming, playing games and reading books. I like good food, making photos and learning and mentoring about the craftsmanship of commercial software development.

Quicksearch