Esempio n. 1
0
        public void CleanUp()
        {
            Workspace.CleanUpWaitingService();
            Workspace.CleanUpWorkspace();
            SolutionExplorer.CleanUpOpenSolution();
            Workspace.WaitForAllAsyncOperations();

            // Close any windows leftover from previous (failed) tests
            InteractiveWindow.CloseInteractiveWindow();
            ObjectBrowserWindow.CloseWindow();
            ChangeSignatureDialog.CloseWindow();
            GenerateTypeDialog.CloseWindow();
            ExtractInterfaceDialog.CloseWindow();
            StartPage.CloseWindow();

            // Prevent the start page from showing after each solution closes
            StartPage.SetEnabled(false);
        }
Esempio n. 2
0
        private void radMenuItem12_Click(object sender, EventArgs e)
        {
            var np = new NewProjectDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Project();
                f.Name = np.Filename;
                f.Type = np.Type;

                Workspace.Solution.Projects.Add(f);

                radTreeView1.Nodes.Clear();
                radTreeView1.Nodes.Add(SolutionExplorer.Build(Workspace.Solution));

                Workspace.Solution.Save(Workspace.SolutionPath);
            }
        }
Esempio n. 3
0
        private void openMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Solution (*.sln)|*.sln";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Workspace.Solution     = Solution.Load(openFileDialog1.FileName);
                Workspace.SolutionPath = openFileDialog1.FileName;

                startpageDocument.Hide();
                solutionExplorerWindow.Show();

                newProjectMenuItem.Enabled = true;
                newFileMenuItem.Enabled    = true;

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));
            }
        }
Esempio n. 4
0
        private void CleanClientSideLibraries()
        {
            Guid guid      = Guid.Parse("44ee7bda-abda-486e-a5fe-4dd3f4cefac1");
            uint commandId = 0x0200;
            SolutionExplorerItemTestExtension libmanConfigNode = SolutionExplorer.FindItemRecursive(LibManManifestFile);

            if (libmanConfigNode != null)
            {
                libmanConfigNode.Select();

                WaitFor.IsTrue(() =>
                {
                    CommandQueryResult queryResult = VisualStudio.ObjectModel.Commanding.QueryStatusCommand(guid, commandId);
                    return(queryResult.IsEnabled);
                }, TimeSpan.FromMilliseconds(40000), TimeSpan.FromMilliseconds(500));

                VisualStudio.ObjectModel.Commanding.ExecuteCommand(guid, commandId, null);
            }
        }
Esempio n. 5
0
        private void radMenuItem12_Click(object sender, EventArgs e)
        {
            var np = new NewProjectDialog();

            if (np.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var f = new Project();
                f.Name = np.Filename;
                f.Type = np.Type;

                Workspace.Solution.Projects.Add(f);

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, radContextMenu1));

                np.Plugin.Events.Fire("OnCreateProject", f);

                Workspace.Solution.Save(Workspace.SolutionPath);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            /*
             * Some thoughts:
             * The stack trace does not bring property getters and setters.
             * There must be a way to filter out some tokens (don't find references for this tokens) to avoid paths that are too much common and pollute results
             */

            string fileName     = "";
            string solutionPath = "";

            string[] desiredNamespaces = new string[0];


            var solution = new SolutionExplorer(solutionPath);
            var doc      = solution.GetDocument(fileName);

            var rf      = solution.FindReferences(doc, desiredNamespaces, new int[] { 35 });
            var results = rf.Results;

            foreach (var result in results)
            {
                int i = 0;

                foreach (var current in result)
                {
                    if (i > 0)
                    {
                        Console.Write("-> ");
                    }

                    WriteStackItem(current);

                    i++;
                }

                Console.WriteLine(" ");
            }

            Console.ReadKey();
        }
Esempio n. 7
0
        protected override void load()
        {
            foreach (IDockContent content in Application.Panel.Contents)
            {
                solutionExplorer = content as SolutionExplorer;
            }
            if (solutionExplorer == null)
            {
                solutionExplorer = new SolutionExplorer();
                solutionExplorer.Show(Application.Panel, DockState.DockLeft);
            }

            solutionExplorer.Text = StaticText.RootNodeName;
            solutionExplorer.Icon = Resources.flag;

            loadData();

            solutionExplorer.Controls.Add(tvSolution);

            root.ExpandAll();
        }
