throws CoreException {
if (editorInput instanceof IFileEditorInput) {
final IFileEditorInput input = (IFileEditorInput) editorInput;
final IFile file = input.getFile();
final IErlModel model = ErlangEngine.getInstance().getModel();
IErlModule module = model.findModule(file);
if (module != null) {
return module;
}
final String path = file.getLocation().toPortableString();
module = model.getModuleFromFile(model, file.getName(), path,
file.getCharset(), path);
module.setResource(file);
return module;
}
if (editorInput instanceof ErlangExternalEditorInput) {
final ErlangExternalEditorInput erlangExternalEditorInput = (ErlangExternalEditorInput) editorInput;
return erlangExternalEditorInput.getModule();
}
final String path = getPathForInput(editorInput);
if (path == null) {
return null;
}
final IErlElementLocator model = ErlangEngine.getInstance().getModel();
final IErlModule module = ErlangEngine
.getInstance()
.getModelFindService()
.findModule(model, null, null, path,
IErlElementLocator.Scope.ALL_PROJECTS);
if (module != null) {