Inheritance: MonoDevelop.Ide.Gui.AbstractViewContent, IExtensibleTextEditor, IBookmarkBuffer, IClipboardHandler, ICompletionWidget, ISplittable, IFoldable, IToolboxDynamicProvider, IEncodedTextContent, ICustomFilteringToolboxConsumer, IZoomable, ITextEditorResolver, Mono.TextEditor.ITextEditorDataProvider, ICodeTemplateHandler, ICodeTemplateContextProvider, ISupportsProjectReload, IPrintable
		void Initialize (SourceEditorView view)
		{
			this.view = view;
			Caret.PositionChanged += delegate {
				if (Extension != null) {
					try {
						Extension.CursorPositionChanged ();
					} catch (Exception ex) {
						ReportExtensionError (ex);
					}
				}
			};
			
			Document.TextReplaced += HandleSkipCharsOnReplace;
			
			Document.TextReplaced += delegate(object sender, ReplaceEventArgs args) {
				if (Extension != null) {
					try {
						Extension.TextChanged (args.Offset, args.Offset + Math.Max (args.Count, args.Value != null ? args.Value.Length : 0));
					} catch (Exception ex) {
						ReportExtensionError (ex);
					}
				}
			};
			
			UpdateEditMode ();
			this.GetTextEditorData ().Paste += HandleTextPaste;
			
			this.ButtonPressEvent += OnPopupMenu;
		}
Esempio n. 2
0
 protected override void Update(CommandArrayInfo ainfo)
 {
     MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
     if (doc != null)
     {
         SourceEditorView view = IdeApp.Workbench.ActiveDocument.GetContent <SourceEditorView>();
         if (view != null)
         {
             DocumentLocation location = view.TextEditor.Caret.Location;
             if (location.IsEmpty)
             {
                 return;
             }
             DocumentLine line = view.Document.GetLine(location.Line);
             if (line == null || line.Markers == null)
             {
                 return;
             }
             foreach (TextLineMarker marker in line.Markers)
             {
                 UrlMarker urlMarker = marker as UrlMarker;
                 if (urlMarker != null)
                 {
                     if (urlMarker.StartColumn <= location.Column && location.Column < urlMarker.EndColumn)
                     {
                         ainfo.Add(urlMarker.UrlType == UrlType.Email ? GettextCatalog.GetString("_Write an e-mail to...") : GettextCatalog.GetString("_Open URL..."), urlMarker);
                         ainfo.AddSeparator();
                     }
                 }
             }
         }
     }
 }
Esempio n. 3
0
        public void ReportTimings(SourceEditorView sourceEditorView)
        {
            if (count == 0)
            {
                // No timings recorded.
                return;
            }

            string extension = sourceEditorView.Document.FileName.Extension;

            var metadata = new Dictionary <string, string> ();

            if (!string.IsNullOrEmpty(extension))
            {
                metadata ["Extension"] = extension;
            }

            var average = totalTime.TotalMilliseconds / count;

            metadata ["Average"] = average.ToString();
            metadata ["First"]   = firstTime.Value.TotalMilliseconds.ToString();
            metadata ["Maximum"] = maxTime.TotalMilliseconds.ToString();

            Counters.Typing.Inc(metadata);
        }
Esempio n. 4
0
        protected override void OnDestroyed()
        {
            ExtensionContext = null;
            view             = null;

            base.OnDestroyed();
        }
