public static IEditorInput checkInput(IEditorInput input) {
   if (input instanceof IModelObjectEditorInput) return input;
   if (input instanceof ILocationProvider) return convertExternalInput((ILocationProvider) input);
   if (input instanceof IFileEditorInput) return convertFileInput((IFileEditorInput) input);
   if (input instanceof IStorageEditorInput)
     return convertStorageEditorInput((IStorageEditorInput) input);
   if (input instanceof IURIEditorInput) {
     URI uri = ((IURIEditorInput) input).getURI();
     String f = uri.getPath();
     XModelObject o = EclipseResourceUtil.createObjectForLocation(f);
     return (o == null || o.getFileType() != XModelObject.FILE)
         ? (IEditorInput) input
         : new ModelObjectLocationEditorInput(getMainObject(o), new Path(f));
   }
   return input;
 }
 private static IEditorInput convertExternalInput(ILocationProvider input) {
   XModelObject o = EclipseResourceUtil.createObjectForLocation(input.getPath(input).toString());
   return (o == null || o.getFileType() != XModelObject.FILE)
       ? (IEditorInput) input
       : new ModelObjectLocationEditorInput(getMainObject(o), input.getPath(input));
 }