Ejemplo n.º 1
0
 public DefaultFormattingStrategy(CodeEditor editor)
 {
     FEditor = editor;
 }
Ejemplo n.º 2
0
        public CodeEditorPlugin(IHDEHost host, INode node, ISolution solution, ILogger logger)
        {
            FHDEHost   = host;
            FNode      = node;
            FSolution  = solution;
            FLogger    = logger;
            FErrorList = new ViewableCollection <object>();

            if (CompletionIcons.Images.Count == 0)
            {
                var resources = new ComponentResourceManager(typeof(CodeEditorPlugin));
                CompletionIcons.TransparentColor = System.Drawing.Color.Transparent;
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Class"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Method"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Property"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Field"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Enum"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.NameSpace"));
                CompletionIcons.Images.Add((System.Drawing.Bitmap)resources.GetObject("Icons.16x16.Event"));

                var path     = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"..\..\thirdparty"));
                var provider = new SD.FileSyntaxModeProvider(path);
                SD.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);
            }

            SuspendLayout();

            FCodeEditorForm                     = new Form();
            FCodeEditorForm.Location            = new Point(0, 0);
            FCodeEditorForm.TopLevel            = false;
            FCodeEditorForm.TopMost             = false;
            FCodeEditorForm.Dock                = DockStyle.Fill;
            FCodeEditorForm.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            FCodeEditorForm.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            FCodeEditorForm.BackColor           = System.Drawing.Color.Silver;
            FCodeEditorForm.ClientSize          = new System.Drawing.Size(881, 476);
            FCodeEditorForm.ControlBox          = false;
            FCodeEditorForm.FormBorderStyle     = System.Windows.Forms.FormBorderStyle.None;
            FCodeEditorForm.MaximizeBox         = false;
            FCodeEditorForm.MinimizeBox         = false;
            FCodeEditorForm.ShowIcon            = false;
            FCodeEditorForm.ShowInTaskbar       = false;
            FCodeEditorForm.SizeGripStyle       = System.Windows.Forms.SizeGripStyle.Hide;
            FCodeEditorForm.TopMost             = true;
            FCodeEditorForm.Show();

            FEditor      = new CodeEditor(FCodeEditorForm, FLogger);
            FEditor.Dock = DockStyle.Fill;
            FCodeEditorForm.Controls.Add(FEditor);

            FErrorTableViewer              = new TableViewer();
            FErrorTableViewer.Dock         = DockStyle.Bottom;
            FErrorTableViewer.TabIndex     = 0;
            FErrorTableViewer.DoubleClick += FErrorTableViewerDoubleClick;
            FErrorTableViewer.AutoSize     = true;
            FErrorTableViewer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            FErrorTableViewer.MaximumSize  = new Size(0, 100);

            Controls.Add(FCodeEditorForm);
            Controls.Add(FErrorTableViewer);

            ResumeLayout(false);
            PerformLayout();

            var registry = new MappingRegistry();

            registry.RegisterDefaultMapping <IEnumerable <Column>, ErrorCollectionColumnProvider>();
            registry.RegisterMapping <CompilerError, IEnumerable <ICell>, ErrorCellProvider>();
            registry.RegisterMapping <RuntimeError, IEnumerable <ICell>, RuntimeErrorCellProvider>();

            FErrorTableViewer.Registry = registry;
            FErrorTableViewer.Input    = FErrorList;

            FEditor.LinkClicked += FEditor_LinkClicked;
        }