public void Dispose()
 {
     if (this.m_FileFinder != null)
     {
         this.m_FileFinder.Dispose();
         this.m_FileFinder = null;
     }
     if (this.m_GetOpenFilesThread != null)
     {
         this.m_GetOpenFilesThread.Dispose();
         this.m_GetOpenFilesThread = null;
     }
     if (this.m_SolutionFiles != null)
     {
         this.m_SolutionFiles.Dispose();
         this.m_SolutionFiles = null;
     }
     if (this.m_Settings != null)
     {
         this.m_Settings.Dispose();
         this.m_Settings = null;
     }
     if (this.m_TextFinder != null)
     {
         this.m_TextFinder.Dispose();
         this.m_TextFinder = null;
     }
 }
Beispiel #2
0
 public static void Destroy()
 {
     FastFindToolWindowPane.m_DTE                = null;
     FastFindToolWindowPane.m_SolutionFiles      = null;
     FastFindToolWindowPane.m_FileFinder         = null;
     FastFindToolWindowPane.m_TextFinder         = null;
     FastFindToolWindowPane.m_GetOpenFilesThread = null;
     FastFindToolWindowPane.m_Settings           = null;
 }
Beispiel #3
0
 public static void Initialise(DTE dte, SolutionFiles solution_files, FileFinder file_finder, TextFinder text_finder, GetOpenFilesThread get_open_files_thread, Settings settings)
 {
     FastFindToolWindowPane.m_DTE                = dte;
     FastFindToolWindowPane.m_SolutionFiles      = solution_files;
     FastFindToolWindowPane.m_FileFinder         = file_finder;
     FastFindToolWindowPane.m_TextFinder         = text_finder;
     FastFindToolWindowPane.m_GetOpenFilesThread = get_open_files_thread;
     FastFindToolWindowPane.m_Settings           = settings;
 }
Beispiel #4
0
 public void Initialise(DTE dte, SolutionFiles solution_files, FileFinder file_finder, TextFinder text_finder, GetOpenFilesThread get_open_files_thread, OleMenuCommandService mcs, Settings settings)
 {
     this.m_DTE                = dte;
     this.m_SolutionFiles      = solution_files;
     this.m_FileFinder         = file_finder;
     this.m_TextFinder         = text_finder;
     this.m_GetOpenFilesThread = get_open_files_thread;
     this.m_Settings           = settings;
     if (mcs != null)
     {
         CommandID   menuCommandID = new CommandID(GuidList.guidVSAnythingCmdSet, 256);
         MenuCommand menuItem      = new MenuCommand(new EventHandler(this.MenuItemCallback), menuCommandID);
         mcs.AddCommand(menuItem);
     }
 }
Beispiel #5
0
        public FastFindForm(DTE dte, SolutionFiles solution_files, FileFinder file_finder, TextFinder text_finder, GetOpenFilesThread get_open_files_thread, Settings settings, string initial_text)
        {
            this.InitializeComponent();
            this.m_Settings = settings;
            base.Size       = settings.FastFindFormSize;
            SettingsDialogPage settings_page = VSAnythingPackage.Inst.GetSettingsDialogPage();

            if (string.IsNullOrEmpty(initial_text) && settings_page.RememberLastFind && !string.IsNullOrEmpty(FastFindForm.m_LastFindText))
            {
                initial_text = FastFindForm.m_LastFindText;
            }
            bool is_modal = true;

            this.m_FastFindControl      = new FastFindControl(dte, solution_files, file_finder, text_finder, get_open_files_thread, settings, initial_text, FastFindForm.m_LastSelectedItem, is_modal);
            this.m_FastFindControl.Dock = DockStyle.Fill;
            this.m_FastFindControl.ControlWantsToClose += new FastFindControl.ControlWantsToCloseHandler(this.FastFindControlWantsToClose);
            base.Controls.Add(this.m_FastFindControl);
            this.m_FastFindControl.OnActivated();
        }
