Last active
January 2, 2016 09:58
-
-
Save DinisCruz/8286163 to your computer and use it in GitHub Desktop.
Examples of SWT AST manipulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def inputJavaElement = eclipse.editors.compilationUnits().first().getInputJavaElement() | |
| def compilationUnit = inputJavaElement.getCompilationUnit(); | |
| def type = compilationUnit.getTypes()[0]; | |
| def method = type.getMethods()[0]; | |
| //inspect(method) | |
| return method.source; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def javaCompilationUnit = eclipse.editors.javaCompilationUnit("TeamMentorAPI.java"); | |
| //def compilationUnit = javaCompilationUnit.compilationUnit(); | |
| //inspect(compilationUnit) | |
| def types = javaCompilationUnit.types(); | |
| def methods = javaCompilationUnit.methods(); | |
| def methodNames = javaCompilationUnit.method_Names(); | |
| def method = javaCompilationUnit.method("open_Article"); | |
| def source = javaCompilationUnit.method_Source("open_Article"); | |
| return source |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment