Beispiel #1
0
        private void loadProjects_Execute(ExecuteEventArgs ea)
        {
            var dte = CodeRush.ApplicationObject;
            var uihSolutionExplorer = dte.Windows.Item(Constants.vsext_wk_SProjectWindow).Object as UIHierarchy;

            if (uihSolutionExplorer == null || uihSolutionExplorer.UIHierarchyItems.Count == 0)
            {
                return;
            }
            var uiHierarchyItem = uihSolutionExplorer.UIHierarchyItems.Item(1);

            string constants = Constants.vsext_wk_SProjectWindow;

            if (ea.Action.ParentMenu == "Object Browser Objects Pane")
            {
                constants = Constants.vsWindowKindObjectBrowser;
            }
            Project        dteProject    = FindProject(uiHierarchyItem);
            ProjectElement activeProject = CodeRush.Language.LoadProject(dteProject);

            if (activeProject != null)
            {
                var projectLoader = new ProjectLoader();
                var selectedAssemblyReferences = activeProject.GetSelectedAssemblyReferences(constants).ToList();
                projectLoader.Load(selectedAssemblyReferences.ToList(), NotifyOnNotFound);
            }
            else
            {
                throw new NotImplementedException();
            }
        }
Beispiel #2
0
        private void loadProjects_Execute(ExecuteEventArgs ea)
        {
            string constants = Constants.vsext_wk_SProjectWindow;

            if (ea.Action.ParentMenu == "Object Browser Objects Pane")
            {
                constants = Constants.vsWindowKindObjectBrowser;
            }
            ProjectElement activeProject = CodeRush.Source.ActiveProject;

            if (activeProject != null)
            {
                var projectLoader = new ProjectLoader();
                var selectedAssemblyReferences = activeProject.GetSelectedAssemblyReferences(constants);
                projectLoader.Load(selectedAssemblyReferences.ToList(), constants);
            }
            else
            {
                actionHint1.Text = "Active project not found. Please open a code file";
                Rectangle rectangle = Screen.PrimaryScreen.Bounds;
                actionHint1.PointTo(new Point(rectangle.Width / 2, rectangle.Height / 2));
            }
        }