Author: estherbin
Date: 2008-09-04 13:49:42 -0400 (Thu, 04 Sep 2008)
New Revision: 10064
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java
Log:
Fixed
https://jira.jboss.org/jira/browse/JBIDE-2443
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java 2008-09-04
16:16:57 UTC (rev 10063)
+++
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/editors/dnd/DropUtils.java 2008-09-04
17:49:42 UTC (rev 10064)
@@ -11,6 +11,8 @@
package org.jboss.tools.common.model.ui.editors.dnd;
import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -156,21 +158,32 @@
* @return
*/
public static IFile getResourceForMimeData(DropData dropData) {
- URL newUrl = null;
- try {
- newUrl = new URL(dropData.getMimeData());
- } catch (MalformedURLException e) {
-// VpePlugin.reportProblem(e);
- ModelUIPlugin.getPluginLog().logError(e);
- }
- IFile file = EclipseResourceUtil.getFile(newUrl == null ? dropData.getMimeData() :
newUrl.getPath());
- if(file != null && file.exists()) return file;
- file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
- new Path(newUrl.getPath())
- );
- return file;
- }
+ // estherbin why in code below create url instance -?
+ // URL newUrl = null;
+ // URI newUri = null;
+ // try {
+ // newUri = new URI(dropData.getMimeData());
+ // // newUrl = new URL(dropData.getMimeData());
+ // } catch (URISyntaxException e) {
+ // ModelUIPlugin.getPluginLog().logError(e);
+ // }
+ IFile file = EclipseResourceUtil.getFile(dropData.getMimeData());
+
+ if (file == null || !file.exists()) {
+ URL newUrl = null;
+ try {
+ newUrl = new URL(dropData.getMimeData());
+ file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new
Path(newUrl.getPath()));
+ // newUrl = new URL(dropData.getMimeData());
+ } catch (MalformedURLException e) {
+ ModelUIPlugin.getPluginLog().logError(e);
+ }
+ file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new
Path(newUrl.getPath()));
+ }
+ return file;
+ }
+
/**
* Find WEB-ROOT container for given project
* @param project