/// <summary> /// Clears our current copy/cut state - happens after a paste /// </summary> private void ClearCopyCutState() { _copyCutState = CopyCutState.None; }
/// <summary> /// Handle the Copy operation to the clipboard /// </summary> protected internal int CopyToClipboard() { int returnValue = (int)OleConstants.OLECMDERR_E_NOTSUPPORTED; this.RegisterClipboardNotifications(true); // Create our data object and change the selection to show item(s) being copy IOleDataObject dataObject = this.PackageSelectionDataObject(false); if (dataObject != null) { _copyCutState = CopyCutState.Copied; // Add our copy item(s) to the clipboard Site.GetClipboardService().SetClipboard(dataObject); // Inform VS (UiHierarchyWindow) of the copy IVsUIHierWinClipboardHelper clipboardHelper = (IVsUIHierWinClipboardHelper)GetService(typeof(SVsUIHierWinClipboardHelper)); if (clipboardHelper == null) { return VSConstants.E_FAIL; } returnValue = ErrorHandler.ThrowOnFailure(clipboardHelper.Copy(dataObject)); } return returnValue; }