예제 #1
0
        public ChangeAST RemoveImports(ChangeAST change, IEnumerable <ImportedModule> imports)
        {
            var groupedByPath = imports.GroupBy(i => i.Path);

            foreach (var byPath in groupedByPath)
            {
                var existingImportsForPath = Imports.SingleOrDefault(i => i.FilePath == byPath.Key);
                if (existingImportsForPath != null)
                {
                    existingImportsForPath.Remove(imports);
                    change.Delete(existingImportsForPath.ImportDeclaration);
                    change.ChangeNode(existingImportsForPath.ImportDeclaration, existingImportsForPath.Serialize());
                }
            }
            return(change);
        }
예제 #2
0
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            var node = lbNodes.SelectedItem as Node;

            if (node != null)
            {
                try
                {
                    if (_currentChangeAst == null)
                    {
                        _currentChangeAst = new ChangeAST(_nodeChangeItems);
                    }
                    _currentChangeAst.Delete(node);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.ToString());
                }
            }
        }