File f = (File) itemPointer.file;
String filename = f.getName();
if (PythonPathHelper.isValidSourceFile(filename) || filename.indexOf('.') == -1 || //treating files without any extension!
(itemPointer.zipFilePath != null && PythonPathHelper.isValidSourceFile(itemPointer.zipFilePath))) {
final PyOpenAction openAction = (PyOpenAction) pyEdit.getAction(PyEdit.ACTION_OPEN);
openAction.run(itemPointer);
} else if (itemPointer.definition instanceof JavaDefinition) {
//note that it will only be able to find a java definition if JDT is actually available
//so, we don't have to care about JDTNotAvailableExceptions here.
JavaDefinition javaDefinition = (JavaDefinition) itemPointer.definition;
OpenAction openAction = new OpenAction(pyEdit.getSite());
StructuredSelection selection = new StructuredSelection(new Object[] { javaDefinition.javaElement });
openAction.run(selection);
} else {
String message;
if (itemPointer.definition != null && itemPointer.definition.module instanceof AbstractJavaClassModule) {
AbstractJavaClassModule module = (AbstractJavaClassModule) itemPointer.definition.module;
message = "The definition was found at: " + f.toString() + "\n" + "as the java module: "