示例#1
0
        private static IEnumerable <object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            // Grab all SLED document plugins
            var docPlugins = SledServiceInstance.GetAll <ISledDocumentPlugin>();

            // Collect popup commands from SLED document plugins
            var commandTags = new List <object>();

            foreach (var docPlugin in docPlugins)
            {
                var lstCommandTags = docPlugin.GetPopupCommandTags(args);
                if (lstCommandTags == null)
                {
                    continue;
                }

                commandTags.AddRange(lstCommandTags);
                commandTags.Add(null);
            }

            if (commandTags.Count > 0)
            {
                commandTags.RemoveAt(commandTags.Count - 1); // trim last null
            }
            return(commandTags);
        }
示例#2
0
        public IList <object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            if (m_customScriptRegistrationWorking)
            {
                var items = new List <object> {
                    Command.GotoDefinition, Command.GotoReference
                };
                return(items);
            }

            return(null);
        }
示例#3
0
        public IList <object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            var commands =
                new List <object>
            {
                Command.Goto,
                null,
                StandardCommand.EditCut,
                StandardCommand.EditCopy,
                StandardCommand.EditPaste,
                StandardCommand.EditDelete,
                null,
                StandardCommand.EditUndo,
                StandardCommand.EditRedo,
                StandardCommand.EditSelectAll
            };

            return(commands);
        }
示例#4
0
        private void EditorShowContextMenu(object sender, ShowContextMenuEventArg e)
        {
            var dcma =
                new SledDocumentContextMenuArgs(
                    this,
                    ToSledDocumentRegion(m_editor.GetRegion(e.MouseLocation)),
                    e.LineNumber);

            // Find objects to add to the context menu
            var commands = new List <object>(GetPopupCommandTags(dcma));

            // Point on screen that was clicked
            var screenPoint = Control.PointToScreen(e.MouseLocation);

            // Show context menu if any commands
            if (commands.Count > 0)
            {
                s_commandService.Get.RunContextMenu(commands, screenPoint);
            }
        }
示例#5
0
        /// <summary>
        /// Gets context menu command tags for the target SledDocument
        /// </summary>
        /// <param name="args">Arguments (document, region clicked, line number clicked)</param>
        /// <returns>List of context menu command tags for the target SledDocument</returns>
        public IList<object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            var commands = new List<object>();

            // Only care about breakpoint region
            if (args.Region != SledDocumentRegions.Breakpoint)
                return commands;

            // Get out if no active document
            if (!m_documentService.Active)
                return commands;

            // Grab active document
            var sd = m_documentService.ActiveDocument;

            // Store line number
            m_iContextMenuClickedLine = args.LineNumber;

            // Add breakpoint commands
            if (sd.IsValidLine(m_iContextMenuClickedLine))
            {
                if (sd.IsBreakpointSet(m_iContextMenuClickedLine))
                {
                    commands.Add(Command.BreakpointRemove);

                    if (sd.SledProjectFile != null)
                    {
                        commands.Add(
                            sd.IsBreakpointEnabled(m_iContextMenuClickedLine)
                                ? Command.BreakpointDisable
                                : Command.BreakpointEnable);

                        commands.Add(Command.BreakpointCondition);
                    }
                }
                else
                    commands.Add(Command.BreakpointAdd);
            }

            if (sd.Editor.GetBreakpoints().Length > 0)
                commands.Add(Command.BreakpointRemoveAll);

            return commands;
        }
示例#6
0
        /// <summary>
        /// Gets context menu command tags for the target SledDocument
        /// </summary>
        /// <param name="args">Arguments (document, region clicked, line number clicked)</param>
        /// <returns>List of context menu command tags for the target SledDocument</returns>
        public IList<object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            var commands =
                new List<object>
                    {
                        args.Document.SledProjectFile == null
                            ? Command.AddFile
                            : Command.RemoveFile
                    };

            return commands;
        }
示例#7
0
 public IList<object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
 {
     return GetCommands(m_documentService, args.Document).ToList();
 }
示例#8
0
 public IList <object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
 {
     return(GetCommands(m_documentService, args.Document).ToList());
 }
示例#9
0
        public IList<object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
        {
            if (m_customScriptRegistrationWorking)
            {
                var items = new List<object> { Command.GotoDefinition, Command.GotoReference };
                return items;
            }

            return null;
        }
示例#10
0
 public IList<object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
 {
     var commands =
         new List<object>
             {
                 Command.Goto,
                 null,
                 StandardCommand.EditCut,
                 StandardCommand.EditCopy,
                 StandardCommand.EditPaste,
                 StandardCommand.EditDelete,
                 null,
                 StandardCommand.EditUndo,
                 StandardCommand.EditRedo,
                 StandardCommand.EditSelectAll
             };
     return commands;
 }
 public IList <object> GetPopupCommandTags(SledDocumentContextMenuArgs args)
 {
     return(OnGetPopupCommandTags(args));
 }
 protected virtual IList <object> OnGetPopupCommandTags(SledDocumentContextMenuArgs args)
 {
     return(null);
 }