Пример #1
0
        public void SetupIntellisense(TextEditorControl control)
        {
            _control = control;

            control.SetHighlighting((SupportedLanguage == SupportedLanguage.CSharp) ? "C#" : "VBNET");
            control.ShowEOLMarkers   = false;
            control.ShowInvalidLines = false;

            HostCallbackImplementation.Register(this);
            CodeCompletionKeyHandler.Attach(this, control);
            ToolTipProvider.Attach(this, control);

            ProjectContentRegistry = new ProjectContentRegistry();             // Default .NET 2.0 registry

            // Persistence lets SharpDevelop.Dom create a cache file on disk so that
            // future starts are faster.
            // It also caches XML documentation files in an on-disk hash table, thus
            // reducing memory usage.
            try
            {
                if (Settings.Default.CacheFiles)
                {
                    var persistencePath  = Path.Combine(Path.GetTempPath(), ReflexilPersistence);
                    var persistenceCheck = Path.Combine(persistencePath, ReflexilPersistenceCheck);

                    Directory.CreateDirectory(persistencePath);             // Check write/access to directory
                    File.WriteAllText(persistenceCheck, @"Using cache!");   // Check write file rights
                    File.ReadAllText(persistenceCheck);                     // Check read file rights

                    ProjectContentRegistry.ActivatePersistence(persistencePath);
                }
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch (Exception)
            {
                // don't use cache file
            }

            ProjectContent = new DefaultProjectContent {
                Language = LanguageProperties
            };
            ParseInformation = new ParseInformation(new DefaultCompilationUnit(ProjectContent));
        }
Пример #2
0
        public PDDLTabItem(string moduleName)
        {
            InitializeComponent();
            AddEventHandlerForButtons();

            toolStripContainer1.Visible = false;

            textEditorControl                  = new SharpDevelopTextAreaControl();
            textEditorControl.Dock             = DockStyle.Fill;
            textEditorControl.ContextMenuStrip = EditorContextMenuStrip;
            textEditorControl.BorderStyle      = BorderStyle.Fixed3D;
            textEditorControl.Visible          = true;

            splitContainer1.Panel2.Controls.Add(textEditorControl);

            TabText = "Document " + counter;
            counter++;

            textEditorControl.FileNameChanged += _EditorControl_FileNameChanged;
            textEditorControl.TextChanged     += textEditorControl_TextChanged;
            textEditorControl.Tag              = this;


            Padding       = new Padding(2, 2, 2, 2);
            DockableAreas = DockAreas.Document;

            secondaryViewContentCollection = new SecondaryViewContentCollection(this);
            InitFiles();

            file                       = FileService.CreateUntitledOpenedFile(TabText, new byte[] { });
            file.CurrentView           = this;
            textEditorControl.FileName = file.FileName;
            files.Clear();
            files.Add(file);

            SetSyntaxLanguage(moduleName);

            textEditorControl.Document.FoldingManager.FoldingStrategy = new FoldingStrategy();

            // Highlight the matching bracket or not...
            textEditorControl.ShowMatchingBracket  = true;
            textEditorControl.BracketMatchingStyle = BracketMatchingStyle.Before;


            HostCallbackImplementation.Register(this);
            CodeCompletionKeyHandler.Attach(this, textEditorControl);
            ToolTipProvider.Attach(this, textEditorControl);

            pcRegistry = new ProjectContentRegistry(); // Default .NET 2.0 registry

            // Persistence lets SharpDevelop.Dom create a cache file on disk so that
            // future starts are faster.
            // It also caches XML documentation files in an on-disk hash table, thus
            // reducing memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion"));

            myProjectContent          = new DefaultProjectContent();
            myProjectContent.Language = LanguageProperties.CSharp;

            TreeView_Structure.HideSelection = false;
            splitContainer1.SplitterDistance = 100;
            TreeView_Structure.ExpandAll();
            ProblemsNode.ExpandAll();
        }