示例#1
0
        internal static void ProcessValidationReport(IOutputWindow outputWindow, ValidationReporter validationReporter, bool showWarnings)
        {
            // Enumerate all validation messages and write to the output window.
            foreach (ValidationItem item in validationReporter.ValidationItemsList)
            {
                if (item.Severity == Severity.Error)
                {
                    outputWindow.ReportStatusError(OutputWindowErrorSeverity.Error, GetErrorId(item.ValidationCode), GetValidationReporterMessage(item), item.FilePath, item.Line, item.Offset);
                }
                else if (item.Severity == Severity.Warning)
                {
                    outputWindow.ReportStatusError(OutputWindowErrorSeverity.Warning, GetErrorId(item.ValidationCode), GetValidationReporterMessage(item), item.FilePath, item.Line, item.Offset);
                }
                else
                {
                    outputWindow.ReportStatusMessage(GetValidationReporterMessage(item));
                }
            }

            if (validationReporter.HasErrors || (showWarnings && validationReporter.HasWarnings))
            {
                // Display the modal form as well
                var form = new BimlValidationListForm(validationReporter, showWarnings);
                form.ShowDialog();
            }
        }
        public UIControllerService(IAnalyticsService analytics)//, IOutputWindowContainer windowcontainer)
        {
            _analyticsService = analytics;
            //if (GetActiveDocument() == null)//no data set is open. No need to create ouput window.
            //    _outputWindow = null;
            //else
            _outputWindow = null;// windowcontainer.ActiveOutputWindow;

        }
示例#3
0
 public ScenarioRunner(IOutputWindow outputWindow,
     IVisualStudioService visualStudioService,
     IPluginConfiguration configuration,
     IConsoleRunner consoleRunner)
 {
     this.outputWindow = outputWindow;
     this.visualStudioService = visualStudioService;
     this.configuration = configuration;
     this.consoleRunner = consoleRunner;
 }
示例#4
0
        public void Install(TinyIoCContainer container)
        {
            serviceProvider = container.Resolve<IServiceProvider>();
            outputWindow = container.Resolve<IOutputWindow>();
            scenarioRunner = container.Resolve<IScenarioRunner>();

            var mcs = serviceProvider.GetService(typeof (IMenuCommandService)) as OleMenuCommandService;
            if (mcs == null) return;

            var menuCommandId = new CommandID((Identifiers.CommandGroupSet), (int) Identifiers.RunCommandId);
            var menuItem = new MenuCommand(RunCommandOnClick, menuCommandId);
            mcs.AddCommand(menuItem);

            var debugCommandId = new CommandID((Identifiers.CommandGroupSet), (int) Identifiers.DebugCommandId);
            var debugItem = new MenuCommand(DebugCommandOnClick, debugCommandId);
            mcs.AddCommand(debugItem);
        }
        //Adding new output window to the container by provinding the reference of that output window.
        //This method will name that window automatically.
        public void AddOutputWindow(IOutputWindow iow)
        {
            wincount++;
            iow.WindowName = "Ouput and Syntax Window-" + wincount.ToString(); 
            outputlist.Add(iow.WindowName, iow);
            SetActiveOuputWindow(iow.WindowName);
            ////////
            //if (outputlist.Count > 1)
            //{
                MainWindow mwindow = LifetimeService.Instance.Container.Resolve<MainWindow>();//28Jan2013
                Window1 window = LifetimeService.Instance.Container.Resolve<Window1>();
                window.OMH.AddOutputMenuItem(iow.WindowName);/// adding window name to outputmenu. And putting check 
                 //Do same for window menu when you create that menu

                Window temp = iow as Window;
                temp.Height = 650;
                temp.Width = 840;

                temp.Owner = mwindow;// Main Window invisible one is parent and not the app-window that has menus 'File' ...

                temp.Show();
            //}
        }
