Beispiel #1
0
        void OnDelete(object sender, MenuEventArgs e)
        {
            var lines = History.Update(null);
            if (lines.Length == _menu.Items.Count)
            {
                e.Ignore = true;
            }
            else
            {
                e.Restart = true;
                _menu.Selected = -1;

                ResetItems(lines);
            }
        }
        private static void CopyHandle(object sender, MenuEventArgs args)
        {
            IPanel activePanel = Far.Api.Panel;
            string sourceDir = activePanel.CurrentDirectory;
            string destDir = Far.Api.Panel2.CurrentDirectory;

            foreach (var file in activePanel.SelectedFiles)
            {
                string sourceFullName = Path.Combine(sourceDir, file.Name);
                _queue.Add(new FileOperationParams(sourceFullName,
                                                   destDir,
                                                   file.Name,
                                                   FileOperationType.Copy));
            }

            Task.Factory.StartNew(WorkerThreadProc);
        }
Beispiel #3
0
        void OnToggle(object sender, MenuEventArgs e)
        {
            Breakpoint bp = _menu.SelectedData as Breakpoint;
            if (bp == null)
            {
                e.Ignore = true;
                return;
            }

            if (bp.Enabled)
                A.DisableBreakpoint(bp);
            else
                A.InvokeCode("Enable-PSBreakpoint -Breakpoint $args[0]", bp);
        }
Beispiel #4
0
        void OnEdit(object sender, MenuEventArgs e)
        {
            Breakpoint bp = _menu.SelectedData as Breakpoint;
            if (bp == null || string.IsNullOrEmpty(bp.Script))
            {
                e.Ignore = true;
                return;
            }

            _toStop = true;
            IEditor editor = _editor;
            LineBreakpoint lbp = bp as LineBreakpoint;

            // the target script is opened now
            if (editor != null && Kit.Equals(editor.FileName, bp.Script))
            {
                // it is a line breakpoint, go to line
                if (lbp != null)
                {
                    editor.GoToLine(lbp.Line - 1);
                    return;
                }

                return;
            }

            editor = Far.Api.CreateEditor();
            editor.FileName = bp.Script;
            if (lbp != null)
                editor.GoToLine(lbp.Line - 1);

            editor.Open();
        }
Beispiel #5
0
 void OnDisableAll(object sender, MenuEventArgs e)
 {
     if (_breakpoints.Count > 0)
         A.DisableBreakpoint(_breakpoints);
     else
         e.Ignore = true;
 }
Beispiel #6
0
 void OnDeleteAll(object sender, MenuEventArgs e)
 {
     if (_breakpoints.Count > 0)
         A.RemoveBreakpoint(_breakpoints);
     else
         e.Ignore = true;
 }
Beispiel #7
0
        void OnDelete(object sender, MenuEventArgs e)
        {
            Breakpoint bp = _menu.SelectedData as Breakpoint;
            if (bp == null)
            {
                e.Ignore = true;
                return;
            }

            A.RemoveBreakpoint(bp);
        }