Esempio n. 1
0
        public IEnumerable <Type> Scope(ISyntaxNode context, Type scopeType)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            List <Type> scope = new List <Type>();

            ScriptConcept script = context.Ancestor <ScriptConcept>() as ScriptConcept;

            if (script == null)
            {
                return(scope);
            }

            foreach (var statement in script.Statements)
            {
                if (!(statement is UseDatabaseConcept database))
                {
                    continue;
                }
                if (database.Assembly == null)
                {
                    continue;
                }
                foreach (Type type in database.Assembly.GetTypes()
                         .Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(ReferenceObject))))
                {
                    scope.Add(type);
                }
            }
            return(scope);
        }
Esempio n. 2
0
        private void CreateCodeEditor(object parameter)
        {
            ScriptConcept script = new ScriptConcept();
            CodeEditor    editor = new CodeEditor()
            {
                DataContext = SyntaxTreeController.Current.CreateSyntaxNode(null, script)
            };

            Shell.AddTabItem("SCRIPT", editor);
        }