public object Copy(IGraphClipboardContext context, IModelItem item) { INode node = (INode)item; // If we are a Node with at least one label, we // store a variant of the label text (see CopyItem // implementation) if (node.Labels.Count > 0) { return(new CopyItem(node.Labels[0].Text)); } else { return(null); } }
/// <summary> /// Copies the node style for the paste-operation because <see cref="RotatableNodeStyleDecorator"/> should not be shared. /// </summary> public void Paste(IGraphClipboardContext context, IModelItem item, object userData) { var node = item as INode; if (node == null) { return; } var styleWrapper = node.Style as RotatableNodeStyleDecorator; if (styleWrapper != null) { if (context.TargetGraph.GetFoldingView() != null) { context.TargetGraph.GetFoldingView().Manager.MasterGraph.SetStyle(node, styleWrapper.Clone() as INodeStyle); } else { context.TargetGraph.SetStyle(node, styleWrapper.Clone() as INodeStyle); } } }
/// <summary> /// Adds no additional state to the cut-operation. /// </summary> public object Cut(IGraphClipboardContext context, IModelItem item) { return(null); }
/// <summary> /// Returns whether or not to pasting of the given item is possible. /// </summary> public bool ShouldPaste(IGraphClipboardContext context, IModelItem item, object userData) { return(true); }
/// <summary> /// Returns whether or not to cutting the given item is possible. /// </summary> public bool ShouldCut(IGraphClipboardContext context, IModelItem item) { return(true); }
public object Cut(IGraphClipboardContext context, IModelItem item) { // We do the same for Cut, since it's essentially just a Copy and Delete in succession. return(Copy(context, item)); }