Created
April 19, 2014 22:12
-
-
Save samueltcsantos/11099177 to your computer and use it in GitHub Desktop.
Como listar ao nomes de todos os métodos em um projeto.
This file contains 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
/** | |
* the command has been executed, so extract extract the needed information | |
* from the application context. | |
* | |
* @see {https://github.com/samueltcsantos/eclipse-jdt} | |
* | |
*/ | |
public Object execute(ExecutionEvent event) throws ExecutionException { | |
workspace = ResourcesPlugin.getWorkspace(); | |
root = workspace.getRoot(); | |
IProject[] projects = root.getProjects(); | |
for (IProject project : projects){ | |
try { | |
IJavaProject javaProject = createIJavaProject(project); | |
for (IPackageFragment myPackage : getProjectPackages(javaProject)){ | |
//only at the package from the source folder | |
if (myPackage.getKind() == IPackageFragmentRoot.K_SOURCE){ | |
ICompilationUnit [] units = getCompilationUnits(myPackage); | |
for (ICompilationUnit unit: units){ | |
IType [] types = getITypes(unit); | |
for (IType type : types){ | |
for (IMethod method : getIMethods(type)){ | |
System.out.println(method.getElementName()); | |
} | |
} | |
} | |
} | |
} | |
} catch (CoreException e) { | |
e.printStackTrace(); | |
} | |
} | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment