private void MainForm_Load(object sender, EventArgs e) {
			var menuItems = new List<ToolStripMenuItem>();
			foreach (var codeToXml in PluginManager.CodeToXmls) {
				var menuItem =
						menuItemLanguage.DropDownItems.Add(codeToXml.ParserName) as ToolStripMenuItem;
				menuItems.Add(menuItem);
				var codeToXmlForClosure = codeToXml;
				menuItem.Click += (o, args) => {
					_activeCodeToXml = codeToXmlForClosure;
					foreach (var item in menuItems) {
						item.Checked = false;
					}
					menuItem.Checked = true;

					Code = "";
					_activeFile = null;
					lvModifiableFile.Items.Clear();
					lvFreezedFile.Items.Clear();
					lvModifiableRule.Items.Clear();
					lvFreezedRule.Items.Clear();
					lvWillBeMarkedElements.Items.Clear();
					lvMarkedElements.Items.Clear();
				};
				if (codeToXml is JavaCodeToXml) {
					menuItem.PerformClick();
				}
			}
		}
        private void MainForm_Load(object sender, EventArgs e)
        {
            var menuItems = new List <ToolStripMenuItem>();

            foreach (var codeToXml in PluginManager.CodeToXmls)
            {
                var menuItem =
                    menuItemLanguage.DropDownItems.Add(codeToXml.ParserName) as ToolStripMenuItem;
                menuItems.Add(menuItem);
                var codeToXmlForClosure = codeToXml;
                menuItem.Click += (o, args) => {
                    _activeCodeToXml = codeToXmlForClosure;
                    foreach (var item in menuItems)
                    {
                        item.Checked = false;
                    }
                    menuItem.Checked = true;

                    Code        = "";
                    _activeFile = null;
                    lvModifiableFile.Items.Clear();
                    lvFreezedFile.Items.Clear();
                    lvModifiableRule.Items.Clear();
                    lvFreezedRule.Items.Clear();
                    lvWillBeMarkedElements.Items.Clear();
                    lvMarkedElements.Items.Clear();
                };
                if (codeToXml is JavaCodeToXml)
                {
                    menuItem.PerformClick();
                }
            }
        }
 public CodeFile(CodeToXml codeToXml, FileInfo info)
 {
     Info           = info;
     Code           = GuessEncoding.ReadAllText(info.FullName);
     Ast            = codeToXml.Generate(Code);
     Range2Elements = new Dictionary <CodeRange, XElement>();
 }
        private void SetItemCheckedWithAstGenerator(CodeToXml xmlGenerator)
        {
            var extensions = xmlGenerator.TargetExtensions;
            var count      = clbFiles.Items.Count;

            for (int i = 0; i < count; i++)
            {
                var relativePath = clbFiles.Items[i] as string;
                var isTargetFile =
                    extensions.Contains(Path.GetExtension(relativePath).ToLower());
                clbFiles.SetItemChecked(i, isTargetFile);
            }
        }
		public CodeFile(CodeToXml codeToXml, FileInfo info) {
			Info = info;
			Code = GuessEncoding.ReadAllText(info.FullName);
			Ast = codeToXml.Generate(Code);
			Range2Elements = new Dictionary<CodeRange, XElement>();
		}
Beispiel #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var menuItems = new List<ToolStripMenuItem>();
            foreach (var codeToXml in PluginManager.CodeToXmls) {
                var menuItem =
                        menuLanguage.DropDownItems.Add(codeToXml.ParserName) as ToolStripMenuItem;
                menuItems.Add(menuItem);
                var codeToXmlForClosure = codeToXml;
                menuItem.Click += (o, args) => {
                    _activeCodeToXml = codeToXmlForClosure;
                    foreach (var item in menuItems) {
                        item.Checked = false;
                    }
                    menuItem.Checked = true;
                };
            }

            txtOriginalCode.Text = Resources.originalCode
                    .Replace("\r\n", "\n")
                    .Replace("\n", Environment.NewLine);
            txtExampleCode.Text = Resources.exampleCode
                    .Replace("\r\n", "\n")
                    .Replace("\n", Environment.NewLine);
        }
		private void SetItemCheckedWithAstGenerator(CodeToXml xmlGenerator) {
			var extensions = xmlGenerator.TargetExtensions;
			var count = clbFiles.Items.Count;
			for (int i = 0; i < count; i++) {
				var relativePath = clbFiles.Items[i] as string;
				var isTargetFile =
						extensions.Contains(Path.GetExtension(relativePath).ToLower());
				clbFiles.SetItemChecked(i, isTargetFile);
			}
		}