Esempio n. 8
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var explorer   = new SolutionExplorer(this.package);
            var dsFilePath = explorer.GetSelectedFilePath();

            if (Path.GetExtension(dsFilePath) == ".xsd")
            {
                var dialog = new GenerateDictionatyDialog(dsFilePath);
                dialog.ShowModal();
            }
            else
            {
                VsShellUtilities.ShowMessageBox(
                    this.package,
                    "Please select a DataSet(.xsd) file",
                    "Wrong file",
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }
        public void showSolutionExplorer(bool makeActive)
        {
            if (solExp == null)
            {
                solExp = new SolutionExplorer(this);
                solExp.ViewModel.OnLoaded();
                var firstAnchorablePane = View.dockingManager.Layout.Descendents().OfType <LayoutAnchorablePane>().FirstOrDefault();
                if (firstAnchorablePane != null)
                {
                    firstAnchorablePane.Children.Add(solExp);
                }
            }
            else
            {
                solExp.Show();
            }

            if (makeActive)
            {
                solExp.IsActive   = true;
                solExp.IsSelected = true;
            }
        }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void Execute(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var explorer       = new SolutionExplorer(this.package);
            var reportFilePath = explorer.GetSelectedFilePath();

            if (Path.GetExtension(reportFilePath) == ".frx")
            {
                var dataSets = explorer.GetSolutionDataSets();
                var dialog   = new DataSetSelectorDialog(dataSets, reportFilePath);
                dialog.ShowModal();
            }
            else
            {
                VsShellUtilities.ShowMessageBox(
                    this.package,
                    "Please select a FastReport(.frx) file",
                    "Wrong file",
                    OLEMSGICON.OLEMSGICON_INFO,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);
            }
        }
Esempio n. 11
0
        private void radMenuItem11_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Workspace.Solution = new Solution();
                var name = Prompt.Show(LanguageManager._("Please specifiy an solution name"), LanguageManager._("Name"));
                Workspace.Solution.Name = name;

                explorerTreeView.Nodes.Clear();
                explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

                Directory.CreateDirectory(folderBrowserDialog1.SelectedPath + "\\" + name);

                Workspace.SolutionPath = folderBrowserDialog1.SelectedPath + "\\" + name + "\\" + name + ".sln";
                Workspace.Solution.Save(Workspace.SolutionPath);

                newProjectMenuItem.Enabled = true;
                newFileMenuItem.Enabled    = true;

                startpageDocument.Hide();
                solutionExplorerWindow.Show();
            }
        }
Esempio n. 12
0
        private void TVOrgs_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var node = tvOrgs.SelectedNode;

            if (node.Tag?.ToString() == "Solution")
            {
                var solNode = (CrmTreeNode <CrmSolution>)node;
                var crmSol  = (CrmSolution)solNode.Component;
                var org     = crmSol.Organization;
                var service = org.Service;

                crmSol.LoadMeta(service);

                crmSol.Path = solNode.Text;
                if (solNode.Parent != null)
                {
                    crmSol.Path = $"{solNode.Parent.Text}::{crmSol.Path}";
                    if (solNode.Parent.Parent != null)
                    {
                        crmSol.Path = $"{solNode.Parent.Parent.Text}::{crmSol.Path}";
                        if (solNode.Parent.Parent.Parent != null)
                        {
                            crmSol.Path = $"{solNode.Parent.Parent.Parent.Text}::{crmSol.Path}";
                        }
                    }
                }
                var solExplorer = new SolutionExplorer(crmSol.Path, imageList1);
                crmSol.Tree = solExplorer.Tree;
                var controls = tabControlMain.Controls.Find(crmSol.UniqueName, false);
                if (controls.Length == 0)
                {
                    solExplorer.Display(crmSol);
                    tabControlMain.Controls.Add(solExplorer.Container);
                }
                tabControlMain.SelectTab(crmSol.UniqueName);
            }
        }
        private async Task ExecuteHubCommunication()
        {
            _installerServices = _componentModel.GetService <IVsPackageInstallerServices>();

            var solution = (IVsSolution)Package.GetGlobalService(typeof(IVsSolution));
            var projects = SolutionExplorer.GetProjects(solution);

            if (projects.Count() > 0)
            {
                tbStatus.SetResourceReference(ForegroundProperty, VsBrushes.PanelTextKey);
                cmbProjects.IsEnabled = false;
                tbStatus.Visibility   = Visibility.Visible;
                pbStatus.Visibility   = Visibility.Visible;
                sepStatus.Visibility  = Visibility.Visible;
                tbStatus.Text         = Properties.Resources.StatusRunning;

                if (await GetPackagesAndRiskInformation(projects))
                {
                    dgPackages.ItemsSource = _packagesList;
                    dgPackages.Items.Refresh();
                    tbStatus.Text            = Properties.Resources.StatusComplete;
                    cmbProjects.ItemsSource  = null;
                    cmbProjects.ItemsSource  = _validProjectsList;
                    cmbProjects.IsEnabled    = true;
                    cmbProjects.SelectedItem = Properties.Resources.ItemAll;
                    pbStatus.Visibility      = Visibility.Hidden;
                    sepStatus.Visibility     = Visibility.Hidden;
                }
                else
                {
                    tbStatus.Foreground  = Brushes.Red;
                    tbStatus.Text        = _riskAnalysisStatus;
                    pbStatus.Visibility  = Visibility.Hidden;
                    sepStatus.Visibility = Visibility.Hidden;
                }
            }
        }
 protected override void OnBeforeQueryStatus()
 {
     Visible = ClipboardHelper.TryGetClipboardText(out _clipboardText) &&
               SolutionExplorer.TryGetSingleSelectedFile(out _selectedFile);
 }
