Author: scabanovich
Date: 2007-09-18 06:33:18 -0400 (Tue, 18 Sep 2007)
New Revision: 3679
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/core/resources/XModelObjectEditorInput.java
Log:
JBIDE-905
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/core/resources/XModelObjectEditorInput.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/core/resources/XModelObjectEditorInput.java 2007-09-18
10:09:23 UTC (rev 3678)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/core/resources/XModelObjectEditorInput.java 2007-09-18
10:33:18 UTC (rev 3679)
@@ -10,7 +10,12 @@
******************************************************************************/
package org.jboss.tools.common.core.resources;
+import java.io.File;
import java.lang.reflect.Field;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -166,7 +171,26 @@
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 IStorageEditorInput) return
convertStorageEditorInput((IStorageEditorInput)input);
+ if(input instanceof IURIEditorInput) {
+ URI uri = ((IURIEditorInput)input).getURI();
+ URL url = null;
+ try {
+ url = uri.toURL();
+ } catch (MalformedURLException e) {
+ return input;
+ }
+ if(url == null) return input;
+ String f = url.getFile();
+ XModelObject o = null;
+ try {
+ o = EclipseResourceUtil.createObjectForLocation(f);
+ if(o != null && o.getFileType() != XModelObject.FILE) o = null;
+ } catch (Exception e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ return (o == null) ? (IEditorInput)input : new
ModelObjectLocationEditorInput(getMainObject(o), new Path(f));
+ }
return input;
}