public ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped)
        {
            IDocument document =  textArea.Document;
            Console.WriteLine ("resolve " + document.Language);
            Console.WriteLine ("nm " + fileName);
            completionData = new ArrayList();
            this.fileName = fileName;

            // the parser works with 1 based coordinates
            caretLineNumber      = document.GetLineNumberForOffset(textArea.Caret.Offset) + 1;
            caretColumn          = textArea.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1;
            string expression    = TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset);
            ResolveResult results;

            if (expression.Length == 0) {
                return null;
            }
            IParserService           parserService           = (IParserService)MonoDevelop.Core.Services.ServiceManager.Services.GetService(typeof(IParserService));
            if (charTyped == ' ') {
                if (expression == "using" || expression.EndsWith(" using") || expression.EndsWith("\tusing")|| expression.EndsWith("\nusing")|| expression.EndsWith("\rusing")) {
                    string[] namespaces = parserService.GetNamespaceList("");
            //					AddResolveResults(new ResolveResult(namespaces, ShowMembers.Public));
                    AddResolveResults(new ResolveResult(namespaces));
            //					IParseInformation info = parserService.GetParseInformation(fileName);
            //					ICompilationUnit unit = info.BestCompilationUnit as ICompilationUnit;
            //					if (unit != null) {
            //						foreach (IUsing u in unit.Usings) {
            //							if (u.Region.IsInside(caretLineNumber, caretColumn)) {
            //								foreach (string usingStr in u.Usings) {
            //									results = parserService.Resolve(usingStr, caretLineNumber, caretColumn, fileName);
            //									AddResolveResults(results);
            //								}
            //								if (u.Aliases[""] != null) {
            //									results = parserService.Resolve(u.Aliases[""].ToString(), caretLineNumber, caretColumn, fileName);
            //									AddResolveResults(results);
            //								}
            //							}
            //						}
            //					}
                }
            } else {
                //FIXME: I added the null check, #D doesnt need it, why do we?
                if (fileName != null) {
                    Console.WriteLine ("resolve " + document.Language);
                    results = parserService.Resolve(expression,
                                                caretLineNumber,
                                                caretColumn,
                                                fileName,
                                                document.TextContent,
                                document.Language);

                    AddResolveResults(results);
                }
            }

            return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
        }
        public void Attach(TextArea textArea)
        {
            this.textArea = textArea;
            //textArea.AllowDrop = true;

            //textArea.DragEnter += new DragEventHandler(OnDragEnter);
            //textArea.DragDrop  += new DragEventHandler(OnDragDrop);
            //textArea.DragOver  += new DragEventHandler(OnDragOver);
        }
        public ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped)
        {
            CodeTemplateGroup templateGroup = CodeTemplateLoader.GetTemplateGroupPerFilename(fileName);
            if (templateGroup == null) {
                return null;
            }
            ArrayList completionData = new ArrayList();
            foreach (CodeTemplate template in templateGroup.Templates) {
                completionData.Add(new TemplateCompletionData(template));
            }

            return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
        }
        public ICompletionData[] GenerateCompletionData(IProject project, string fileName, TextArea textArea, char charTyped)
        {
            caretLineNumber = textArea.Caret.Line;
            caretColumn     = textArea.Caret.Column;
            LineSegment caretLine = textArea.Document.GetLineSegment(caretLineNumber);
            string lineText = textArea.Document.GetText(caretLine.Offset, caretLine.Length);
            if (!lineText.Trim().StartsWith("///")) {
                return null;
            }

            ArrayList completionData = new ArrayList();
            foreach (string[] tag in commentTags) {
                completionData.Add(new CommentCompletionData(tag[0], tag[1]));
            }
            return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
        }
        public TextAreaControl(TextEditorControl motherTextEditorControl)
            : base(2, 2, false)
        {
            this.motherTextEditorControl = motherTextEditorControl;

            this.textArea                = new TextArea(motherTextEditorControl, this);
            #if GTK
            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);

            textArea.HasFocus = true;
            //Gtk.Table table = new Gtk.Table(2, 2, false);
            Gtk.Table table = this;
            //table.Homogeneous = false;
            table.Attach(textArea, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
            table.Attach(vScrollBar, 1, 2, 0, 1, Gtk.AttachOptions.Shrink, Gtk.AttachOptions.Fill, 0, 0);
            table.Attach(hScrollBar, 0, 1, 1, 2, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
            table.Attach(new Gtk.Label(""), 1, 2, 1, 2, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
            table.ShowAll();
            //Add(table);

            ScrollEvent += new GtkSharp.ScrollEventHandler(OnScroll);
            ButtonPressEvent += new GtkSharp.ButtonPressEventHandler(OnButtonPress);
            #else
                        Controls.Add(textArea);

            vScrollBar.ValueChanged += new EventHandler(VScrollBarValueChanged);
            Controls.Add(this.vScrollBar);

            hScrollBar.ValueChanged += new EventHandler(HScrollBarValueChanged);
                        Controls.Add(this.hScrollBar);
                        ResizeRedraw = true;
            #endif

            Document.DocumentChanged += new DocumentEventHandler(AdjustScrollBars);
        }
 public GutterMargin(TextArea textArea)
     : base(textArea)
 {
 }
 public IconBarMargin(TextArea textArea)
     : base(textArea)
 {
 }
		public TextAreaMouseHandler(TextArea textArea)
		{
			this.textArea = textArea;
		}
 public FoldMargin(TextArea textArea)
     : base(textArea)
 {
 }
 public AbstractMargin(TextArea textArea)
 {
     this.textArea = textArea;
 }
        public void SetupDataProvider(string fileName, TextArea textArea)
        {
            this.fileName = fileName;
            this.document = textArea.Document;
            this.textArea = textArea;
            initialOffset = textArea.Caret.Offset;

            string word         = TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset);
            string methodObject = word;

            // the parser works with 1 based coordinates
            int caretLineNumber      = document.GetLineNumberForOffset(textArea.Caret.Offset) + 1;
            int caretColumn          = textArea.Caret.Offset - document.GetLineSegment(caretLineNumber - 1).Offset + 1;
            IParserService parserService = (IParserService)ServiceManager.Services.GetService(typeof(IParserService));
            ResolveResult results = parserService.Resolve(methodObject,
                                                          caretLineNumber,
                                                          caretColumn,
                                                          fileName,
                                                          document.TextContent);
            if (results != null && results.Type != null) {
                foreach (IClass c in results.Type.ClassInheritanceTree) {
                    foreach (IIndexer indexer in c.Indexer) {
                        methods.Add(indexer);
                    }
                }
                foreach (object o in results.ResolveContents) {
                    if (o is IClass) {
                        foreach (IClass c in ((IClass)o).ClassInheritanceTree) {
                            foreach (IIndexer indexer in c.Indexer) {
                                methods.Add(indexer);
                            }
                        }
                    }
                }
            }
        }
 public TextAreaClipboardHandler(TextArea textArea)
 {
     this.textArea = textArea;
     clipboard = Gtk.Clipboard.Get (Gdk.Atom.Intern("CLIPBOARD", false));
     textArea.SelectionManager.SelectionChanged += new EventHandler(DocumentSelectionChanged);
 }
 public override void Execute(TextArea services)
 {
     CompletionWindow completionWindow = new CompletionWindow(services.MotherTextEditorControl, "a.cs", new TemplateCompletionDataProvider());
     completionWindow.ShowCompletionWindow('\0');
 }
        Layout _layout; // Avoid building new layouts all the time

        #endregion Fields

        #region Constructors

        public TextView(TextArea textArea)
            : base(textArea)
        {
            _layout = new Layout(textArea.PangoContext);
            OptionsChanged();
        }
        public void SetupDataProvider(string fileName, TextArea textArea)
        {
            IDocument document = textArea.Document;

            this.fileName = fileName;
            this.document = document;
            this.textArea = textArea;
            initialOffset = textArea.Caret.Offset;

            string word         = TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset);
            string methodObject = word;
            string methodName   =  null;
            int idx = methodObject.LastIndexOf('.');
            if (idx >= 0) {
                methodName   = methodObject.Substring(idx + 1);
                methodObject = methodObject.Substring(0, idx);
            } else {
                methodObject = "this";
                methodName   = word;
            }

            if (methodName.Length == 0 || methodObject.Length == 0) {
                return;
            }

            // the parser works with 1 based coordinates
            caretLineNumber      = document.GetLineNumberForOffset(textArea.Caret.Offset) + 1;
            caretColumn          = textArea.Caret.Offset - document.GetLineSegment(caretLineNumber).Offset + 1;

            string[] words = word.Split(' ');
            bool contructorInsight = false;
            if (words.Length > 1) {
                contructorInsight = words[words.Length - 2] == "new";
                if (contructorInsight) {
                    methodObject = words[words.Length - 1];
                }
            }
            IParserService parserService = (IParserService)ServiceManager.Services.GetService(typeof(IParserService));
            ResolveResult results = parserService.Resolve(methodObject, caretLineNumber, caretColumn, fileName, document.TextContent);

            if (results != null && results.Type != null) {
                if (contructorInsight) {
                    AddConstructors(results.Type);
                } else {
                    foreach (IClass c in results.Type.ClassInheritanceTree) {
                        AddMethods(c, methodName, false);
                    }
                }
            }
        }