Bug 125974 Restrict Junit launch shortcut appearance in menu
The soon-to-be-attached patch improves the behavior for the Junit launch shortcut. It uses property tests from a lower level plug-in (jdt.launching), and adds a test to only appear for container when JUnit is on the buildpath.
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JavaTypeExtender.java
}
		if (javaElement != null) {
			if (PROPERTY_IS_Test.equals(method)) { 
				return isTest(javaElement);
			}
		}
		return false;
	}
	private boolean isTest(IJavaElement element) {
		try {
			IType testType = null;
			if (element instanceof ICompilationUnit) {
				ICompilationUnit cu = (ICompilationUnit) element;
				testType= cu.getType(Signature.getQualifier(cu.getElementName()));
			} else if (element instanceof IClassFile) {
					testType = ((IClassFile)element).getType();
			} else if (element instanceof IType) {
				testType = (IType) element;
			} else if (element instanceof IMember) {
				testType = ((IMember)element).getDeclaringType();
			}
			if (testType != null && testType.exists() && TestSearchEngine.isTestOrTestSuite(testType)) {
				return true;
			}
		} catch (JavaModelException e) {
		}
		return false;
	}	
}