예제 #1
0
        private void CompileCallback(object sender, EventArgs e)
        {
            OutputPane pane = package.TrufflePane;

            pane.Clear();
            pane.AddLine("Compiling...");
            pane.RunTruffleCommand("compile --all", () =>
            {
                pane.AddLine("Done.");
            });
        }
예제 #2
0
        private void MigrateCallback(object sender, EventArgs e)
        {
            OutputPane pane = package.TrufflePane;

            pane.Clear();
            pane.AddLine("Migrating...");
            pane.RunTruffleCommand("migrate --reset", () =>
            {
                pane.AddLine("Done.");
            });
        }
예제 #3
0
        private void TestCallback(object sender, EventArgs e)
        {
            OutputPane pane = package.TrufflePane;

            pane.Clear();
            pane.AddLine("Running tests...");
            pane.RunTruffleCommand("test", () =>
            {
                pane.AddLine("Done.");
            });
        }
 public void QueueProjectsForBuilding(ICollection <EnvDTE.Project> projects)
 {
     BuildContext(true);
     OutputPane.Clear();
     OutputPane.Activate();
     foreach (EnvDTE.Project p in projects)
     {
         _buildProjects.Add(p);
     }
     BuildNextProject();
 }
예제 #5
0
 public void Log(FunctionId functionId, LogMessage logMessage)
 {
     OutputPane.WriteLine(
         string.Format(
             "[{0}] {1} - {2}",
             Environment.CurrentManagedThreadId,
             functionId.ToString(),
             logMessage.GetMessage()
             )
         );
 }
예제 #6
0
 private void FindDuplicateIndexes(object sender, EventArgs e)
 {
     try
     {
         var finder = new DuplicateIndexFinder();
         finder.ShowDuplicateIndexes();
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessage("Error finding duplicate indexes: {0}", ex.Message);
     }
 }
예제 #7
0
 private void CorrectCaseTableNames(object sender, EventArgs e)
 {
     try
     {
         var finder = new CorrectCaseTableFinder();
         finder.CorrectCaseAllTableNames();
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessage("Error correcting table name case: {0}", ex.Message);
     }
 }
 private void QuickDeploy(object sender, EventArgs e)
 {
     try
     {
         QuickDeployer.DeployFile(GetCurrentDocumentText());
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessage("QuickDeploy error: {0}", ex.Message);
         Log.WriteInfo("QuickDeploy error: {0}", ex.Message);
     }
 }
예제 #9
0
        private void InitializeProjectCallback(object sender, EventArgs e)
        {
            OutputPane pane = package.TrufflePane;

            pane.Clear();
            pane.AddLine("Initializing project...");
            pane.RunTruffleCommand("init", () =>
            {
                pane.AddLine("Done");
                this.package.RecheckEnvironment();
            });
        }
예제 #10
0
 public void QueueProjectsForBuilding(ICollection <IVsProject> projects)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     BuildContext(true);
     OutputPane.Clear();
     OutputPane.Activate();
     foreach (IVsProject p in projects)
     {
         _buildProjects.Add(p);
     }
     BuildNextProject();
 }
 public void InitializeProjects()
 {
     //
     // Postpone project initialization until the AddIn has been
     // removed.
     //
     if (!File.Exists(AddinPath))
     {
         OutputPane.Clear();
         InitializeProjects(DTEUtil.GetProjects(DTE.Solution));
     }
 }
 private void QuickDeployToClipboard(object sender, EventArgs e)
 {
     try
     {
         var script = QuickDeployer.GetDeployScript(GetCurrentDocumentText());
         Clipboard.SetText(script, TextDataFormat.UnicodeText);
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessage("QuickDeployToClipboard error: {0}", ex.Message);
         Log.WriteInfo("QuickDeployToClipboard error: {0}", ex.Message);
     }
 }
 private void QuickDeployClearConnection(object sender, EventArgs e)
 {
     try
     {
         QuickDeployer.ClearConnectionString();
         OutputPane.WriteMessageAndActivatePane("Quick Deploy Connection String has been cleared.");
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessage("QuickDeployClearConnection error: {0}", ex.Message);
         Log.WriteInfo("QuickDeployClearConnection error: {0}", ex.Message);
     }
 }
예제 #14
0
 private void DiscardResults(object sender, RoutedEventArgs e)
 {
     try
     {
         var store = CodeCoverageStore.Get;
         store.ClearStatements();
         ShowCodeMap(sender, e);
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessageAndActivatePane("SSDTDevPack: CodeCoverage: Exception calling Discard: {0}", ex);
     }
 }
