Exemple #1
0
        public override bool SaveOptions()
        {
            var newlist = new List <ExternalTool>();

            foreach (ExternalTool tool in listBox.Items)
            {
                if (!FileUtility.IsValidPath(StringParser.Parse(tool.Command)))
                {
                    if (!Regex.IsMatch(tool.Command, @"^\$\{SdkToolPath:[\w\d]+\.exe\}$"))
                    {
                        // Always treat SdkToolPath entries as valid - this allows saving the tool options
                        // with the default entries even when the .NET SDK is not installed.
                        MessageService.ShowError(String.Format("The command of tool \"{0}\" is invalid.", tool.MenuCommand));
                        return(false);
                    }
                }
                if ((tool.InitialDirectory != String.Empty) && (!FileUtility.IsValidPath(tool.InitialDirectory)))
                {
                    MessageService.ShowError(String.Format("The working directory of tool \"{0}\" is invalid.", tool.MenuCommand));
                    return(false);
                }
                newlist.Add(tool);
            }

            ToolLoader.Tool = newlist;
            ToolLoader.SaveTools();

            return(true);
        }
Exemple #2
0
        public override bool StorePanelContents()
        {
            ArrayList newlist = new ArrayList();

            foreach (ExternalTool tool in ((ListBox)ControlDictionary["toolListBox"]).Items)
            {
                if (!FileUtilityService.IsValidFileName(tool.Command))
                {
                    MessageService.ShowError(String.Format("The command of tool \"{0}\" is invalid.", tool.MenuCommand));
                    return(false);
                }
                newlist.Add(tool);
            }

            ToolLoader.Tool = newlist;
            ToolLoader.SaveTools();

            ((DefaultWorkbench)WorkbenchSingleton.Workbench).CreateMenu(null, null);
            return(true);
        }
Exemple #3
0
        public override bool StorePanelContents()
        {
            List <ExternalTool> newlist = new List <ExternalTool>();

            foreach (ExternalTool tool in ((ListBox)ControlDictionary["toolListBox"]).Items)
            {
                if (!FileUtility.IsValidFileName(tool.Command))
                {
                    MessageService.ShowError(String.Format("The command of tool \"{0}\" is invalid.", tool.MenuCommand));
                    return(false);
                }
                if ((tool.InitialDirectory != "") && (!FileUtility.IsValidFileName(tool.InitialDirectory)))
                {
                    MessageService.ShowError(String.Format("The working directory of tool \"{0}\" is invalid.", tool.MenuCommand));
                    return(false);
                }
                newlist.Add(tool);
            }

            ToolLoader.Tool = newlist;
            ToolLoader.SaveTools();

            return(true);
        }