예제 #1
0
        public FunctionFileApp(FunctionFileScanner scanner, ProbeNpp.FunctionFileDatabase.Application_t dbApp)
        {
            if (scanner == null) throw new ArgumentNullException("scanner");
            if (dbApp == null) throw new ArgumentNullException("dbApp");

            _scanner = scanner;
            _name = dbApp.name;

            if (dbApp.function != null)
            {
                foreach (var func in dbApp.function)
                {
                    if (func == null || string.IsNullOrWhiteSpace(func.name) || string.IsNullOrWhiteSpace(func.signature)) continue;
                    _functions[func.name] = func.signature;
                }
            }

            if (dbApp.file != null)
            {
                foreach (var file in dbApp.file)
                {
                    if (file == null || string.IsNullOrWhiteSpace(file.fileName)) continue;
                    _fileDates[file.fileName] = file.modified;
                }
            }
        }
예제 #2
0
        public FunctionFileApp(FunctionFileScanner scanner, string name)
        {
            if (scanner == null) throw new ArgumentNullException("scanner");
            if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name");

            _scanner = scanner;
            _name = name;
        }
예제 #3
0
        public ProbeNppPlugin()
        {
            try
            {
                _instance = this;
                _nppWindow = NppWindow;

                _settings = new Settings(this);
                try
                {
                    _settings.Load();
                }
                catch (Exception ex)
                {
                    Errors.Show(_nppWindow, ex, "Exception when attempting to load ProbeNpp settings.");
                }

                ProbeEnvironment.Initialize();
                ProbeEnvironment.AppChanged += new EventHandler(_env_AppChanged);

                TempManager.Init(Path.Combine(ConfigDir, "Temp"));

                LoadLexerConfig();

                _autoCompletionManager = new AutoCompletion.AutoCompletionManager();
                _smartIndentManager = new AutoCompletion.SmartIndentManager();

                Ready += new NppEventHandler(Plugin_Ready);
                Shutdown += new NppEventHandler(Plugin_Shutdown);
                FileOpened += new FileEventHandler(Plugin_FileOpened);
                FileClosed += new FileEventHandler(Plugin_FileClosed);
                FileActivated += new FileEventHandler(Plugin_FileActivated);
                FileSaved += new FileEventHandler(ProbeNppPlugin_FileSaved);
                LanguageChanged += new LanguageTypeEventHandler(Plugin_LanguageChanged);
                SelectionChanged += new NppEventHandler(Plugin_SelectionChanged);
                Modification += new ModifiedEventHandler(Plugin_Modification);

                CharAdded += new CharAddedEventHandler(ProbeNppPlugin_CharAdded);

                _fileBackground.Execute += new EventHandler(FileBackground_Execute);

                _functionFileScanner = new AutoCompletion.FunctionFileScanner();
                _fileScannerDefer.Execute += new EventHandler(FileScanner_Execute);
                _fileScannerDefer.Activity += new EventHandler(FileScanner_Activity);
            }
            catch (Exception ex)
            {
                Errors.Show(_nppWindow, ex, "The ProbeNpp plug-in thrown an error while initializing.");
            }
        }