예제 #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GitExtCommands"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private GitExtCommands(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            _package        = package;
            _application    = (DTE2)ServiceProvider.GetService(typeof(DTE));
            _commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            try
            {
                //RegisterCommand("Difftool_Selection", new ToolbarCommand<OpenWithDiftool>(runForSelection: true));
                RegisterCommand("Difftool", new ToolbarCommand <OpenWithDiftool>(), gitExtDiffCommand);
                //RegisterCommand("ShowFileHistory_Selection", new ToolbarCommand<FileHistory>(runForSelection: true));
                RegisterCommand("ShowFileHistory", new ToolbarCommand <FileHistory>(), gitExtHistoryCommand);
                //RegisterCommand("ResetChanges_Selection", new ToolbarCommand<Revert>(runForSelection: true));
                RegisterCommand("ResetChanges", new ToolbarCommand <Revert>(), gitExtResetFileCommand);
                RegisterCommand("Browse", new ToolbarCommand <Browse>(), gitExtBrowseCommand);
                RegisterCommand("Clone", new ToolbarCommand <Clone>(), gitExtCloneCommand);
                RegisterCommand("CreateNewRepository", new ToolbarCommand <Init>(), gitExtNewCommand);
                RegisterCommand("Commit", new ToolbarCommand <Commit>(), gitExtCommitCommand);
                RegisterCommand("Pull", new ToolbarCommand <Pull>(), gitExtPullCommand);
                RegisterCommand("Push", new ToolbarCommand <Push>(), gitExtPushCommand);
                RegisterCommand("Stash", new ToolbarCommand <Stash>(), gitExtStashCommand);
                RegisterCommand("Remotes", new ToolbarCommand <Remotes>(), gitExtRemotesCommand);
                RegisterCommand("GitIgnore", new ToolbarCommand <GitIgnore>(), gitExtGitIgnoreCommand);
                RegisterCommand("ApplyPatch", new ToolbarCommand <ApplyPatch>(), gitExtApplyPatchCommand);
                RegisterCommand("FormatPatch", new ToolbarCommand <FormatPatch>(), gitExtFormatPatchCommand);
                RegisterCommand("ViewChanges", new ToolbarCommand <ViewChanges>(), gitExtViewChangesCommand);
                RegisterCommand("Blame", new ToolbarCommand <Blame>(), gitExtBlameCommand);
                RegisterCommand("FindFile", new ToolbarCommand <FindFile>(), gitExtFindFileCommand);
                RegisterCommand("SwitchBranch", new ToolbarCommand <SwitchBranch>(), gitExtCheckoutCommand);
                RegisterCommand("CreateBranch", new ToolbarCommand <CreateBranch>(), gitExtCreateBranchCommand);
                RegisterCommand("Merge", new ToolbarCommand <Merge>(), gitExtMergeCommand);
                RegisterCommand("Rebase", new ToolbarCommand <Rebase>(), gitExtRebaseCommand);
                RegisterCommand("SolveMergeConflicts", new ToolbarCommand <SolveMergeConflicts>(), gitExtSolveConflictsCommand);
                RegisterCommand("CherryPick", new ToolbarCommand <Cherry>(), gitExtCherryPickCommand);
                RegisterCommand("Bash", new ToolbarCommand <Bash>(), gitExtBashCommand);
                RegisterCommand("Settings", new ToolbarCommand <Settings>(), gitExtSettingsCommand);
                RegisterCommand("About", new ToolbarCommand <About>(), gitExtAboutCommand);
            }
            catch (Exception ex)
            {
                if (OutputPane != null)
                {
                    OutputPane.OutputString("Error adding commands: " + ex);
                }
            }
        }
        public void Start()
        {
            try
            {
                _continue = true;
                _gateway  = new DatabaseGateway(_connectionString).Get();

                _gateway.StartTrace();
            }
            catch (Exception e)
            {
                OutputPane.WriteMessageAndActivatePane("CodeCoverage, error starting the trace: {0}", e);
            }
        }