Esempio n. 15
0
        public IEnumerable<Project> ShowProjectSelectorWindow(
            string instructionText,
            IPackage package,
            Predicate<Project> checkedStateSelector,
            Predicate<Project> enabledStateSelector)
        {
            if (!_uiDispatcher.CheckAccess())
            {
                // Use Invoke() here to block the worker thread
                object result = _uiDispatcher.Invoke(
                    new Func<string, IPackage, Predicate<Project>, Predicate<Project>, IEnumerable<Project>>(ShowProjectSelectorWindow),
                    instructionText,
                    package,
                    checkedStateSelector,
                    enabledStateSelector);

                return (IEnumerable<Project>)result;
            }

            var viewModel = new SolutionExplorerViewModel(
                ServiceLocator.GetInstance<DTE>().Solution,
                package,
                checkedStateSelector,
                enabledStateSelector);

            // only show the solution explorer window if there is at least one compatible project
            if (viewModel.HasProjects)
            {
                var window = new SolutionExplorer()
                {
                    DataContext = viewModel
                };
                window.InstructionText.Text = instructionText;

                bool? dialogResult = null;
                using (NuGetEventTrigger.Instance.TriggerEventBeginEnd(
                    NuGetEvent.SelectProjectDialogBegin,
                    NuGetEvent.SelectProjectDialogEnd))
                {
                    dialogResult = window.ShowModal();
                }

                if (dialogResult ?? false)
                {
                    return viewModel.GetSelectedProjects();
                }
                else
                {
                    return null;
                }
            }
            else
            {
                IEnumerable<FrameworkName> supportedFrameworks = package.GetSupportedFrameworks()
                                                                        .Where(name => name != null && name != VersionUtility.UnsupportedFrameworkName);
                string errorMessage = supportedFrameworks.Any() ?
                    String.Format(
                        CultureInfo.CurrentCulture,
                        Resources.Dialog_NoCompatibleProject,
                        package.Id,
                        Environment.NewLine + String.Join(Environment.NewLine, supportedFrameworks)) :
                    String.Format(
                        CultureInfo.CurrentCulture,
                        Resources.Dialog_NoCompatibleProjectNoFrameworkNames,
                        package.Id);

                // if there is no project compatible with the selected package, show an error message and return
                MessageHelper.ShowWarningMessage(errorMessage, title: null);
                return null;
            }
        }
 public FindInSolExpCommand(Guid guidId, int id, IMenuCommandService menuCommandService, ILogger _logger, DTE2 _dte)
     : base(guidId, id, menuCommandService, _logger)
 {
     solutionExplorer = new SolutionExplorer(_dte);
     dte = _dte;
 }
 //TODO: DI
 public PlatformService(string url)
 {
     _explorer           = new SolutionExplorer();
     _platformConnection = new CaDETConnection(url);
     //_platformConnection = new MockConnection();
 }
