public InsightWindow(SourceEditorView control, Project project, string fileName)
            : base(WindowType.Popup)
        {
            this.control             = control;
            this.fileName = fileName;
            this.project = project;
            /*System.Drawing.Point caretPos  = control.ActiveTextAreaControl.TextArea.Caret.Position;
            System.Drawing.Point visualPos = new System.Drawing.Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X,
                      (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y);*/

            //control.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretOffsetChanged);
            //			control.TextAreaPainter.IHaveTheFocusChanged += focusEventHandler;

            AddEvents ((int) (Gdk.EventMask.KeyPressMask));
            this.SkipPagerHint = true;
            this.SkipTaskbarHint = true;
            this.Decorated = false;
            this.BorderWidth = 2;
            this.TypeHint = Gdk.WindowTypeHint.Dialog;

            desc = new Gtk.Label ("");
            current = new Gtk.Label ("");
            max = new Gtk.Label ("");
            HBox mainBox = new HBox (false, 2);
            mainBox.PackStart (new Gtk.Image (Gtk.Stock.GotoTop, Gtk.IconSize.Menu), false, false, 2);
            mainBox.PackStart (current, false, false, 2);
            mainBox.PackStart (new Gtk.Label (" of "), false, false, 2);
            mainBox.PackStart (max, false, false, 2);
            mainBox.PackStart (new Gtk.Image (Gtk.Stock.GotoBottom, Gtk.IconSize.Menu), false, false, 2);
            mainBox.PackStart (desc);
            Gtk.Frame framer = new Gtk.Frame ();
            framer.Add (mainBox);
            this.Add (framer);
        }
        public SourceEditor(SourceEditorDisplayBindingWrapper bind)
        {
            ShadowType            = Gtk.ShadowType.In;
            DisplayBinding        = bind;
            Buffer                = new SourceEditorBuffer();
            View                  = new SourceEditorView(Buffer, this);
            Buffer.View           = View;
            this.VscrollbarPolicy = PolicyType.Automatic;
            this.HscrollbarPolicy = PolicyType.Automatic;

            AddMarker("SourceEditorBookmark", dragIconPixbuf);
            AddMarker("ExecutionMark", executionMarkerPixbuf);
            AddMarker("BreakpointMark", breakPointPixbuf);

            Add(View);
        }
 public SourceEditorBuffer(SourceEditorView view) : this()
 {
     this.view = view;
 }
        public void SetupDataProvider(Project project, string fileName, SourceEditorView textArea)
        {
            this.fileName = fileName;
            this.textArea = textArea;
            Gtk.TextIter initialIter = textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark);
            initialOffset = initialIter.Offset;

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

            // the parser works with 1 based coordinates
            int caretLineNumber      = initialIter.Line + 1;
            int caretColumn          = initialIter.LineOffset + 1;

            IParserContext parserContext;
            if (project != null)
                parserContext = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
            else
                parserContext = Runtime.ProjectService.ParserDatabase.GetFileParserContext (fileName);

            ResolveResult results = parserContext.Resolve (methodObject, caretLineNumber, caretColumn, fileName, textArea.Buffer.Text);

            if (results != null && results.Type != null) {
                foreach (IClass c in parserContext.GetClassInheritanceTree (results.Type)) {
                    foreach (IIndexer indexer in c.Indexer) {
                        methods.Add(indexer);
                    }
                }

                //FIXME: This shouldnt be commented out, but i replaced the parser and cant figure this out
                /*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 SourceEditorBuffer (SourceEditorView view) : this ()
		{
			this.view = view;
		}
 /// <remarks>
 /// When the key which is defined per XML is pressed, this method will be launched.
 /// </remarks>
 public abstract void Execute(SourceEditorView textArea);
		public override void PreExecute (SourceEditorView sourceView)
		{
			PassToBase = true;
		}
		public override void Execute (SourceEditorView sourceView)
		{
			if (!sourceView.InsertTemplate ())
				PassToBase = true;
		}
		public override void Execute (SourceEditorView sourceView)
		{
			sourceView.FormatLine ();
			PassToBase = false;
		}
 public new void Dispose()
 {
     Buffer.Dispose ();
     Buffer = null;
     Remove (View);
     View.Dispose ();
     View = null;
     DisplayBinding = null;
     base.Dispose ();
 }
        public SourceEditor(SourceEditorDisplayBindingWrapper bind)
        {
            ShadowType = Gtk.ShadowType.In;
            DisplayBinding = bind;
            Buffer = new SourceEditorBuffer ();
            View = new SourceEditorView (Buffer, this);
            Buffer.View = View;
            this.VscrollbarPolicy = PolicyType.Automatic;
            this.HscrollbarPolicy = PolicyType.Automatic;

            View.SetMarkerPixbuf ("SourceEditorBookmark", dragIconPixbuf);
            View.SetMarkerPixbuf ("ExecutionMark", executionMarkerPixbuf);
            View.SetMarkerPixbuf ("BreakpointMark", breakPointPixbuf);

            Add (View);
        }
		/// <remarks>
		/// When the key which is defined in the addin is pressed,
		/// this method will be invoked after Execute ().
		/// </remarks>
		public virtual void PostExecute (SourceEditorView sourceView)
		{
			// reset the state
			pass = false;
		}
		/// <remarks>
		/// When the key which is defined in the addin is pressed,
		/// this method will be invoked before Execute ().
		/// </remarks>
		public virtual void PreExecute (SourceEditorView sourceView)
		{
		}
		/// <remarks>
		/// When the key which is defined in the addin is pressed, this method will be invoked.
		/// </remarks>
		public abstract void Execute (SourceEditorView sourceView);
        public void SetupDataProvider(Project project, string fileName, SourceEditorView textArea)
        {
            this.fileName = fileName;
            this.textArea = textArea;
            Gtk.TextIter initialIter = textArea.Buffer.GetIterAtMark (textArea.Buffer.InsertMark);
            initialOffset = initialIter.Offset;
            string text = textArea.Buffer.Text;

            string word         = TextUtilities.GetExpressionBeforeOffset(textArea, initialOffset);
            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      = initialIter.Line + 1;
            caretColumn          = initialIter.LineOffset + 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];
                }
            }

            IParserContext parserContext;
            if (project != null)
                parserContext = Runtime.ProjectService.ParserDatabase.GetProjectParserContext (project);
            else
                parserContext = Runtime.ProjectService.ParserDatabase.GetFileParserContext (fileName);

            ResolveResult results = parserContext.Resolve (methodObject, caretLineNumber, caretColumn, fileName, text);

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