예제 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GitExtCommands"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private GitExtCommands(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }

            _package        = package;
            _application    = (DTE2)ServiceProvider.GetService(typeof(DTE));
            _commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            try
            {
                //RegisterCommand("Difftool_Selection", new ToolbarCommand<OpenWithDiftool>(runForSelection: true));
                RegisterCommand("Difftool", new ToolbarCommand <OpenWithDiftool>(), 0x1100);
                //RegisterCommand("ShowFileHistory_Selection", new ToolbarCommand<FileHistory>(runForSelection: true));
                RegisterCommand("ShowFileHistory", new ToolbarCommand <FileHistory>(), 0x1101);
                //RegisterCommand("ResetChanges_Selection", new ToolbarCommand<Revert>(runForSelection: true));
                RegisterCommand("ResetChanges", new ToolbarCommand <Revert>(), 0x1102);
                RegisterCommand("Browse", new ToolbarCommand <Browse>(), 0x1103);
                RegisterCommand("Clone", new ToolbarCommand <Clone>(), 0x1104);
                RegisterCommand("CreateNewRepository", new ToolbarCommand <Init>(), 0x1105);
                RegisterCommand("Commit", new ToolbarCommand <Commit>(), 0x1106);
                RegisterCommand("Pull", new ToolbarCommand <Pull>(), 0x1107);
                RegisterCommand("Push", new ToolbarCommand <Push>(), 0x1108);
                RegisterCommand("Stash", new ToolbarCommand <Stash>(), 0x1109);
                RegisterCommand("Remotes", new ToolbarCommand <Remotes>(), 0x110a);
                RegisterCommand("GitIgnore", new ToolbarCommand <GitIgnore>(), 0x110b);
                RegisterCommand("ApplyPatch", new ToolbarCommand <ApplyPatch>(), 0x110c);
                RegisterCommand("FormatPatch", new ToolbarCommand <FormatPatch>(), 0x110d);
                RegisterCommand("ViewChanges", new ToolbarCommand <ViewChanges>(), 0x110e);
                RegisterCommand("FindFile", new ToolbarCommand <FindFile>(), 0x110f);
                RegisterCommand("SwitchBranch", new ToolbarCommand <SwitchBranch>(), 0x1110);
                RegisterCommand("CreateBranch", new ToolbarCommand <CreateBranch>(), 0x1111);
                RegisterCommand("Merge", new ToolbarCommand <Merge>(), 0x1112);
                RegisterCommand("Rebase", new ToolbarCommand <Rebase>(), 0x1113);
                RegisterCommand("SolveMergeConflicts", new ToolbarCommand <SolveMergeConflicts>(), 0x1114);
                RegisterCommand("CherryPick", new ToolbarCommand <Cherry>(), 0x1115);
                RegisterCommand("Bash", new ToolbarCommand <Bash>(), 0x1116);
                RegisterCommand("Settings", new ToolbarCommand <Settings>(), 0x1117);
                RegisterCommand("About", new ToolbarCommand <About>(), 0x1118);
            }
            catch (Exception ex)
            {
                if (OutputPane != null)
                {
                    OutputPane.OutputString("Error adding commands: " + ex);
                }
            }
        }
예제 #18
0
        private void ToggleQueryCosts(object sender, EventArgs e)
        {
            try
            {
                var dte = (DTE)GetService(typeof(DTE));

                if (dte.ActiveDocument == null)
                {
                    return;
                }

                var doc = dte.ActiveDocument.Object("TextDocument") as TextDocument;
                if (null == doc)
                {
                    return;
                }

                var ep = doc.StartPoint.CreateEditPoint();

                ep.EndOfDocument();

                var length = ep.AbsoluteCharOffset;
                ep.StartOfDocument();

                var originalText = ep.GetText(length);

                DocumentScriptCosters.SetDte(dte);

                var coster = DocumentScriptCosters.GetInstance().GetCoster();
                if (coster == null)
                {
                    return;
                }

                if (coster.ShowCosts)
                {
                    coster.ShowCosts = false;
                }
                else
                {
                    coster.ShowCosts = true;
                    coster.AddCosts(originalText, dte.ActiveDocument);
                }
            }
            catch (Exception ee)
            {
                OutputPane.WriteMessage("ToggleQueryCosts error: {0}", ee.Message);
                Log.WriteInfo("ToggleQueryCosts error: {0}", ee.Message);
            }
        }
