Author: mareshkau
Date: 2008-10-08 09:21:36 -0400 (Wed, 08 Oct 2008)
New Revision: 10739
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java
Log:
=processing of url transfer was added, because when me make external drag&drop under
linux, we should processed this transfer
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java 2008-10-08
11:11:00 UTC (rev 10738)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/dnd/DndUtil.java 2008-10-08
13:21:36 UTC (rev 10739)
@@ -15,6 +15,7 @@
import org.eclipse.swt.events.TypedEvent;
import org.jboss.tools.common.model.ui.editors.dnd.context.DropContext;
import org.jboss.tools.common.model.ui.editors.dnd.context.IDNDTextEditor;
+import org.jboss.tools.vpe.editor.util.VpeDebugUtil;
import org.jboss.tools.vpe.xulrunner.XPCOM;
import org.mozilla.interfaces.nsIComponentManager;
import org.mozilla.interfaces.nsIDOMEvent;
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-10-08
11:11:00 UTC (rev 10738)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2008-10-08
13:21:36 UTC (rev 10739)
@@ -164,8 +164,8 @@
import org.mozilla.interfaces.nsISelectionListener;
import org.mozilla.interfaces.nsISupports;
import org.mozilla.interfaces.nsISupportsCString;
+import org.mozilla.interfaces.nsISupportsString;
import org.mozilla.xpcom.Mozilla;
-import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -2782,33 +2782,6 @@
return tagname;
}
- /**
- * Determine is nsIFile instance.
- *
- * @param support
- * @return
- */
- private boolean isNsIFileInstance(nsISupports support) {
- boolean rst = true;
-
- try {
- support.queryInterface(nsIFile.NS_IFILE_IID);
- } catch (XPCOMException e) {
- rst = false;
- }
- return rst;
- }
-
- private boolean isNsIStringInstance(nsISupports support) {
- boolean rst = true;
-
- try {
- support.queryInterface(nsISupportsCString.NS_ISUPPORTSCSTRING_IID);
- } catch (XPCOMException e) {
- rst = false;
- }
- return rst;
- }
public void externalDrop(nsIDOMMouseEvent mouseEvent, String flavor, String data) {
onHideTooltip();
@@ -2823,19 +2796,23 @@
// if(object == null)
nsISupports aValue = DndUtil.getDnDValue(mouseEvent);
- String aFlavor = "";
- if (isNsIFileInstance(aValue)) {
+ String aFlavor = ""; //$NON-NLS-1$
+ if (VpeDndUtil.isNsIFileInstance(aValue)) {
nsIFile aFile = (nsIFile) aValue.queryInterface(nsIFile.NS_IFILE_IID);
-
+
if (aValue != null) {
data = aFile.getPath();
aFlavor = DndUtil.kFileMime;
}
- } else if (isNsIStringInstance(aValue)) {
+ } else if (VpeDndUtil.isNsICStringInstance(aValue)) {
nsISupportsCString aString = (nsISupportsCString)
aValue.queryInterface(nsISupportsCString.NS_ISUPPORTSCSTRING_IID);
data = aString.getData();
aFlavor = DndUtil.kHTMLMime;
+ } else if (VpeDndUtil.isNsIStringInstance(aValue)) {
+ nsISupportsString aString = (nsISupportsString)
aValue.queryInterface(nsISupportsString.NS_ISUPPORTSSTRING_IID);
+ data = aString.getData();
+ aFlavor = DndUtil.kURLMime;
}
// if (object.getFileType() == XModelObject.FILE
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java 2008-10-08
11:11:00 UTC (rev 10738)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeDndUtil.java 2008-10-08
13:21:36 UTC (rev 10739)
@@ -19,20 +19,26 @@
import org.jboss.tools.common.model.ui.editor.IModelObjectEditorInput;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.vpe.VpePlugin;
+import org.mozilla.interfaces.nsIFile;
+import org.mozilla.interfaces.nsISupports;
+import org.mozilla.interfaces.nsISupportsCString;
+import org.mozilla.interfaces.nsISupportsString;
+import org.mozilla.xpcom.XPCOMException;
public class VpeDndUtil {
- public static boolean isDropEnabled(IModelObjectEditorInput input) {
- return DnDUtil.isPasteEnabled(input.getXModelObject());
+
+ public static boolean isDropEnabled(IModelObjectEditorInput input) {
+ return DnDUtil.isPasteEnabled(input.getXModelObject());
}
public static void drop(IModelObjectEditorInput input,
ISourceViewer viewer, ISelectionProvider provider) {
Properties properties = new Properties();
- properties.setProperty("isDrop", "true");
- properties.setProperty("actionSourceGUIComponentID", "editor");
- properties.setProperty("accepsAsString", "true");
- properties.put("selectionProvider", provider);
- properties.put("viewer", viewer);
+ properties.setProperty("isDrop", "true");
//$NON-NLS-1$//$NON-NLS-2$
+ properties.setProperty("actionSourceGUIComponentID", "editor");
//$NON-NLS-1$//$NON-NLS-2$
+ properties.setProperty("accepsAsString", "true");
//$NON-NLS-1$//$NON-NLS-2$
+ properties.put("selectionProvider", provider); //$NON-NLS-1$
+ properties.put("viewer", viewer); //$NON-NLS-1$
try {
DnDUtil.paste(input.getXModelObject(), properties);
@@ -41,5 +47,52 @@
VpePlugin.getPluginLog().logError(ex);
}
}
+
+ /**
+ * Determine is nsIFile instance.
+ *
+ * @param support
+ * @return
+ */
+ public static boolean isNsIFileInstance(nsISupports support) {
+ boolean rst = true;
+
+ try {
+ support.queryInterface(nsIFile.NS_IFILE_IID);
+ } catch (XPCOMException e) {
+ rst = false;
+ }
+ return rst;
+ }
+ /**
+ * Determine is csstring instance
+ * @param support
+ * @return
+ */
+ public static boolean isNsICStringInstance(nsISupports support) {
+ boolean rst = true;
+ try {
+ support.queryInterface(nsISupportsCString.NS_ISUPPORTSCSTRING_IID);
+ } catch (XPCOMException e) {
+ rst = false;
+ }
+ return rst;
+ }
+ /**
+ * Determine is string instance
+ * @param support
+ * @return
+ */
+ public static boolean isNsIStringInstance(nsISupports support) {
+ boolean rst = true;
+
+ try {
+ support.queryInterface(nsISupportsString.NS_ISUPPORTSSTRING_IID);
+ } catch (XPCOMException e) {
+ rst = false;
+ }
+ return rst;
+ }
+
}
Show replies by date