Example #1
0
 public FindArgs CreateFindArgs(ResultsPanel panel)
 {
     return new FindInProbeFiles.FindArgs
     {
         SearchText = _searchText,
         SearchRegex = _regex,
         Method = _method,
         MatchCase = _matchCase,
         MatchWholeWord = _matchWholeWord,
         ProbeFilesOnly = _onlyProbeFiles,
         IncludeExtensions = _includeExtensions,
         ExcludeExtensions = _excludeExtensions,
         Panel = panel
     };
 }
Example #2
0
        public void Search(FindArgs args)
        {
            _searchText = args.SearchText;
            _searchRegex = args.SearchRegex;
            _method = args.Method;
            _matchCase = args.MatchCase;
            _matchWholeWord = args.MatchWholeWord;
            _probeFilesOnly = args.ProbeFilesOnly;
            _panel = args.Panel;
            _includeFilter = new FilePatternFilter(args.IncludeExtensions);
            _excludeFilter = new FilePatternFilter(args.ExcludeExtensions);

            _thread = new Thread(new ThreadStart(ThreadProc));
            _thread.Name = "Find in Probe Files";
            _thread.Start();
        }
Example #3
0
        public void FindInProbeFiles()
        {
            try
            {
                using (var form = new FindInProbeFiles.FindDialog())
                {
                    string selected = SelectedText;
                    if (!string.IsNullOrEmpty(selected) && !selected.Contains('\n'))
                    {
                        form.SearchText = selected;
                    }

                    if (form.ShowDialog(NppWindow) == DialogResult.OK)
                    {
                        if (_findInProbeFilesDock != null)
                        {
                            _findInProbeFilesDock.Show();
                        }
                        else
                        {
                            _findInProbeFilesPanel = new FindInProbeFiles.ResultsPanel();
                            _findInProbeFilesDock = DockWindow(_findInProbeFilesPanel, "Find in Probe Files", DockWindowAlignment.Bottom, k_findInProbeFilesPanelId);
                        }

                        if (_findInProbeFilesThread != null) _findInProbeFilesThread.Kill();

                        _findInProbeFilesThread = new FindInProbeFiles.FindThread();
                        _findInProbeFilesThread.Search(form.CreateFindArgs(_findInProbeFilesPanel));
                    }
                }
            }
            catch (Exception ex)
            {
                Errors.Show(NppWindow, ex);
            }
        }
Example #4
0
 private void Plugin_Shutdown(object sender, EventArgs e)
 {
     try
     {
         _settings.Save();
         if (_functionFileScanner != null) _functionFileScanner.OnShutdown();
         if (_compilePanel != null) _compilePanel.OnShutdown();
         if (_sidebar != null) _sidebar.OnShutdown();
         if (_findInProbeFilesPanel != null) { _findInProbeFilesPanel.Dispose(); _findInProbeFilesPanel = null; }
         if (_fileScannerDefer != null) { _fileScannerDefer.Dispose(); _fileScannerDefer = null; }
         if (_fileBackground != null) { _fileBackground.Dispose(); _fileBackground = null; }
     }
     catch (Exception ex)
     {
         Errors.Show(_nppWindow, ex, "Error while shutting down ProbeNpp plugin.");
     }
 }