예제 #19
0
        void BeginGetQuotes(HashSet <Security> toFetch)
        {
            if (_services.Count == 0 || toFetch.Count == 0)
            {
                return;
            }

            UiDispatcher.BeginInvoke(new Action(() =>
            {
                OutputPane output = (OutputPane)provider.GetService(typeof(OutputPane));
                output.Clear();
                output.AppendHeading(Walkabout.Properties.Resources.StockQuoteCaption);
            }));

            List <string> batch = new List <string>();

            foreach (Security s in toFetch)
            {
                if (string.IsNullOrEmpty(s.Symbol))
                {
                    continue; // skip it.
                }
                batch.Add(s.Symbol);
            }

            IStockQuoteService service    = GetHistoryService();
            HistoryDownloader  downloader = GetDownloader(service);

            if (service != null)
            {
                downloader.BeginFetchHistory(batch);
            }

            service = GetQuoteService();
            if (service != null)
            {
                if (service.SupportsBatchQuotes)
                {
                    service.BeginFetchQuotes(batch);
                }
                else
                {
                    foreach (var item in batch)
                    {
                        service.BeginFetchQuote(item);
                    }
                }
            }
        }
예제 #20
0
        public static void DeployFile(string newCode)
        {
            if (String.IsNullOrEmpty(ConnectionString))
            {
                var connectDialog = new ConnectDialog();
                connectDialog.ShowDialog();
                ConnectionString = connectDialog.ConnectionString;

                if (String.IsNullOrEmpty(ConnectionString))
                {
                    return;
                }
            }

            var procedures    = ScriptDom.GetProcedures(newCode);
            var deployScripts = new List <string>();

            foreach (var procedure in procedures)
            {
                OutputPane.WriteMessage("Deploying {0}", procedure.ProcedureReference.Name.ToQuotedString());
                Deploy(BuildIfNotExistsStatements(procedure));
                Deploy(ChangeCreateToAlter(procedure, newCode));
                OutputPane.WriteMessage("Deploying {0}...Done", procedure.ProcedureReference.Name.ToQuotedString());
            }

            var functions = ScriptDom.GetFunctions(newCode);

            foreach (var function in functions)
            {
                OutputPane.WriteMessage("Deploying {0}", function.Name.ToQuotedString());
                if (function.ReturnType is SelectFunctionReturnType)
                {
                    Deploy(BuildIfNotExistsStatementsInlineFunction(function));
                }
                else
                {
                    Deploy(BuildIfNotExistsStatements(function));
                }

                Deploy(ChangeCreateToAlter(function, newCode));
                OutputPane.WriteMessage("Deploying {0}...Done", function.Name.ToQuotedString());
            }

            foreach (var statement in deployScripts)
            {
                Deploy(statement);
            }
            //Deploy();
        }
        public void Stop()
        {
            try
            {
                _gateway.StopTrace();

                foreach (var item in _gateway.GetStatements(ObjectNameCache))
                {
                    CoveredStatements.Enqueue(item);
                }
            }
            catch (Exception e)
            {
                OutputPane.WriteMessageAndActivatePane("CodeCoverage, error stopping the trace: {0}", e);
            }
        }
        //NOT ALL KEYWORDS ARE done LIKE "RETURN"  or datatypes
        private void UpperCase(object sender, EventArgs e)
        {
            var text = GetCurrentDocumentText();

            if (String.IsNullOrEmpty(text))
            {
                return;
            }

            var newText = KeywordCaser.KeywordsToUpper(text);

            if (text != newText)
            {
                SetCurrentDocumentText(newText);
                OutputPane.WriteMessage("Changed keywords to UPPER CASE");
            }
        }
예제 #23
0
 public void LogBlockStart(
     FunctionId functionId,
     LogMessage logMessage,
     int uniquePairId,
     CancellationToken cancellationToken
     )
 {
     OutputPane.WriteLine(
         string.Format(
             "[{0}] Start({1}) : {2} - {3}",
             Environment.CurrentManagedThreadId,
             uniquePairId,
             functionId.ToString(),
             logMessage.GetMessage()
             )
         );
 }
예제 #24
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            var index = item.ItemId % byte.MaxValue;

            if (!Equals(PaneManager.Instance.FromNavContext(OutputPane).CurrentView) || index >= Menu.ButtonCount)
            {
                return(false);
            }

            TextBase.CurrentFocus?.Blur(false);

            var paneId = item.ItemId / byte.MaxValue;

            if (paneId == (int)OutputPane)
            {
                if (Build.VERSION.SdkInt > BuildVersionCodes.JellyBean || Menu.ButtonCount == 1)
                {
                    Droid.Menu.OnClick(Menu, index, this);
                }
                else
                {
                    Droid.Menu.Activated(Menu, EventArgs.Empty);
                }
            }
            else  //Submenus
            {
                var subMenuId = paneId - Enum.GetValues(OutputPane.GetType()).Length;
                var subIndex  = 0;
                for (var i = 0; i < Menu.ButtonCount; i++)
                {
                    var sub = Menu.GetButton(i) as UI.IMenu;
                    if (sub == null)
                    {
                        continue;
                    }
                    if (subMenuId == subIndex)
                    {
                        Droid.Menu.OnClick(sub, index, this);
                        break;
                    }
                    subIndex++;
                }
            }
            return(base.OnOptionsItemSelected(item));
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GitExtCommands"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private GitExtCommands(Package package, _DTE dte, IMenuCommandService menuCommandService)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            _package        = package ?? throw new ArgumentNullException(nameof(package));
            _application    = dte;
            _commandService = menuCommandService;

            try
            {
                RegisterCommands();
                PluginHelpers.AllowCaptionUpdate = true;
            }
            catch (Exception ex)
            {
                OutputPane?.OutputString("Error adding commands: " + ex);
            }
        }
