Пример #1
0
        public static void AttachIncrementalCompilerToTextEditorDocument(TypeCobolEditor textEditor, CompilationProject project, string textName, TypeCobolOptions compilerOptions, IObserver <IList <CompilationError> > errorObserver)
        {
            var serviceContainer = textEditor.TextArea.TextView.Services;

            if (serviceContainer.GetService(typeof(TypeCobolCompilerService)) != null)
            {
                serviceContainer.RemoveService(typeof(TypeCobolCompilerService));
            }

            TypeCobolCompilerService compilerService = new TypeCobolCompilerService(textEditor, project, textName, compilerOptions, errorObserver);

            serviceContainer.AddService(typeof(TypeCobolCompilerService), compilerService);
        }
Пример #2
0
        public TypeCobolWindow()
        {
            InitializeComponent();

            // Default directory at startup
            currentProject = new CompilationProject("project",
                                                    DEFAULT_DIRECTORY, new string[] { ".txt", "*.cbl", "*.cpy" },
                                                    DEFAULT_DOCUMENT_FORMAT.Encoding, DEFAULT_DOCUMENT_FORMAT.EndOfLineDelimiter, DEFAULT_DOCUMENT_FORMAT.FixedLineLength, DEFAULT_DOCUMENT_FORMAT.ColumnsLayout, new TypeCobolOptions());

            // Default compiler options
            compilerOptions = new TypeCobolOptions();

            // Incremental TypeCobol compilation
            TypeCobolCompilerService.AttachIncrementalCompilerToTextEditorDocument(textEditor, currentProject, null, compilerOptions, this);
        }
Пример #3
0
        void openFileClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.CheckFileExists = true;
            if (Directory.Exists(DEFAULT_DIRECTORY))
            {
                dlg.InitialDirectory = DEFAULT_DIRECTORY;
            }
            if (dlg.ShowDialog() ?? false)
            {
                currentProject = new CompilationProject("project",
                                                        Path.GetDirectoryName(dlg.FileName), new string[] { ".txt", "*.cbl", "*.cpy" },
                                                        DEFAULT_DOCUMENT_FORMAT.Encoding, DEFAULT_DOCUMENT_FORMAT.EndOfLineDelimiter, DEFAULT_DOCUMENT_FORMAT.FixedLineLength, DEFAULT_DOCUMENT_FORMAT.ColumnsLayout, new TypeCobolOptions());
                string textName = Path.GetFileNameWithoutExtension(dlg.FileName);
                TypeCobolCompilerService.AttachIncrementalCompilerToTextEditorDocument(textEditor, currentProject, textName, compilerOptions, this);
            }
        }
        public static void AttachIncrementalCompilerToTextEditorDocument(TypeCobolEditor textEditor, CompilationProject project, string textName, TypeCobolOptions compilerOptions, IObserver<IList<CompilationError>> errorObserver)
        {
            var serviceContainer = textEditor.TextArea.TextView.Services;
            if (serviceContainer.GetService(typeof(TypeCobolCompilerService)) != null)
            {
                serviceContainer.RemoveService(typeof(TypeCobolCompilerService));
            }

            TypeCobolCompilerService compilerService = new TypeCobolCompilerService(textEditor, project, textName, compilerOptions, errorObserver);
            serviceContainer.AddService(typeof(TypeCobolCompilerService), compilerService);
        }