示例#6
0
        public void Init(EditorWindow parentWin, EditorWindow.EditorView view, ProjectItem pi, string DataFlowGUID)
        {
            this.parentWin = parentWin;
            this.parentView = view;
            this.projectItem = pi;

            //capture the project manager object
            Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)pi.ContainingProject).GetService(typeof(Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
            this.projectManager = (Microsoft.DataWarehouse.Project.DataWarehouseProjectManager)settings.GetType().InvokeMember("ProjectManager", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy, null, settings, null);

            //capture the output window object
            IOutputWindowFactory service = ((System.IServiceProvider)pi.ContainingProject).GetService(typeof(IOutputWindowFactory)) as IOutputWindowFactory;
            this.standardOutputWindow = service.GetStandardOutputWindow(StandardOutputWindow.Debug);

            //run the package immediately
            if (DataFlowGUID == null)
                ExecutePackage();
            else
                BreakdownPipelinePerformance(DataFlowGUID);
        }
示例#7
0
 public OutputWindowTarget(IOutputWindow outputWindow)
 {
     _outputWindow = outputWindow;
 }
示例#8
0
        private void DeployProject(Project proj, IOutputWindow outputWindow, System.Array selectedItems, bool bCreateBat)
        {
            Microsoft.DataWarehouse.Interfaces.IConfigurationSettings settings = (Microsoft.DataWarehouse.Interfaces.IConfigurationSettings)((System.IServiceProvider)proj).GetService(typeof(Microsoft.DataWarehouse.Interfaces.IConfigurationSettings));
            DataWarehouseProjectManager projectManager = (DataWarehouseProjectManager)settings.GetType().InvokeMember("ProjectManager", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy, null, settings, null);

            StringBuilder sBatFileContents = new StringBuilder();
            try
            {
                string sConfigFileName = ((Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)proj).FullName + ".bidsHelper.user";
                System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
                if (System.IO.File.Exists(sConfigFileName))
                {
                    doc.Load(sConfigFileName);
                }

#if SQL2014
                //refreshes the cached target version which is needed in GetPathToDtsExecutable below
                SSISHelpers.ProjectTargetVersion? projectTargetVersion = SSISHelpers.GetProjectTargetVersion(proj);
#endif

                IProjectConfiguration config = projectManager.ConfigurationManager.CurrentConfiguration;
                DtsProjectExtendedConfigurationOptions newOptions = new DtsProjectExtendedConfigurationOptions();
                LoadFromBidsHelperConfiguration(doc, config.DisplayName, newOptions);

                //print out header in output window
                if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.FilePathDestination)
                {
                    if (string.IsNullOrEmpty(newOptions.FilePath))
                    {
                        outputWindow.ReportStatusError(OutputWindowErrorSeverity.Error, "Deployment FilePath is not set. Right click on the project node and set the FilePath property.");
                        return;
                    }
                    outputWindow.ReportStatusMessage("Deploying to file path " + newOptions.FilePath + "\r\n");
                }
                else
                {
                    if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.SsisPackageStoreMsdbDestination)
                    {
                        outputWindow.ReportStatusMessage("Deploying to SSIS Package Store MSDB on server " + newOptions.DestinationServer);
                    }
                    else if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.SsisPackageStoreFileSystemDestination)
                    {
                        outputWindow.ReportStatusMessage("Deploying to SSIS Package Store File System on server " + newOptions.DestinationServer);
                    }
                    else if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.SqlServerDestination)
                    {
                        outputWindow.ReportStatusMessage("Deploying to SQL Server MSDB on server: " + newOptions.DestinationServer);
                    }
                    if (!string.IsNullOrEmpty(newOptions.DestinationFolder))
                        outputWindow.ReportStatusMessage("Deploying to folder: " + newOptions.DestinationFolder);
                    outputWindow.ReportStatusMessage(string.Empty);
                }
                System.Windows.Forms.Application.DoEvents();

                //determine destination types and folders
                string sDestFolder = newOptions.DestinationFolder;
                sDestFolder = sDestFolder.Replace("/", "\\");
                if (!string.IsNullOrEmpty(sDestFolder) && !sDestFolder.EndsWith("\\")) sDestFolder += "\\";
                while (sDestFolder.StartsWith("\\"))
                    sDestFolder = sDestFolder.Substring(1);

                string sDestType = "SQL";
                if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.SsisPackageStoreFileSystemDestination)
                {
                    sDestFolder = "File System\\" + sDestFolder;
                    sDestType = "DTS";
                }
                else if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.SsisPackageStoreMsdbDestination)
                {
                    sDestFolder = "MSDB\\" + sDestFolder;
                    sDestType = "DTS";
                }
                else if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.FilePathDestination)
                {
                    string sDestinationPath = newOptions.FilePath;
                    if (!sDestinationPath.EndsWith("\\")) sDestinationPath += "\\";
                    if (!System.IO.Directory.Exists(sDestinationPath))
                        System.IO.Directory.CreateDirectory(sDestinationPath);
                    sDestFolder = sDestinationPath;
                    sBatFileContents.Append("mkdir \"").Append(sDestFolder).AppendLine("\"");
                }

                //setup Process object to call the dtutil EXE
                System.Diagnostics.Process process = new System.Diagnostics.Process();
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.RedirectStandardOutput = true;
                process.StartInfo.RedirectStandardError = true;
                process.StartInfo.CreateNoWindow = true;
                process.StartInfo.FileName = SSIS.PerformanceVisualization.PerformanceTab.GetPathToDtsExecutable("dtutil.exe", false); //makes the bat file less portable, but does workaround the problem if SSIS2005 and SSIS2008 are both installed... issue 21074

                if (newOptions.DeploymentType != DtsProjectExtendedConfigurationOptions.DeploymentTypes.FilePathDestination)
                {
                    //create the directories
                    string sAccumulatingDir = "";
                    try
                    {
                        foreach (string dir in sDestFolder.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries))
                        {
                            if (!(string.IsNullOrEmpty(sAccumulatingDir) && sDestType == "DTS"))
                            {
                                process.StartInfo.Arguments = string.Format("/FCreate {0};{1};\"{2}\" /SourceServer {3} ", sDestType, (sAccumulatingDir == "" ? "\\" : "\"" + sAccumulatingDir + "\""), dir, newOptions.DestinationServer);
                                sBatFileContents.Append("\"").Append(process.StartInfo.FileName).Append("\" ").AppendLine(process.StartInfo.Arguments);
                                process.Start();
                                process.WaitForExit();
                            }
                            if (!string.IsNullOrEmpty(sAccumulatingDir))
                                sAccumulatingDir += "\\";
                            sAccumulatingDir += dir;
                        }
                    }
                    catch { }
                }

                //loop through each package to deploy
                foreach (object selected in selectedItems)
                {
                    ProjectItem pi;
                    string sFileName;
                    string sFilePath;
                    if (selected is ProjectItem)
                    {
                        pi = (ProjectItem)selected;
                    }
                    else if (selected is UIHierarchyItem && ((UIHierarchyItem)selected).Object is ProjectItem)
                    {
                        pi = ((ProjectItem)((UIHierarchyItem)selected).Object);
                    }
                    else
                    {
                        continue;
                    }
                    sFileName = pi.Name;
                    sFilePath = pi.get_FileNames(0);
                    if (!sFileName.ToLower().EndsWith(".dtsx")) continue;

                    if (pi.Document != null && !pi.Document.Saved)
                    {
                        pi.Save("");
                    }

                    if (newOptions.DeploymentType == DtsProjectExtendedConfigurationOptions.DeploymentTypes.FilePathDestination)
                    {
                        string sDestinationPath = sDestFolder + sFileName;
                        if (System.IO.File.Exists(sDestinationPath))
                        {
                            System.IO.File.SetAttributes(sDestinationPath, System.IO.FileAttributes.Normal);
                        }
                        sBatFileContents.Append("xcopy \"").Append(sFilePath).Append("\" \"").Append(sDestFolder).AppendLine("\" /Y /R");
                        System.IO.File.Copy(sFilePath, sDestinationPath, true);
                        outputWindow.ReportStatusMessage("Deployed " + sFileName);
                    }
                    else
                    {
                        process.Refresh();
                        process.StartInfo.Arguments = string.Format("/FILE \"{0}\" /DestServer {1} /COPY {2};\"{3}\" /Q", sFilePath, newOptions.DestinationServer, sDestType, sDestFolder + sFileName.Substring(0, sFileName.Length - ".dtsx".Length));
                        sBatFileContents.Append("\"").Append(process.StartInfo.FileName).Append("\" ").AppendLine(process.StartInfo.Arguments);
                        process.Start();
                        string sError = process.StandardError.ReadToEnd();
                        string sStandardOutput = process.StandardOutput.ReadToEnd();
                        process.WaitForExit();
                        if (process.ExitCode > 0)
                        {
                            outputWindow.ReportStatusError(OutputWindowErrorSeverity.Error, "BIDS Helper encountered an error when deploying package " + sFileName + "!\r\n\"" + process.StartInfo.FileName + "\" " + process.StartInfo.Arguments + "\r\nexit code = " + process.ExitCode + "\r\n" + sStandardOutput);
                            this.ApplicationObject.ToolWindows.OutputWindow.Parent.AutoHides = false; //pin the window open so you can see the problem
                            return;
                        }
                        outputWindow.ReportStatusMessage("Deployed " + sFileName);
                        System.Windows.Forms.Application.DoEvents();
                    }
                }
                outputWindow.ReportStatusMessage("BIDS Helper completed deploying packages successfully.");

                if (bCreateBat)
                {
                    string sBatFilename = System.IO.Path.GetDirectoryName(((Microsoft.DataWarehouse.VsIntegration.Shell.Project.Extensibility.ProjectExt)proj).FullName);
                    sBatFilename += "\\" + newOptions.OutputPath;
                    if (!System.IO.Directory.Exists(sBatFilename))
                        System.IO.Directory.CreateDirectory(sBatFilename);
                    sBatFilename += "\\bidsHelperDeployPackages.bat";
                    if (System.IO.File.Exists(sBatFilename))
                    {
                        System.IO.File.SetAttributes(sBatFilename, System.IO.FileAttributes.Normal);
                    }
                    System.IO.File.WriteAllText(sBatFilename, sBatFileContents.ToString());
                    outputWindow.ReportStatusMessage("Deployment commands saved to: " + sBatFilename + "\r\n\r\n");
                }
            }
            catch (Exception ex)
            {
                outputWindow.ReportStatusError(OutputWindowErrorSeverity.Error, "BIDS Helper encountered an error when deploying packages:\r\n" + ex.Message + "\r\n" + ex.StackTrace);
                this.ApplicationObject.ToolWindows.OutputWindow.Parent.AutoHides = false; //pin the window open so you can see the problem
            }
        }
 public void LoadOutputWindow(IOutputWindow outputwindow)
 {
     _outputWindow = outputwindow;
 }
 public void AnalysisComplete(AnalyticsData data)
 {
     if (data.Result.Success)
     {
         OutputWindowContainer owc = (LifetimeService.Instance.Container.Resolve<IOutputWindowContainer>()) as OutputWindowContainer;//new line
         _outputWindow = owc.ActiveOutputWindow;//To get active ouput window to populate analysis.AD.
         _outputWindow.Show();
         _outputWindow.AddAnalyis(data);
     }
 }
 // Setting output window as active window for populating output, by providing its name //
 public void SetActiveOuputWindow(string Windowname)
 {
     //string WinName = Windowname.Replace("(Active)", "").Trim();
     if (outputlist.ContainsKey(Windowname))
     {
         outputlist.TryGetValue(Windowname, out activeoutputwindow);//get ref of output window
         ///Defaulting title of all windows ////
         foreach(KeyValuePair<String,IOutputWindow> itm in outputlist)
         {
             Window tempow = itm.Value as Window; 
             tempow.Title = itm.Key;///Key is WindowName
         }
         // Add only (Active) to only one output window
         (activeoutputwindow as Window).Title = Windowname + " (Active)";
     }
     else
         activeoutputwindow = null;
 }
 public RunCustomToolsCommand(IServiceProvider serviceProvider, EnvDTE.DTE dte, IOutputWindow outputWin)
 {
     m_winPane = outputWin.General;
      m_dte = dte as DTE2;
      m_serviceProvider = serviceProvider;
 }