Esempio n. 5
0
        void Initialize(SourceEditorView view)
        {
            this.view              = view;
            Caret.PositionChanged += delegate {
                if (Extension != null)
                {
                    try {
                        Extension.CursorPositionChanged();
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            Document.TextReplaced += HandleSkipCharsOnReplace;

            Document.TextReplaced += delegate(object sender, ReplaceEventArgs args) {
                if (Extension != null)
                {
                    try {
                        Extension.TextChanged(args.Offset, args.Offset + Math.Max(args.Count, args.Value != null ? args.Value.Length : 0));
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            UpdateEditMode();
            this.GetTextEditorData().Paste += HandleTextPaste;

            this.ButtonPressEvent += OnPopupMenu;

            AddinManager.AddExtensionNodeHandler("MonoDevelop/SourceEditor2/TooltipProviders", OnTooltipProviderChanged);
        }
Esempio n. 6
0
 protected override void OnDestroyed()
 {
     view = null;
     this.ButtonPressEvent -= OnPopupMenu;
     AddinManager.RemoveExtensionNodeHandler("MonoDevelop/SourceEditor2/TooltipProviders", OnTooltipProviderChanged);
     base.OnDestroyed();
 }
Esempio n. 7
0
        void Initialize(SourceEditorView view)
        {
            this.view              = view;
            Caret.PositionChanged += delegate {
                if (Extension != null)
                {
                    try {
                        Extension.CursorPositionChanged();
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            Document.TextReplaced += HandleSkipCharsOnReplace;

            Document.TextReplaced += delegate(object sender, DocumentChangeEventArgs args) {
                if (Extension != null)
                {
                    try {
                        Extension.TextChanged(args.Offset, args.Offset + Math.Max(args.RemovalLength, args.InsertionLength));
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            UpdateEditMode();
            this.DoPopupMenu = ShowPopup;
        }
Esempio n. 8
0
        void Initialize(SourceEditorView view)
        {
            this.view              = view;
            Caret.PositionChanged += delegate {
                if (Extension != null)
                {
                    try {
                        Extension.CursorPositionChanged();
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            Document.TextReplaced += HandleSkipCharsOnReplace;

            Document.TextReplaced += delegate(object sender, ReplaceEventArgs args) {
                if (Extension != null)
                {
                    try {
                        Extension.TextChanged(args.Offset, args.Offset + Math.Max(args.Count, args.Value != null ? args.Value.Length : 0));
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            UpdateEditMode();
            this.GetTextEditorData().Paste += HandleTextPaste;
            this.DoPopupMenu = ShowPopup;
        }
Esempio n. 9
0
		void Initialize (SourceEditorView view)
		{
			this.view = view;
			Caret.PositionChanged += delegate {
				if (Extension != null) {
					try {
						Extension.CursorPositionChanged ();
					} catch (Exception ex) {
						ReportExtensionError (ex);
					}
				}
			};
			
			Document.TextReplaced += HandleSkipCharsOnReplace;
			
			Document.TextReplaced += delegate(object sender, DocumentChangeEventArgs args) {
				if (Extension != null) {
					try {
						Extension.TextChanged (args.Offset, args.Offset + Math.Max (args.RemovalLength, args.InsertionLength));
					} catch (Exception ex) {
						ReportExtensionError (ex);
					}
				}
			};
			
			UpdateEditMode ();
			this.DoPopupMenu = ShowPopup;
		}
Esempio n. 10
0
 public static void Add(SourceEditorView sourceEditorView)
 {
     if (sourceEditorView.TextEditorType == TextEditorType.Projection)
     {
         return;
     }
     openFiles.Add(sourceEditorView);
 }
Esempio n. 11
0
        protected override void OnDestroyed()
        {
            ExtensionContext       = null;
            view                   = null;
            this.ButtonPressEvent -= OnPopupMenu;

            base.OnDestroyed();
        }
        public void TestBug4764()
        {
            var data = Create("foo = $");
            var ctx  = new CodeCompletionContext();

            ctx.TriggerOffset = data.Caret.Offset;
            SourceEditorView.SetCompletionText(data, ctx, "", "(o,s) |;", 0);
            Check(data, "foo = (o,s) $;");
        }
Esempio n. 13
0
 public static void Remove(SourceEditorView sourceEditorView)
 {
     if (sourceEditorView.TextEditorType == TextEditorType.Projection)
     {
         return;
     }
     openFiles.Remove(sourceEditorView);
     UpdateEolMessages();
 }
//		new Gdk.Rectangle bounds;
		
		public MessageBubbleHighlightPopupWindow (SourceEditorView view, MessageBubbleTextMarker marker)
			: base (view.TextEditor)
		{
			this.marker = marker;
			
			ExpandWidth = 36;
			ExpandHeight = 2;
			BounceEasing = Easing.Sine;
			Duration = 150;
		}
        public MessageBubbleHighlightPopupWindow(SourceEditorView view, MessageBubbleTextMarker marker)
            : base(view.TextEditor)
        {
            this.marker = marker;

            ExpandWidth  = 36;
            ExpandHeight = 2;
            BounceEasing = Easing.Sine;
            Duration     = 600;
        }
Esempio n. 16
0
 protected override void OnDestroyed()
 {
     ExtensionContext = null;
     view             = null;
     base.OnDestroyed();
     if (Options != null)
     {
         Options.Dispose();
         base.Options = null;
     }
 }
		public override MonoDevelop.Ide.Gui.IViewContent CreateContentForMimeType (string mimeType, System.IO.Stream content)
		{
			SourceEditorView result = new SourceEditorView ();
			result.Document.MimeType = mimeType;
			if (content != null) {
				using (StreamReader reader = new StreamReader (content)) {
					result.Document.Text = reader.ReadToEnd ();
				}
			}
			return result;
		}
        void Initialize(SourceEditorView view)
        {
            this.view = view;

            Document.SyntaxModeChanged += delegate {
                UpdateSemanticHighlighting();
            };

            UpdateEditMode();
            this.DoPopupMenu = ShowPopup;
        }
        public override MonoDevelop.Ide.Gui.IViewContent CreateContentForMimeType(string mimeType, System.IO.Stream content)
        {
            SourceEditorView result = new SourceEditorView();

            result.Document.MimeType = mimeType;
            if (content != null)
            {
                using (StreamReader reader = new StreamReader(content)) {
                    result.Document.Text = reader.ReadToEnd();
                }
            }
            return(result);
        }
        protected override void OnDestroyed()
        {
            UnregisterAdjustments();

            ExtensionContext = null;
            view             = null;
            base.OnDestroyed();
            if (Options != null)
            {
                Options.Dispose();
                base.Options = null;
            }
        }
Esempio n. 21
0
 protected override void OnDestroyed()
 {
     IsDestroyed = true;
     UnregisterAdjustments();
     view = null;
     Document.SyntaxMode = null;
     base.OnDestroyed();
     if (Options != null)
     {
         Options.Dispose();
         base.Options = null;
     }
 }
 protected override void OnDestroyed()
 {
     TypeSystemService.ParseOperationFinished -= HandleParseOperationFinished;
     UnregisterAdjustments();
     resolveResult    = null;
     Extension        = null;
     ExtensionContext = null;
     view             = null;
     base.OnDestroyed();
     if (Options != null)
     {
         Options.Dispose();
         base.Options = null;
     }
 }
		void Initialize (SourceEditorView view)
		{
			this.view = view;
			Caret.PositionChanged += delegate {
				if (Extension != null) {
					try {
						Extension.CursorPositionChanged ();
					} catch (Exception ex) {
						ReportExtensionError (ex);
					}
				}
			};
			
			Document.TextReplaced += HandleSkipCharsOnReplace;
			
			UpdateEditMode ();
			this.DoPopupMenu = ShowPopup;
		}
        void Initialize(SourceEditorView view)
        {
            this.view              = view;
            Caret.PositionChanged += delegate {
                if (Extension != null)
                {
                    try {
                        Extension.CursorPositionChanged();
                    } catch (Exception ex) {
                        ReportExtensionError(ex);
                    }
                }
            };

            Document.TextReplaced += HandleSkipCharsOnReplace;

            UpdateEditMode();
            this.DoPopupMenu = ShowPopup;
        }
        protected override void OnDestroyed()
        {
            IsDestroyed = true;
            UnregisterAdjustments();
            view = null;
            var disposableSyntaxMode = Document.SyntaxMode as IDisposable;

            if (disposableSyntaxMode != null)
            {
                disposableSyntaxMode.Dispose();
                Document.SyntaxMode = null;
            }
            base.OnDestroyed();
            if (Options != null)
            {
                Options.Dispose();
                base.Options = null;
            }
        }
Esempio n. 26
0
        protected override void OnDestroyed()
        {
            IsDestroyed = true;
            UnregisterAdjustments();

            if (keyPressTimings != null)
            {
                keyPressTimings.ReportTimings(view);
                keyPressTimings = null;
            }

            view = null;
            Document.SyntaxMode = null;
            base.OnDestroyed();
            if (Options != null)
            {
                Options.Dispose();
                base.Options = null;
            }
        }
Esempio n. 27
0
		protected override void OnDestroyed ()
		{
			ExtensionContext = null;
			view = null;
			base.OnDestroyed ();
			if (Options != null) {
				Options.Dispose ();
				base.Options = null;
			}
		}
		protected override void OnDestroyed ()
		{
			UnregisterAdjustments ();

			ExtensionContext = null;
			view = null;
			base.OnDestroyed ();
			if (Options != null) {
				Options.Dispose ();
				base.Options = null;
			}
		}
Esempio n. 29
0
		protected override void OnDestroyed ()
		{
			view = null;
			this.ButtonPressEvent -= OnPopupMenu;
			AddinManager.RemoveExtensionNodeHandler  ("MonoDevelop/SourceEditor2/TooltipProviders", OnTooltipProviderChanged);
			base.OnDestroyed ();
		}
 public ExtensibleTextEditor(SourceEditorView view)
 {
     base.Options = new StyledSourceEditorOptions(view.Project, null);
     Initialize(view);
 }
Esempio n. 31
0
		public static void Remove (SourceEditorView sourceEditorView)
		{
			openFiles.Remove (sourceEditorView);
		}
Esempio n. 32
0
		public static void Remove (SourceEditorView sourceEditorView)
		{
			openFiles.Remove (sourceEditorView);
			UpdateEolMessages ();
		}
 public static void Remove(SourceEditorView sourceEditorView)
 {
     openFiles.Remove(sourceEditorView);
 }
Esempio n. 34
0
		static bool SkipView (SourceEditorView view)
		{
			return view.Document == null || !view.IsFile || view.IsUntitled;
		}
Esempio n. 35
0
		protected override void OnDestroyed ()
		{
			IsDestroyed = true;
			UnregisterAdjustments ();
			view = null;
			var disposableSyntaxMode = Document.SyntaxMode as IDisposable;
			if (disposableSyntaxMode != null)  {
				disposableSyntaxMode.Dispose ();
				Document.SyntaxMode = null;
			}
			base.OnDestroyed ();
			if (Options != null) {
				Options.Dispose ();
				base.Options = null;
			}
		}
			public SetCaret (SourceEditorView view, int line, int column, bool highlightCaretLine)
			{
				this.view = view;
				this.line = line;
				this.column = column;
				this.highlightCaretLine = highlightCaretLine;
 			}
Esempio n. 37
0
		void Initialize (SourceEditorView view)
		{
			this.view = view;

			Document.SyntaxModeChanged += delegate {
				UpdateSemanticHighlighting ();
			};

			UpdateEditMode ();
			this.DoPopupMenu = ShowPopup;
		}
Esempio n. 38
0
		public ExtensibleTextEditor (SourceEditorView view)
		{
			base.Options = new StyledSourceEditorOptions (DefaultSourceEditorOptions.Instance);
			Initialize (view);
		}
Esempio n. 39
0
		protected override void OnDestroyed ()
		{
			ExtensionContext = null;
			view = null;

			base.OnDestroyed ();
		}
Esempio n. 40
0
 static bool SkipView(SourceEditorView view)
 {
     return(view.Document == null || !view.IsFile || view.IsUntitled);
 }
Esempio n. 41
0
        protected override void Run(object data)
        {
            MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
            if (doc == null)
            {
                return;
            }
            SourceEditorView view = IdeApp.Workbench.ActiveDocument.GetContent <SourceEditorView> ();

            if (view == null)
            {
                return;
            }

            string abbrevWord;
            int    offset;
            int    startOffset;

            if (lastView == view && view.TextEditor.Caret.Offset == lastTriggerOffset)
            {
                abbrevWord = lastAbbrev;
                offset     = lastStartOffset;
            }
            else
            {
                abbrevWord    = GetWordBeforeCaret(view.TextEditor);
                lastAbbrev    = abbrevWord;
                offset        = view.TextEditor.Caret.Offset - abbrevWord.Length - 1;
                lastInsertPos = lastTriggerOffset = offset + 1;
                foundWords.Clear();
                foundWords.Add(abbrevWord);
                curState = AbbrevState.SearchBackward;
            }

            lastView = view;
            switch (curState)
            {
            case AbbrevState.SearchBackward:
                while (offset > 0)
                {
                    if (IsMatchAt(view, offset, abbrevWord))
                    {
                        int    endOffset = SearchEndPos(offset, view);
                        string curWord   = view.TextEditor.Document.GetTextBetween(offset, endOffset);
                        if (foundWords.Contains(curWord))
                        {
                            offset--;
                            continue;
                        }
                        foundWords.Add(curWord);
                        ReplaceWord(view, curWord);
                        lastStartOffset = offset - 1;
                        return;
                    }
                    offset--;
                }
                offset   = view.TextEditor.Caret.Offset;
                curState = AbbrevState.SearchForward;
                goto case AbbrevState.SearchForward;

            case AbbrevState.SearchForward:
                while (offset < view.TextEditor.Document.Length)
                {
                    if (IsMatchAt(view, offset, abbrevWord))
                    {
                        int    endOffset = SearchEndPos(offset, view);
                        string curWord   = view.TextEditor.Document.GetTextBetween(offset, endOffset);
                        if (foundWords.Contains(curWord))
                        {
                            offset++;
                            continue;
                        }
                        foundWords.Add(curWord);
                        ReplaceWord(view, curWord);
                        lastStartOffset = offset + 1;
                        return;
                    }
                    offset++;
                }
                curState = AbbrevState.SearchOtherBuffers;
                goto case AbbrevState.SearchOtherBuffers;

            case AbbrevState.SearchOtherBuffers:
                foreach (Document curDoc in IdeApp.Workbench.Documents)
                {
                    SourceEditorView otherView = curDoc.GetContent <SourceEditorView> ();
                    if (curDoc == doc && otherView == null)
                    {
                        continue;
                    }
                    for (int i = 0; i < otherView.Document.Length; i++)
                    {
                        if (IsMatchAt(otherView, i, abbrevWord))
                        {
                            int    endOffset = SearchEndPos(i, otherView);
                            string curWord   = otherView.TextEditor.Document.GetTextBetween(i, endOffset);
                            if (foundWords.Contains(curWord))
                            {
                                continue;
                            }
                            foundWords.Add(curWord);
                        }
                    }
                }
                curState = AbbrevState.CycleThroughFoundWords;
                goto case AbbrevState.CycleThroughFoundWords;

            case AbbrevState.CycleThroughFoundWords:
                int index = foundWords.IndexOf(view.TextEditor.Document.GetTextAt(lastInsertPos, view.TextEditor.Caret.Offset - lastInsertPos));
                if (index < 0)
                {
                    break;
                }
                startOffset = offset;
                offset      = startOffset + foundWords[index].Length;
                index       = (index + foundWords.Count + 1) % foundWords.Count;
                ReplaceWord(view, foundWords[index]);
                break;
            }
        }
Esempio n. 42
0
		public SourceEditorWidget (SourceEditorView view)
		{
			this.view = view;
			vbox.SetSizeRequest (32, 32);
			this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view);
			mainsw = new DecoratedScrolledWindow (this);
			this.textEditorContainer = new TextEditorContainer (textEditor);
			mainsw.SetTextEditor (textEditorContainer);
			
			vbox.PackStart (mainsw, true, true, 0);
			this.textEditor.Errors = errors;
			options = this.textEditor.Options;
			
			textEditorData = textEditor.GetTextEditorData ();
			ResetFocusChain ();
			
			UpdateLineCol ();
			//			this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder;
			vbox.BorderWidth = 0;
			vbox.Spacing = 0;
			vbox.Focused += delegate {
				UpdateLineCol ();
			};
			vbox.Destroyed += delegate {
				isDisposed = true;
				StopParseInfoThread ();
				KillWidgets ();
				
				this.textEditor = null;
				this.lastActiveEditor = null;
				this.splittedTextEditor = null;
				view = null;
				
				IdeApp.Workbench.StatusBar.ClearCaretState ();
				if (parseInformationUpdaterWorkerThread != null) {
					parseInformationUpdaterWorkerThread.Dispose ();
					parseInformationUpdaterWorkerThread = null;
				}
			};
			vbox.ShowAll ();
			parseInformationUpdaterWorkerThread = new BackgroundWorker ();
			parseInformationUpdaterWorkerThread.WorkerSupportsCancellation = true;
			parseInformationUpdaterWorkerThread.DoWork += HandleParseInformationUpdaterWorkerThreadDoWork;
		}
 public ExtensibleTextEditor(SourceEditorView view)
 {
     base.Options = new StyledSourceEditorOptions(DefaultSourceEditorOptions.Instance);
     Initialize(view);
 }
Esempio n. 44
0
		public static void Add (SourceEditorView sourceEditorView)
		{
			openFiles.Add (sourceEditorView);
		}
		protected override void OnDestroyed ()
		{
			TypeSystemService.ParseOperationFinished -= HandleParseOperationFinished;
			UnregisterAdjustments ();
			resolveResult = null;
			Extension = null;
			ExtensionContext = null;
			view = null;
			base.OnDestroyed ();
			if (Options != null) {
				Options.Dispose ();
				base.Options = null;
			}
		}
Esempio n. 46
0
		static bool SkipView (SourceEditorView view)
		{
			return !view.IsFile || view.IsUntitled;
		}
		public SourceEditorWidget (SourceEditorView view)
		{
			this.view = view;
			vbox.SetSizeRequest (32, 32);
			this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view);
			this.textEditor.TextArea.FocusInEvent += (o, s) => {
				lastActiveEditor = (ExtensibleTextEditor)((TextArea)o).GetTextEditorData ().Parent;
				view.FireCompletionContextChanged ();
			};
			this.textEditor.TextArea.FocusOutEvent += delegate {
				if (this.splittedTextEditor == null || !splittedTextEditor.TextArea.HasFocus)
					OnLostFocus ();
			};
			if (IdeApp.CommandService != null)
				IdeApp.FocusOut += IdeApp_FocusOut;
			mainsw = new DecoratedScrolledWindow (this);
			mainsw.SetTextEditor (textEditor);
			
			vbox.PackStart (mainsw, true, true, 0);
			
			textEditorData = textEditor.GetTextEditorData ();
			textEditorData.EditModeChanged += TextEditorData_EditModeChanged;

			ResetFocusChain ();
			
			UpdateLineCol ();
			//			this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder;
			vbox.BorderWidth = 0;
			vbox.Spacing = 0;
			vbox.Focused += delegate {
				UpdateLineCol ();
			};
			vbox.Destroyed += delegate {
				if (isDisposed)
					return;
				isDisposed = true;
				StopParseInfoThread ();
				KillWidgets ();

				ClearQuickTaskProvider ();
				ClearUsageTaskProvider ();

				if (textEditor != null && !textEditor.IsDestroyed)
					textEditor.Destroy ();

				if (splittedTextEditor != null && !splittedTextEditor.IsDestroyed)
					splittedTextEditor.Destroy ();
				
				this.lastActiveEditor = null;
				this.splittedTextEditor = null;
				this.textEditor = null;
				textEditorData.EditModeChanged -= TextEditorData_EditModeChanged;
				textEditorData = null;
				view = null;
				parsedDocument = null;

//				IdeApp.Workbench.StatusBar.ClearCaretState ();
			};
			vbox.ShowAll ();

		}
Esempio n. 48
0
		public SourceEditorWidget (SourceEditorView view)
		{
			this.view = view;
			vbox.SetSizeRequest (32, 32);
			this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view);
			this.textEditor.TextArea.FocusInEvent += (o, s) => {
				lastActiveEditor = (ExtensibleTextEditor)((TextArea)o).GetTextEditorData ().Parent;
				view.FireCompletionContextChanged ();
			};
			this.textEditor.TextArea.FocusOutEvent += delegate {
				if (this.splittedTextEditor == null || !splittedTextEditor.TextArea.HasFocus)
					OnLostFocus ();
			};
			mainsw = new DecoratedScrolledWindow (this);
			mainsw.SetTextEditor (textEditor);
			
			vbox.PackStart (mainsw, true, true, 0);
			
			textEditorData = textEditor.GetTextEditorData ();
			ResetFocusChain ();
			
			UpdateLineCol ();
			//			this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder;
			vbox.BorderWidth = 0;
			vbox.Spacing = 0;
			vbox.Focused += delegate {
				UpdateLineCol ();
			};
			vbox.Destroyed += delegate {
				isDisposed = true;
				RemoveErrorUndelinesResetTimerId ();
				StopParseInfoThread ();
				KillWidgets ();

				foreach (var provider in quickTaskProvider.ToArray ()) {
					RemoveQuickTaskProvider (provider);
				}

				this.lastActiveEditor = null;
				this.splittedTextEditor = null;
				view = null;
				parsedDocument = null;

//				IdeApp.Workbench.StatusBar.ClearCaretState ();
				if (parseInformationUpdaterWorkerThread != null) {
					parseInformationUpdaterWorkerThread.Dispose ();
					parseInformationUpdaterWorkerThread = null;
				}

			};
			vbox.ShowAll ();
			parseInformationUpdaterWorkerThread = new BackgroundWorker ();
			parseInformationUpdaterWorkerThread.WorkerSupportsCancellation = true;
			parseInformationUpdaterWorkerThread.DoWork += HandleParseInformationUpdaterWorkerThreadDoWork;
		}
		protected override void OnDestroyed ()
		{
			ExtensionContext = null;
			view = null;
			this.ButtonPressEvent -= OnPopupMenu;

			base.OnDestroyed ();
		}
Esempio n. 50
0
		public ExtensibleTextEditor (SourceEditorView view, ISourceEditorOptions options, Mono.TextEditor.Document doc) : base(doc, options)
		{
			Initialize (view);
		}
Esempio n. 51
0
		public ExtensibleTextEditor (SourceEditorView view)
		{
			base.Options = new StyledSourceEditorOptions (view.Project, null);
			Initialize (view);
		}
Esempio n. 52
0
		protected override void Run (object data)
		{
			MonoDevelop.Ide.Gui.Document doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return;
			SourceEditorView view = IdeApp.Workbench.ActiveDocument.GetContent<SourceEditorView> ();
			if (view == null)
				return;
			
			string abbrevWord;
			int offset;
			int startOffset;
			
			if (lastView == view && view.TextEditor.Caret.Offset == lastTriggerOffset) {
				abbrevWord = lastAbbrev;
				offset = lastStartOffset;
			} else {
				abbrevWord = GetWordBeforeCaret (view.TextEditor);
				lastAbbrev = abbrevWord;
				offset = view.TextEditor.Caret.Offset - abbrevWord.Length - 1;
				lastInsertPos = lastTriggerOffset = offset + 1;
				foundWords.Clear ();
				foundWords.Add (abbrevWord);
				curState = AbbrevState.SearchBackward;
			}
			
			lastView = view;
			switch (curState) {
			case AbbrevState.SearchBackward:
				while (offset > 0) {
					if (IsMatchAt (view, offset, abbrevWord)) {
						int endOffset = SearchEndPos (offset, view);
						string curWord = view.TextEditor.Document.GetTextBetween (offset, endOffset);
						if (foundWords.Contains (curWord)) {
							offset--;
							continue;
						}
						foundWords.Add (curWord);
						ReplaceWord (view, curWord);
						lastStartOffset = offset - 1;
						return;
					}
					offset--;
				}
				offset = view.TextEditor.Caret.Offset;
				curState = AbbrevState.SearchForward;
				goto case AbbrevState.SearchForward;
			case AbbrevState.SearchForward:
				while (offset < view.TextEditor.Document.TextLength) {
					if (IsMatchAt (view, offset, abbrevWord)) {
						int endOffset = SearchEndPos (offset, view);
						string curWord = view.TextEditor.Document.GetTextBetween (offset, endOffset);
						if (foundWords.Contains (curWord)) {
							offset++;
							continue;
						}
						foundWords.Add (curWord);
						ReplaceWord (view, curWord);
						lastStartOffset = offset + 1;
						return;
					}
					offset++;
				}
				curState = AbbrevState.SearchOtherBuffers;
				goto case AbbrevState.SearchOtherBuffers;
			case AbbrevState.SearchOtherBuffers:
				foreach (Document curDoc in IdeApp.Workbench.Documents) {
					SourceEditorView otherView = curDoc.GetContent<SourceEditorView> ();
					if (curDoc == doc || otherView == null || otherView.Document == null)
						continue;
					for (int i = 0; i < otherView.Document.TextLength; i++) {
						if (IsMatchAt (otherView, i, abbrevWord)) {
							int endOffset = SearchEndPos (i, otherView);
							string curWord = otherView.TextEditor.Document.GetTextBetween (i, endOffset);
							if (foundWords.Contains (curWord))
								continue;
							foundWords.Add (curWord);
						}
					}
				}
				curState = AbbrevState.CycleThroughFoundWords;
				goto case AbbrevState.CycleThroughFoundWords;
			case AbbrevState.CycleThroughFoundWords:
				int index = foundWords.IndexOf (view.TextEditor.Document.GetTextAt (lastInsertPos, view.TextEditor.Caret.Offset - lastInsertPos));
				if (index < 0)
					break;
				startOffset = offset;
				offset = startOffset + foundWords[index].Length;
				index = (index + foundWords.Count + 1) % foundWords.Count;
				ReplaceWord (view, foundWords[index]);
				break;
			}
		}
Esempio n. 53
0
 public static void Add(SourceEditorView sourceEditorView)
 {
     openFiles.Add(sourceEditorView);
 }
 public ExtensibleTextEditor(SourceEditorView view, ISourceEditorOptions options, Mono.TextEditor.TextDocument doc) : base(doc, options)
 {
     Initialize(view);
 }
Esempio n. 55
0
 public static void Remove(SourceEditorView sourceEditorView)
 {
     openFiles.Remove(sourceEditorView);
     UpdateEolMessages();
 }
Esempio n. 56
0
 static bool SkipView(SourceEditorView view)
 {
     return(!view.IsFile || view.IsUntitled);
 }
		public SourceEditorWidget (SourceEditorView view)
		{
			this.view = view;
			vbox.SetSizeRequest (32, 32);
			this.lastActiveEditor = this.textEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view);
			mainsw = new DecoratedScrolledWindow (this);
			this.textEditorContainer = new TextEditorContainer (textEditor);
			mainsw.SetTextEditor (textEditorContainer);
			
			vbox.PackStart (mainsw, true, true, 0);
			this.textEditor.Errors = errors;
			options = this.textEditor.Options;
			
			textEditorData = textEditor.GetTextEditorData ();
			ResetFocusChain ();
			
			UpdateLineCol ();
			ProjectDomService.ParsedDocumentUpdated += OnParseInformationChanged;
			//			this.IsClassBrowserVisible = this.widget.TextEditor.Options.EnableQuickFinder;
			vbox.BorderWidth = 0;
			vbox.Spacing = 0;
			vbox.Focused += delegate {
				UpdateLineCol ();
			};
			vbox.Destroyed += delegate {
				isDisposed = true;
				StopParseInfoThread ();
				KillWidgets ();
				
				this.textEditor = null;
				this.lastActiveEditor = null;
				this.splittedTextEditor = null;
				view = null;
				
				ProjectDomService.ParsedDocumentUpdated -= OnParseInformationChanged;
				IdeApp.Workbench.StatusBar.ClearCaretState ();
			};
			vbox.ShowAll ();
		}