protected internal override bool AllowPasteCommand()
{
IOleDataObject dataObject = null;
try
{
ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleGetClipboard(out dataObject));
if (dataObject == null)
{
return false;
}
// First see if this is a set of storage based items
var format = DragDropHelper.CreateFormatEtc(DragDropHelper.CF_VSSTGPROJECTITEMS);
if (dataObject.QueryGetData(new[] {format}) == VSConstants.S_OK)
return true;
// Try reference based items
format = DragDropHelper.CreateFormatEtc(DragDropHelper.CF_VSREFPROJECTITEMS);
if (dataObject.QueryGetData(new[] {format}) == VSConstants.S_OK)
return true;
// Try windows explorer files format
format = DragDropHelper.CreateFormatEtc(NativeMethods.CF_HDROP);
return dataObject.QueryGetData(new[] {format}) == VSConstants.S_OK;
}
// We catch External exceptions since it might be that it is not our data on the clipboard.
catch (ExternalException e)
{
Trace.WriteLine("Exception :" + e.Message);
return false;
}
}