} else if (selected[i] instanceof LogicalPackage) { IPackageFragment[] packageFragments= ((LogicalPackage)selected[i]).getFragments(); for (int k= 0; k < packageFragments.length; k++) collectCompilationUnits(packageFragments[k], result);
	private ICompilationUnit[] getCompilationUnits(IStructuredSelection selection) {		HashSet result= new HashSet();		Object[] selected= selection.toArray();		for (int i= 0; i < selected.length; i++) {			try {				if (selected[i] instanceof IJavaElement) {					IJavaElement elem= (IJavaElement) selected[i];					switch (elem.getElementType()) {						case IJavaElement.COMPILATION_UNIT:							result.add(elem);							break;						case IJavaElement.IMPORT_CONTAINER:							result.add(elem.getParent());							break;						case IJavaElement.PACKAGE_FRAGMENT:							collectCompilationUnits((IPackageFragment) elem, result);							break;						case IJavaElement.PACKAGE_FRAGMENT_ROOT:							collectCompilationUnits((IPackageFragmentRoot) elem, result);							break;						case IJavaElement.JAVA_PROJECT:							IPackageFragmentRoot[] roots= ((IJavaProject) elem).getPackageFragmentRoots();							for (int k= 0; k < roots.length; k++) {								collectCompilationUnits(roots[i], result);							}							break;								}				}			} catch (JavaModelException e) {				JavaPlugin.log(e);			}		}		return (ICompilationUnit[]) result.toArray(new ICompilationUnit[result.size()]);	}