Esempio n. 18
0
        public Form1()
        {
            InitializeComponent();

            startpageDocument.Controls.Add(new StartPage(openMenuItem_Click, newProjectMenuItem_Click)
            {
                Dock = System.Windows.Forms.DockStyle.Fill
            });

            NotificationService.Init(radDesktopAlert1);

            ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Dark";

            Workspace.Settings.Load();

            if (!Workspace.Settings.Get <bool>("BetaAccepted"))
            {
                new BetaKeyDialog(this).ShowDialog();
                Hide();
            }

            Workspace.Output = new Core.Contracts.Debug(outputTextBox);
            Workspace.PluginManager.Load(Environment.CurrentDirectory + "\\Plugins");

            foreach (var item in Workspace.PluginManager.Plugins)
            {
                foreach (var win in item.Windows)
                {
                    var tw   = new ToolWindow(win.Value.Title);
                    var ctrl = win.Value.View.Build();
                    ctrl.Dock = System.Windows.Forms.DockStyle.Fill;

                    tw.Controls.Add(ctrl);

                    dock.AddDocument(tw);
                }
            }

            // add here loading from startup
            // file, project, solution

            var args = Environment.GetCommandLineArgs();

            if (args.Length > 0)
            {
                string file = null;

#if DEBUG
                if (args.Length > 1)
                {
                    file = args[1];
                }
#else
                file = args[0];
#endif

                if (file != null)
                {
                    switch (Path.GetExtension(file))
                    {
                    case ".sln":
                        Workspace.Solution     = Solution.Load(file);
                        Workspace.SolutionPath = file;

                        startpageDocument.Hide();
                        solutionExplorerWindow.Show();

                        newProjectMenuItem.Enabled = true;
                        newFileMenuItem.Enabled    = true;

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(Workspace.Solution, solutionContextMenu, projectContextMenu, fileContextMenu));

                        break;

                    case "proj":
                        var p = Project.Load(file);

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(p, projectContextMenu, fileContextMenu));

                        break;

                    default:
                        var f      = new Core.ProjectSystem.File();
                        var shortF = Path.GetFileName(file);

                        f.Name = shortF;
                        f.Src  = file;
                        f.ID   = Utils.GetTemplateID(shortF);

                        explorerTreeView.Nodes.Clear();
                        explorerTreeView.Nodes.Add(SolutionExplorer.Build(f, fileContextMenu));

                        ItemTemplate np  = null;
                        Plugin       npp = null;

                        foreach (var item in Workspace.PluginManager.Plugins)
                        {
                            foreach (var it in item.ItemTemplates)
                            {
                                if (it.ID == f.ID)
                                {
                                    np  = it;
                                    npp = item;
                                }
                            }
                        }

                        var raw = System.IO.File.ReadAllBytes(file);

                        npp.Events.Fire("OnCreateItem", np, f, raw);

                        var doc = new DocumentWindow(f.Name);
                        doc.Controls.Add(ViewSelector.Select(np, raw, f, np.AutoCompletionProvider as IntellisenseProvider, doc).GetView());

                        AddDocument(doc);

                        startpageDocument.Hide();

                        break;
                    }
                }
            }

            RefreshLanguage();

            addItemContextItem.Click += radMenuItem13_Click;
        }
 public FindInSCEFromSolExpCommand(IMenuCommandService menuCommandService, ILogger _logger, DTE2 _dte, ITFSVersionControl _tfs)
     : base(GuidList.guidTFSProductivityPackCmdSet, PkgCmdIDList.cmdIdFindInSCEFromSolExp, menuCommandService, _logger, _dte, _tfs)
 {
     solutionExplorer = new SolutionExplorer(_dte);
 }