예제 #26
0
        public async Task <IVsOutputWindowPane> GetOutputPaneAsync()
        {
            // this shows how to get VS Services
            // you can add ref to a DLL if needed, and add Using's if needed
            // if you're outputting to the OutputWindow, be aware that the OutputPanes are editor instances, which will
            // look like a leak as they accumulate data.
            Guid            guidPane     = new Guid("{CEEAB38D-8BC4-4675-9DFD-993BBE9996A5}");
            IVsOutputWindow outputWindow = await _asyncServiceProvider.GetServiceAsync(typeof(SVsOutputWindow)) as IVsOutputWindow;

            var crPane = outputWindow.CreatePane(
                ref guidPane,
                "PerfGraphVSIX",
                fInitVisible: 1,
                fClearWithSolution: 0);

            outputWindow.GetPane(ref guidPane, out var OutputPane);
            OutputPane.Activate();
            return(OutputPane);
        }
예제 #27
0
 private static void Deploy(string statement)
 {
     try
     {
         using (var con = new SqlConnection(ConnectionString))
         {
             con.Open();
             using (var cmd = con.CreateCommand())
             {
                 cmd.CommandText = statement;
                 cmd.CommandType = CommandType.Text;
                 cmd.ExecuteNonQuery();
             }
         }
     }
     catch (Exception ex)
     {
         OutputPane.WriteMessage("Error Deploying File: {0}\r\n", ex.Message);
     }
 }
예제 #28
0
        private void Stop(object sender, RoutedEventArgs e)
        {
            try
            {
                _reader.Stop();
                var count = _reader.CoveredStatements.Count;

                CodeCoverageStore.Get.AddStatements(_reader.CoveredStatements, _reader.ObjectNameCache);

                StartButton.IsEnabled = true;
                StopButton.IsEnabled  = false;
                Status.Text           = "Added " + count + " statements to code coverage";

                ShowCodeMap(sender, e);
            }
            catch (Exception ex)
            {
                OutputPane.WriteMessageAndActivatePane("SSDTDevPack: CodeCoverage: Exception calling Stop: {0}", ex);
            }
        }
        private void NameConstraintsCalled(object sender, EventArgs e)
        {
            try
            {
                CallWrapper();

                var dte = (DTE)GetService(typeof(DTE));
                if (null == dte || dte.ActiveDocument == null)
                {
                    return;
                }

                var doc = dte.ActiveDocument.Object("TextDocument") as TextDocument;
                if (null == doc)
                {
                    return;
                }

                var ep = doc.StartPoint.CreateEditPoint();

                ep.EndOfDocument();

                var length = ep.AbsoluteCharOffset;
                ep.StartOfDocument();

                var originalText = ep.GetText(length);

                var namer        = new ConstraintNamer(originalText);
                var modifiedText = namer.Go();

                if (originalText != modifiedText)
                {
                    ep.Delete(length);
                    ep.Insert(modifiedText);
                }
            }
            catch (Exception ex)
            {
                OutputPane.WriteMessage("Exception naming constraints, error: {0}", ex.Message);
            }
        }
예제 #30
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GitExtCommands"/> class.
        /// Adds our command handlers for menu (commands must exist in the command table file)
        /// </summary>
        /// <param name="package">Owner package, not null.</param>
        private GitExtCommands(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            _package        = package;
            _application    = (DTE2)ServiceProvider.GetService(typeof(DTE));
            _commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            try
            {
                RegisterCommands();
                PluginHelpers.AllowCaptionUpdate = true;
            }
            catch (Exception ex)
            {
                OutputPane?.OutputString("Error adding commands: " + ex);
            }
        }