Exemple #1
0
        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            切り取りToolStripMenuItem.Enabled        = areaControl.CanCut;
            コピーToolStripMenuItem.Enabled         = areaControl.CanCopy;
            貼り付けToolStripMenuItem.Enabled        = areaControl.CanPaste;
            リンクも貼り付けToolStripMenuItem.Enabled    = areaControl.CanPaste;
            削除ToolStripMenuItem.Enabled          = areaControl.CanRemoveSelected;
            バインドコメントを追加ToolStripMenuItem.Visible = areaControl.CanAddBoundComment;
            バインドコメントを削除ToolStripMenuItem.Visible = areaControl.CanRemoveBoundComment;
            スコープを削除ToolStripMenuItem.Visible     = areaControl.CanRemoveScopeAt(areaControl.MouseRightDownPos.X, areaControl.MouseRightDownPos.Y);
            var canSelectSourceAndCommentInScopeAt = areaControl.CanSelectSourceAndCommentInScopeAt(areaControl.MouseRightDownPos.X, areaControl.MouseRightDownPos.Y);

            スコープ内の要素を選択ToolStripMenuItem.Visible   = canSelectSourceAndCommentInScopeAt;
            スコープ内の全要素を選択ToolStripMenuItem.Visible  = canSelectSourceAndCommentInScopeAt;
            ブレイクポイントを設定ToolStripMenuItem.Visible   = areaControl.CanSetBreakPoint;
            ブレイクポイントを解除ToolStripMenuItem.Visible   = areaControl.CanUnsetBreakPoint;
            リンクしているノードを検索ToolStripMenuItem.Visible = areaControl.CanFindLinkedItem(areaControl.MouseRightDownPos.X, areaControl.MouseRightDownPos.Y);
            var canCopyNodeName = areaControl.CanGetNodeName(areaControl.MouseRightDownPos.X, areaControl.MouseRightDownPos.Y);

            ノード名をコピーToolStripMenuItem.Visible = canCopyNodeName;
            var canCopyPropertyName = areaControl.GetNodeAndPropertyName(areaControl.MouseRightDownPos.X,
                                                                         areaControl.MouseRightDownPos.Y, out string nodeName, out string propertyName, out string propertyValue);

            プロパティ名をコピーToolStripMenuItem.Visible = canCopyPropertyName;
            toolStripSeparator3.Visible         = canCopyNodeName || canCopyPropertyName;
        }