if (element instanceof IAdaptable) {
ICompilationUnit compilationUnit =
(ICompilationUnit)((IAdaptable)element).getAdapter(ICompilationUnit.class);
if (compilationUnit != null) {
IType type = compilationUnit.findPrimaryType();
ILaunchConfiguration launchConfiguration = getExistingLaunchConfiguration(type);
if (launchConfiguration == null) {
launchConfiguration = createLaunchConfiguration(type);
}