Created
April 19, 2014 21:24
-
-
Save samueltcsantos/11097956 to your computer and use it in GitHub Desktop.
Acessando o nomes dos pacotes com código fonte.
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 { | |
IWorkspace workspace = ResourcesPlugin.getWorkspace(); | |
IWorkspaceRoot 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){ | |
System.out.println("Package Name: " + myPackage.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