Beispiel #6
0
        internal FastFindControlWPFWrapper(DTE dte, SolutionFiles solution_files, FileFinder file_finder, TextFinder text_finder, GetOpenFilesThread get_open_files_thread, Settings settings, WindowPane window_pane_owner)
        {
            this.InitializeComponent();
            this.m_DTE = dte;
            this.m_TabStopPanel.WpfHost = this.m_WindowsFormsHost;
            bool is_modal = false;

            this.m_FastFindControl = new FastFindControl(dte, solution_files, file_finder, text_finder, get_open_files_thread, settings, "", -1, is_modal);
            this.m_FastFindControl.ControlWantsToClose += onEscToCloseWindow;
            this.m_FastFindControl.Dock = DockStyle.Fill;
            this.m_TabStopPanel.Controls.Add(this.m_FastFindControl);
        }
        protected override void Initialize()
        {
            base.Initialize();
            try
            {
                Log.OpenFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\VSAnything\\VSAnything.log");
                VSAnythingPackage.m_Inst = this;
                Log.WriteLine("----------------------------------------------------------");
                Log.WriteLine("FastFind Initialise");
                Log.WriteLine("FastFind Version: 4.8");
                this.m_Settings.Read();
                EnvDTE.DTE env_dte = (EnvDTE.DTE)base.GetService(typeof(SDTE));
                string     vs_version;
                try
                {
                    vs_version = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                }
                catch (Exception e)
                {
                    vs_version = "Error getting VS version: " + e.Message;
                }
                Log.WriteLine("Visual Studio Version: " + vs_version);
                this.m_DTE        = new DTE(env_dte);
                this.m_TextFinder = new TextFinder();
                this.m_FileFinder = new FileFinder(this.m_Settings);
                this.m_FileFinder.SetSolutionFiles(new List <string>(this.m_Settings.SolutionFiles));
                this.m_SolutionFiles      = new SolutionFiles(this.m_DTE);
                this.m_GetOpenFilesThread = new GetOpenFilesThread(env_dte);
                this.m_SolutionFiles.SolutionFileListChanged += new SolutionFiles.SolutionFileListChangedHandler(this.SolutionFilesChanged);
                this.m_DocumentEvents = env_dte.Events.get_DocumentEvents(null);
                this.m_SolutionEvents = env_dte.Events.SolutionEvents;
                this.m_WindowEvents   = env_dte.Events.get_WindowEvents(null);

                //mariotodo 改成下面那样,不知道对不对
                //this.m_DocumentEvents.DocumentSaved += new _dispDocumentEvents_DocumentSavedEventHandler(this, (UIntPtr)System.Reflection.Emit.OpCodes.Ldftn(DocumentSaved));
                //this.m_SolutionEvents.ProjectAdded += new _dispSolutionEvents_ProjectAddedEventHandler(this, (UIntPtr)ldftn(ProjectAddedOrRemoved));
                //this.m_SolutionEvents.ProjectRemoved += new _dispSolutionEvents_ProjectRemovedEventHandler(this, (UIntPtr)ldftn(ProjectAddedOrRemoved));
                //this.m_WindowEvents.WindowActivated += new _dispWindowEvents_WindowActivatedEventHandler(this, (UIntPtr)ldftn(WindowActivated));

                this.m_DocumentEvents.DocumentSaved  += new _dispDocumentEvents_DocumentSavedEventHandler(this.DocumentSaved);
                this.m_SolutionEvents.ProjectAdded   += new _dispSolutionEvents_ProjectAddedEventHandler(this.ProjectAddedOrRemoved);
                this.m_SolutionEvents.ProjectRemoved += new _dispSolutionEvents_ProjectRemovedEventHandler(this.ProjectAddedOrRemoved);
                this.m_WindowEvents.WindowActivated  += new _dispWindowEvents_WindowActivatedEventHandler(this.WindowActivated);

                FastFindToolWindowPane.Initialise(this.m_DTE, this.m_SolutionFiles, this.m_FileFinder, this.m_TextFinder, this.m_GetOpenFilesThread, this.m_Settings);
                OleMenuCommandService mcs = base.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
                this.m_FastFindCmd.Initialise(this.m_DTE, this.m_SolutionFiles, this.m_FileFinder, this.m_TextFinder, this.m_GetOpenFilesThread, mcs, this.m_Settings);
                this.m_FastFindWindowCmd.Initialise(this, this.m_DTE, mcs, this.m_Settings);
                this.m_SourceHeaderToggleCmd.Initialise(this.m_DTE, this.m_SolutionFiles, mcs);
                this.m_SettingsCmd.Initialise(mcs);
                this.m_Solution = (base.GetService(typeof(SVsSolution)) as IVsSolution2);
                if (this.m_Solution != null)
                {
                    int ret = this.m_Solution.AdviseSolutionEvents(this, out this.m_SolutionEventsCookie);
                    Log.WriteLine("AdviseSolutionEvents returned " + ret);
                }
                this.AddSolutionFileToSettings();
                if (this.m_DTE.EnvDTE.Solution != null)
                {
                    foreach (Project project in this.m_DTE.EnvDTE.Solution.Projects)
                    {
                        IVsHierarchy pHierarchy = null;
                        if (this.m_Solution.GetProjectOfUniqueName(project.UniqueName, out pHierarchy) == 0 && pHierarchy != null)
                        {
                            this.AdviseHierarchyEvents(pHierarchy);
                        }
                    }
                }
                if (!this.m_Settings.ShownWelcomeForm)
                {
                    new System.Threading.Thread(new ThreadStart(this.WelcomeThread)).Start();
                }
            }
            catch (Exception arg_368_0)
            {
                Utils.LogException(arg_368_0);
            }
        }