Esempio n. 20
0
        public IEnumerable <Project> ShowProjectSelectorWindow(
            string instructionText,
            IPackage package,
            Predicate <Project> checkedStateSelector,
            Predicate <Project> enabledStateSelector)
        {
            if (!_uiDispatcher.CheckAccess())
            {
                // Use Invoke() here to block the worker thread
                object result = _uiDispatcher.Invoke(
                    new Func <string, IPackage, Predicate <Project>, Predicate <Project>, IEnumerable <Project> >(ShowProjectSelectorWindow),
                    instructionText,
                    package,
                    checkedStateSelector,
                    enabledStateSelector);

                return((IEnumerable <Project>)result);
            }

            var viewModel = new SolutionExplorerViewModel(
                ServiceLocator.GetInstance <DTE>().Solution,
                package,
                checkedStateSelector,
                enabledStateSelector);

            // only show the solution explorer window if there is at least one compatible project
            if (viewModel.HasProjects)
            {
                var window = new SolutionExplorer()
                {
                    DataContext = viewModel
                };
                window.InstructionText.Text = instructionText;

                bool?dialogResult = null;
                using (NuGetEventTrigger.Instance.TriggerEventBeginEnd(
                           NuGetEvent.SelectProjectDialogBegin,
                           NuGetEvent.SelectProjectDialogEnd))
                {
                    dialogResult = window.ShowModal();
                }

                if (dialogResult ?? false)
                {
                    return(viewModel.GetSelectedProjects());
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                IEnumerable <FrameworkName> supportedFrameworks = package.GetSupportedFrameworks()
                                                                  .Where(name => name != null && name != VersionUtility.UnsupportedFrameworkName);
                string errorMessage = supportedFrameworks.Any() ?
                                      String.Format(
                    CultureInfo.CurrentCulture,
                    Resources.Dialog_NoCompatibleProject,
                    package.Id,
                    Environment.NewLine + String.Join(Environment.NewLine, supportedFrameworks)) :
                                      String.Format(
                    CultureInfo.CurrentCulture,
                    Resources.Dialog_NoCompatibleProjectNoFrameworkNames,
                    package.Id);

                // if there is no project compatible with the selected package, show an error message and return
                MessageHelper.ShowWarningMessage(errorMessage, title: null);
                return(null);
            }
        }
Esempio n. 21
0
 public void AssertFileExistsWithContent(string content, params string[] path)
 {
     SolutionExplorer.AssertFileExistsWithContent(SolutionDirectory, content, AddSolutionToPath(path));
 }
Esempio n. 22
0
 public void AssertFileExists(params string[] path)
 {
     SolutionExplorer.AssertFileExists(SolutionDirectory, AddSolutionToPath(path));
 }
Esempio n. 23
0
 public void AssertFolderDoesntExist(params string[] path)
 {
     SolutionExplorer.AssertFolderDoesntExist(SolutionDirectory, AddSolutionToPath(path));
 }
Esempio n. 24
0
 protected override void OnBeforeQueryStatus()
 {
     Visible = SolutionExplorer.TryGetSelectedFiles(out _file1, out _file2);
 }
Esempio n. 25
0
 public void SelectProject(Project project)
 {
     SolutionExplorer.SelectProject(project);
 }
Esempio n. 26
0
        private void MenuFileOpen_Click(object sender, EventArgs e)
        {
            FileItem file = FileIOUI.Open(this);

            if (file == null)
            {
                return;
            }

            if (file.Extension == "ns")
            {
                TabPage logsTab = Logs.TabPages[Logs.TabPages.IndexOfKey("IDE")];
                Logs.SelectedTab = logsTab;

                try
                {
                    Program.Solution = JsonConvert.DeserializeObject <SolutionDTO>(file.Contents);
                }
                catch (Exception ex)
                {
                    Program.Log("Can't parse solution file. Details: " + ex.Message);
                    Alert.Error("Невозможно распознать файл решения");
                }

                if (Program.Solution == null)
                {
                    return;
                }

                Program.Solution.Location = file.Location;

                TreeNode solution = new TreeNode(Program.Solution.Name + " (проектов: " + Program.Solution.Projects.Count + ")");
                solution.ToolTipText = Program.Solution.Location;

                SolutionExplorer.Nodes.Clear();
                SolutionExplorer.Nodes.Add(solution);

                Control logs = logsTab.Controls[0];
                logs.Text = "";

                foreach (ProjectDTO project in Program.Solution.Projects)
                {
                    string projectDir  = file.Location + "/" + project.Location + "/";
                    string projectText = project.Location + " (" + Program.Solution.Location + project.Location + ")";

                    TreeNode[] prjContents = FileItem.BuildDirectoryTree(projectDir);

                    if (prjContents == null)
                    {
                        SolutionExplorer.Nodes[0].Nodes.Add(new TreeNode(project.Location + " [Ошибка]"));

                        logs.Text += "[warn] Не удалось загрузить проект " + projectText + ". Каталог проекта не найден.";
                    }
                    else
                    {
                        TreeNode projectNode = new TreeNode(project.Location, prjContents);
                        projectNode.ToolTipText = projectDir;
                        projectNode.Expand();

                        SolutionExplorer.Nodes[0].Nodes.Add(projectNode);

                        logs.Text += "[ ok ] Загружен проект: " + projectText;
                    }

                    logs.Text += "\r\n";
                }

                SolutionExplorer.Sort();
                SolutionExplorer.Nodes[0].Expand();
            }
            else
            {
                _openTab(file);
            }
        }