Inheritance: Mono.TextEditor.MonoTextEditor
Ejemplo n.º 1
0
        public LanguageItemWindow(ExtensibleTextEditor ed, Xwt.ModifierKeys modifierState, object result, string errorInformations, object unit)
        {
            string tooltip = errorInformations;

            if (string.IsNullOrEmpty(tooltip) || tooltip == "?")
            {
                IsEmpty = true;
                return;
            }

            var label = new MonoDevelop.Components.FixedWidthWrapLabel()
            {
                Wrap               = Pango.WrapMode.WordChar,
                Indent             = -20,
                BreakOnCamelCasing = true,
                BreakOnPunctuation = true,
                Markup             = tooltip,
            };

            this.BorderWidth = 3;
            Add(label);
            UpdateFont(label);

            EnableTransparencyControl = true;
        }
        public LanguageItemWindow(ExtensibleTextEditor ed, Xwt.ModifierKeys modifierState, object result, string errorInformations, object unit)
        {
            string tooltip = null;

            if (result is UnknownIdentifierResolveResult)
            {
                tooltip = string.Format("error CS0103: The name `{0}' does not exist in the current context", ((UnknownIdentifierResolveResult)result).Identifier);
            }
            else if (result is UnknownMemberResolveResult)
            {
                var ur = (UnknownMemberResolveResult)result;
                if (ur.TargetType.Kind != TypeKind.Unknown)
                {
                    tooltip = string.Format("error CS0117: `{0}' does not contain a definition for `{1}'", ur.TargetType.FullName, ur.MemberName);
                }
            }
            else if (result != null && ed.TextEditorResolverProvider != null)
            {
                //tooltip = ed.TextEditorResolverProvider.CreateTooltip (unit, result, errorInformations, ambience, modifierState);
                // TODO: Type sysetm conversion. (btw. this isn't required because the analyzer should provide semantic error messages.)
                //				if (result.ResolveErrors.Count > 0) {
                //					StringBuilder sb = new StringBuilder ();
                //					sb.Append (tooltip);
                //					sb.AppendLine ();
                //					sb.AppendLine ();
                //					sb.AppendLine (GettextCatalog.GetPluralString ("Error:", "Errors:", result.ResolveErrors.Count));
                //					for (int i = 0; i < result.ResolveErrors.Count; i++) {
                //						sb.Append ('\t');
                //						sb.Append (result.ResolveErrors[i]);
                //						if (i + 1 < result.ResolveErrors.Count)
                //							sb.AppendLine ();
                //					}
                //					tooltip = sb.ToString ();
                //				}
            }
            else
            {
                tooltip = errorInformations;
            }
            if (string.IsNullOrEmpty(tooltip) || tooltip == "?")
            {
                IsEmpty = true;
                return;
            }

            var label = new MonoDevelop.Components.FixedWidthWrapLabel()
            {
                Wrap               = Pango.WrapMode.WordChar,
                Indent             = -20,
                BreakOnCamelCasing = true,
                BreakOnPunctuation = true,
                Markup             = tooltip,
            };

            this.BorderWidth = 3;
            Add(label);
            UpdateFont(label);

            EnableTransparencyControl = true;
        }
Ejemplo n.º 3
0
		protected override void OnDestroyed ()
		{
			base.OnDestroyed ();
			if (textEditor != null) {
				textEditor.SizeAllocated -= HandleSizeAllocated;
				textEditor = null;
			}
		}
Ejemplo n.º 4
0
 public LastEditorExtension(ExtensibleTextEditor ext)
 {
     if (ext == null)
     {
         throw new ArgumentNullException("ext");
     }
     this.ext = ext;
 }
Ejemplo n.º 5
0
 protected override void OnDestroyed()
 {
     base.OnDestroyed();
     if (textEditor != null)
     {
         textEditor.SizeAllocated -= HandleSizeAllocated;
         textEditor = null;
     }
 }
Ejemplo n.º 6
0
		public void ShowOverlay (ExtensibleTextEditor textEditor)
		{
			this.textEditor = textEditor;
			this.ShowAll (); 
			textEditor.AddTopLevelWidget (this, 0, 0); 
			textEditor.SizeAllocated += HandleSizeAllocated;
			var child = (MonoTextEditor.EditorContainerChild)textEditor [this];
			child.FixedPosition = true;
		}
Ejemplo n.º 7
0
		public UnitTestMarker (ExtensibleTextEditor textEditor, UnitTestMarkerHost host, UnitTestLocation unitTest)
		{
			if (textEditor == null)
				throw new ArgumentNullException ("textEditor");
			if (host == null)
				throw new ArgumentNullException ("host");
			this.textEditor = textEditor;
			this.host = host;
			this.unitTest = unitTest;
		}
Ejemplo n.º 8
0
        public void ShowOverlay(ExtensibleTextEditor textEditor)
        {
            this.textEditor = textEditor;
            this.ShowAll();
            textEditor.AddTopLevelWidget(this, 0, 0);
            textEditor.SizeAllocated += HandleSizeAllocated;
            var child = (MonoTextEditor.EditorContainerChild)textEditor [this];

            child.FixedPosition = true;
        }
Ejemplo n.º 9
0
        public LanguageItemWindow(ExtensibleTextEditor ed, Gdk.ModifierType modifierState, ResolveResult result, string errorInformations, ICompilationUnit unit)
        {
            ProjectDom dom      = ed.ProjectDom;
            Ambience   ambience = AmbienceService.GetAmbience(ed.Document.MimeType);

            string tooltip = null;

            if (result != null && ed.TextEditorResolverProvider != null)
            {
                tooltip = ed.TextEditorResolverProvider.CreateTooltip(dom, unit, result, errorInformations, ambience, modifierState);
                if (result.ResolveErrors.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(tooltip);
                    sb.AppendLine();
                    sb.AppendLine();
                    sb.AppendLine(GettextCatalog.GetPluralString("Error:", "Errors:", result.ResolveErrors.Count));
                    for (int i = 0; i < result.ResolveErrors.Count; i++)
                    {
                        sb.Append('\t');
                        sb.Append(result.ResolveErrors[i]);
                        if (i + 1 < result.ResolveErrors.Count)
                        {
                            sb.AppendLine();
                        }
                    }
                    tooltip = sb.ToString();
                }
            }
            else
            {
                tooltip = errorInformations;
            }
            if (string.IsNullOrEmpty(tooltip))
            {
                IsEmpty = true;
                return;
            }

            var label = new MonoDevelop.Components.FixedWidthWrapLabel()
            {
                Wrap               = Pango.WrapMode.WordChar,
                Indent             = -20,
                BreakOnCamelCasing = true,
                BreakOnPunctuation = true,
                Markup             = tooltip,
            };

            this.BorderWidth = 3;
            Add(label);
            UpdateFont(label);

            EnableTransparencyControl = true;
        }
Ejemplo n.º 10
0
 public UnitTestMarker(ExtensibleTextEditor textEditor, UnitTestMarkerHost host, UnitTestLocation unitTest)
 {
     if (textEditor == null)
     {
         throw new ArgumentNullException("textEditor");
     }
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     this.textEditor = textEditor;
     this.host       = host;
     this.unitTest   = unitTest;
 }
Ejemplo n.º 11
0
		public LanguageItemWindow (ExtensibleTextEditor ed, Gdk.ModifierType modifierState, ResolveResult result, string errorInformations, IParsedFile unit)
		{
			Ambience ambience = AmbienceService.GetAmbience (ed.Document.MimeType);
			string tooltip = null;
			if (result is UnknownIdentifierResolveResult) {
				tooltip = string.Format ("error CS0103: The name `{0}' does not exist in the current context", ((UnknownIdentifierResolveResult)result).Identifier);
			} else if (result is UnknownMemberResolveResult) {
				var ur = (UnknownMemberResolveResult)result;
				if (ur.TargetType.Kind != TypeKind.Unknown)
					tooltip = string.Format ("error CS0117: `{0}' does not contain a definition for `{1}'", ur.TargetType.FullName, ur.MemberName);
			} else if (result != null && ed.TextEditorResolverProvider != null) {
				tooltip = ed.TextEditorResolverProvider.CreateTooltip (unit, result, errorInformations, ambience, modifierState);
				// TODO: Type sysetm conversion. (btw. this isn't required because the analyzer should provide semantic error messages.)	
				//				if (result.ResolveErrors.Count > 0) {
				//					StringBuilder sb = new StringBuilder ();
				//					sb.Append (tooltip);
				//					sb.AppendLine ();
				//					sb.AppendLine ();
				//					sb.AppendLine (GettextCatalog.GetPluralString ("Error:", "Errors:", result.ResolveErrors.Count));
				//					for (int i = 0; i < result.ResolveErrors.Count; i++) {
				//						sb.Append ('\t');
				//						sb.Append (result.ResolveErrors[i]);
				//						if (i + 1 < result.ResolveErrors.Count) 
				//							sb.AppendLine ();
				//					}
				//					tooltip = sb.ToString ();
				//				}
			} else {
				tooltip = errorInformations;
			}
			if (string.IsNullOrEmpty (tooltip)|| tooltip == "?") {
				IsEmpty = true;
				return;
			}

			var label = new MonoDevelop.Components.FixedWidthWrapLabel () {
				Wrap = Pango.WrapMode.WordChar,
				Indent = -20,
				BreakOnCamelCasing = true,
				BreakOnPunctuation = true,
				Markup = tooltip,
			};
			this.BorderWidth = 3;
			Add (label);
			UpdateFont (label);
			
			EnableTransparencyControl = true;
		}
Ejemplo n.º 12
0
        public TooltipItem GetItem(Mono.TextEditor.TextEditor editor, int offset)
        {
            ExtensibleTextEditor ed = (ExtensibleTextEditor)editor;

            ICSharpCode.NRefactory.TypeSystem.DomRegion region;
            var resolveResult = ed.GetLanguageItem(offset, out region);

            if (resolveResult == null)
            {
                return(null);
            }
            int startOffset = offset;
            int endOffset   = offset;

            return(new TooltipItem(resolveResult, startOffset, endOffset - startOffset));
        }
Ejemplo n.º 13
0
        public TooltipItem GetItem(Mono.TextEditor.TextEditor editor, int offset)
        {
            ExtensibleTextEditor ed = (ExtensibleTextEditor)editor;

            ResolveResult resolveResult = ed.GetLanguageItem(offset);

            if (resolveResult == null)
            {
                return(null);
            }
            int startOffset = editor.Document.LocationToOffset(resolveResult.ResolvedExpression.Region.Start.Line - 1,
                                                               resolveResult.ResolvedExpression.Region.Start.Column - 1);
            int endOffset = editor.Document.LocationToOffset(resolveResult.ResolvedExpression.Region.End.Line - 1,
                                                             resolveResult.ResolvedExpression.Region.End.Column - 1);

            return(new TooltipItem(resolveResult, startOffset, endOffset - startOffset));
        }
		public LanguageItemWindow (ExtensibleTextEditor ed, Gdk.ModifierType modifierState, ResolveResult result, string errorInformations, ICompilationUnit unit)
		{
			ProjectDom dom = ed.ProjectDom;
			Ambience ambience = AmbienceService.GetAmbience (ed.Document.MimeType);
			
			string tooltip = null;
			if (result != null && ed.TextEditorResolverProvider != null) {
				tooltip = ed.TextEditorResolverProvider.CreateTooltip (dom, unit, result, errorInformations, ambience, modifierState);
				if (result.ResolveErrors.Count > 0) {
					StringBuilder sb = new StringBuilder ();
					sb.Append (tooltip);
					sb.AppendLine ();
					sb.AppendLine ();
					sb.AppendLine (GettextCatalog.GetPluralString ("Error:", "Errors:", result.ResolveErrors.Count));
					for (int i = 0; i < result.ResolveErrors.Count; i++) {
						sb.Append ('\t');
						sb.Append (result.ResolveErrors[i]);
						if (i + 1 < result.ResolveErrors.Count) 
							sb.AppendLine ();
					}
					tooltip = sb.ToString ();
				}
			} else {
				tooltip = errorInformations;
			}
			if (string.IsNullOrEmpty (tooltip)) {
				IsEmpty = true;
				return;
			}

			var label = new MonoDevelop.Components.FixedWidthWrapLabel () {
				Wrap = Pango.WrapMode.WordChar,
				Indent = -20,
				BreakOnCamelCasing = true,
				BreakOnPunctuation = true,
				Markup = tooltip,
			};
			this.BorderWidth = 3;
			Add (label);
			UpdateFont (label);
			
			EnableTransparencyControl = true;
		}
Ejemplo n.º 15
0
        public bool IsTemplateKnown(ExtensibleTextEditor instance)
        {
            string shortcut = CodeTemplate.GetTemplateShortcutBeforeCaret(EditorExtension.Editor);
            bool   result   = false;

            foreach (CodeTemplate template in CodeTemplateService.GetCodeTemplatesAsync(EditorExtension.Editor).WaitAndGetResult(CancellationToken.None))
            {
                if (template.Shortcut == shortcut)
                {
                    result = true;
                }
                else if (template.Shortcut.StartsWith(shortcut))
                {
                    result = false;
                    break;
                }
            }
            return(result);
        }
Ejemplo n.º 16
0
        public Gtk.Window CreateTooltipWindow(Mono.TextEditor.TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
        {
            ExtensibleTextEditor ed  = (ExtensibleTextEditor)editor;
            ParsedDocument       doc = ProjectDomService.GetParsedDocument(null, ed.Document.FileName);

            ResolveResult resolveResult = (ResolveResult)item.Item;

            if (lastResult != null && lastResult.ResolvedExpression != null && lastWindow.IsRealized &&
                resolveResult != null && resolveResult.ResolvedExpression != null && lastResult.ResolvedExpression.Expression == resolveResult.ResolvedExpression.Expression)
            {
                return(lastWindow);
            }
            LanguageItemWindow result = new LanguageItemWindow(ed, modifierState, resolveResult, null, doc != null ? doc.CompilationUnit : null);

            lastWindow = result;
            lastResult = resolveResult;
            if (result.IsEmpty)
            {
                return(null);
            }
            return(result);
        }
Ejemplo n.º 17
0
 public IdeViMode(ExtensibleTextEditor editor)
 {
     this.editor = editor;
     tabAction   = new TabAction(editor);
 }
Ejemplo n.º 18
0
 public NewIdeViMode(ExtensibleTextEditor editor)
 {
     this.editor = editor;
 }
		public TabAction (ExtensibleTextEditor editor)
		{
			this.editor = editor;
		}
        public override bool Handle(TextEditor editor, DocumentContext ctx, KeyDescriptor descriptor)
        {
            int braceIndex = openBrackets.IndexOf(descriptor.KeyChar);

            if (braceIndex < 0)
            {
                return(false);
            }

            var extEditor = ((SourceEditorView)editor.Implementation).SourceEditorWidget.TextEditor;

            var line = extEditor.Document.GetLine(extEditor.Caret.Line);

            if (line == null)
            {
                return(false);
            }

            bool inStringOrComment = false;

            var stack = line.StartSpan.Clone();
            var sm    = extEditor.Document.SyntaxMode as SyntaxMode;

            if (sm != null)
            {
                // extEditor.Caret.Offset - 1 means we care if we were inside string
                // before typing current char
                Mono.TextEditor.Highlighting.SyntaxModeService.ScanSpans(extEditor.Document, sm, sm, stack, line.Offset, extEditor.Caret.Offset - 1);
            }
            foreach (var span in stack)
            {
                if (string.IsNullOrEmpty(span.Color))
                {
                    continue;
                }
                if (span.Color.StartsWith("String", StringComparison.Ordinal) ||
                    span.Color.StartsWith("Comment", StringComparison.Ordinal) ||
                    span.Color.StartsWith("Xml Attribute Value", StringComparison.Ordinal))
                {
                    inStringOrComment = true;
                    break;
                }
            }
            char insertionChar         = '\0';
            bool insertMatchingBracket = false;

            if (!inStringOrComment)
            {
                char closingBrace = closingBrackets [braceIndex];
                char openingBrace = openBrackets [braceIndex];

                int count = 0;
                foreach (char curCh in ExtensibleTextEditor.GetTextWithoutCommentsAndStrings(extEditor.Document, 0, extEditor.Document.TextLength))
                {
                    if (curCh == openingBrace)
                    {
                        count++;
                    }
                    else if (curCh == closingBrace)
                    {
                        count--;
                    }
                }

                if (count >= 0)
                {
                    insertMatchingBracket = true;
                    insertionChar         = closingBrace;
                }
            }

            if (insertMatchingBracket)
            {
                using (var undo = editor.OpenUndoGroup()) {
                    editor.EnsureCaretIsNotVirtual();
                    editor.InsertAtCaret(insertionChar.ToString());
                    editor.CaretOffset--;
                    editor.StartSession(new SkipCharSession(insertionChar));
                }
                return(true);
            }

            return(false);
        }
		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 ();

		}
Ejemplo n.º 22
0
		private void initDocument (Control parent, DesignerHost host)
		{
			System.Diagnostics.Trace.WriteLine ("Creating document...");

			// get the ExtensibleTextEditor instance of the Source code's view
			textEditor = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent<SourceEditorView> ().TextEditor;

			if (!(parent is WebFormPage))
				throw new NotImplementedException ("Only WebFormsPages can have a document for now");
			this.parent = parent;
			this.host = host;
			
			if (!host.Loading)
				throw new InvalidOperationException ("The document cannot be initialised or loaded unless the host is loading"); 

			directives = new Hashtable (StringComparer.InvariantCultureIgnoreCase);
			txtDocDirty = true;
			suppressSerialization = false;
			// create and set the event, to let the parser run the first time
			updateEditorContent = new ManualResetEvent (true);
			undoTracker = new UndoTracker ();
			undoHandler = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent <IUndoHandler> ();
			if (undoHandler == null)
				throw new NullReferenceException ("Could not obtain the IUndoHandler from the SourceEditorView");
		}
Ejemplo n.º 23
0
		internal void SetLastActiveEditor (ExtensibleTextEditor editor)
		{
			this.lastActiveEditor = editor;
		}
        public TooltipItem GetItem(Mono.TextEditor.TextEditor editor, int offset)
        {
            if (offset >= editor.Document.Length)
            {
                return(null);
            }

            if (!DebuggingService.IsDebugging || DebuggingService.IsRunning)
            {
                return(null);
            }

            StackFrame frame = DebuggingService.CurrentFrame;

            if (frame == null)
            {
                return(null);
            }

            ExtensibleTextEditor ed = (ExtensibleTextEditor)editor;

            string expression = null;
            int    startOffset = 0, length = 0;

            if (ed.IsSomethingSelected && offset >= ed.SelectionRange.Offset && offset <= ed.SelectionRange.EndOffset)
            {
                expression  = ed.SelectedText;
                startOffset = ed.SelectionRange.Offset;
                length      = ed.SelectionRange.Length;
            }
            else
            {
                ResolveResult res = ed.GetLanguageItem(offset);

/*				if (res is MemberResolveResult) {
 *                                      MemberResolveResult mr = (MemberResolveResult) res;
 *                                      if (mr.ResolvedMember == null && mr.ResolvedType != null)
 *                                              expression = mr.ResolvedType.FullName;
 *                              }
 *                              if (expression == null)*/
                if (res != null && res.ResolvedExpression != null)
                {
                    expression  = res.ResolvedExpression.Expression;
                    startOffset = editor.Document.LocationToOffset(res.ResolvedExpression.Region.Start.Line - 1, res.ResolvedExpression.Region.Start.Column - 1);
                    int endOffset = editor.Document.LocationToOffset(res.ResolvedExpression.Region.End.Line - 1, res.ResolvedExpression.Region.End.Column - 1);
                    length = endOffset - startOffset;
                }
            }

            if (string.IsNullOrEmpty(expression))
            {
                return(null);
            }

            ObjectValue val;

            if (!cachedValues.TryGetValue(expression, out val))
            {
                val = frame.GetExpressionValue(expression, false);
                cachedValues [expression] = val;
            }
            if (val == null || val.IsUnknown || val.IsNotSupported)
            {
                return(null);
            }
            return(new TooltipItem(val, startOffset, length));
        }
		public IdeViMode (ExtensibleTextEditor editor)
		{
			this.editor = editor;
			tabAction = new TabAction (editor);
		}
        public override bool Handle(TextEditor editor, DocumentContext ctx, KeyDescriptor descriptor)
        {
            if (descriptor.KeyChar == '\'' && editor.MimeType == "text/fsharp")
            {
                return(false);
            }
            int braceIndex = openBrackets.IndexOf(descriptor.KeyChar);

            if (braceIndex < 0)
            {
                return(false);
            }

            var extEditor = ((SourceEditorView)editor.Implementation).SourceEditorWidget.TextEditor;

            var line = extEditor.Document.GetLine(extEditor.Caret.Line);

            if (line == null)
            {
                return(false);
            }

            bool inStringOrComment = false;

            var stack = extEditor.SyntaxHighlighting.GetScopeStackAsync(Math.Max(0, extEditor.Caret.Offset - 2), CancellationToken.None).WaitAndGetResult(CancellationToken.None);

            foreach (var span in stack)
            {
                if (string.IsNullOrEmpty(span))
                {
                    continue;
                }
                if (span.Contains("string") ||
                    span.Contains("comment"))
                {
                    inStringOrComment = true;
                    break;
                }
            }
            char insertionChar         = '\0';
            bool insertMatchingBracket = false;

            if (!inStringOrComment)
            {
                char closingBrace = closingBrackets [braceIndex];
                char openingBrace = openBrackets [braceIndex];

                int count = 0;
                foreach (char curCh in ExtensibleTextEditor.GetTextWithoutCommentsAndStrings(extEditor.Document, 0, extEditor.Document.Length))
                {
                    if (curCh == openingBrace)
                    {
                        count++;
                    }
                    else if (curCh == closingBrace)
                    {
                        count--;
                    }
                }

                if (count >= 0)
                {
                    insertMatchingBracket = true;
                    insertionChar         = closingBrace;
                }
            }

            if (insertMatchingBracket)
            {
                using (var undo = editor.OpenUndoGroup()) {
                    editor.EnsureCaretIsNotVirtual();
                    editor.InsertAtCaret(insertionChar.ToString());
                    editor.CaretOffset--;
                    editor.StartSession(new SkipCharSession(insertionChar));
                }
                return(true);
            }

            return(false);
        }
Ejemplo n.º 27
0
        public TooltipItem GetItem(Mono.TextEditor.TextEditor editor, int offset)
        {
            ExtensibleTextEditor ed = (ExtensibleTextEditor)editor;

            return(new TooltipItem(ed.GetErrorInformationAt(offset), editor.Document.GetLineByOffset(offset)));
        }
Ejemplo n.º 28
0
 public IdeViMode(ExtensibleTextEditor editor, MonoDevelop.Ide.Gui.Document doc)
     : base(doc)
 {
     this.editor = editor;
     tabAction = new TabAction (editor);
 }
Ejemplo n.º 29
0
		public void Split (bool vSplit)
		{
			double vadjustment = this.mainsw.Vadjustment.Value;
			double hadjustment = this.mainsw.Hadjustment.Value;
			
			if (splitContainer != null)
				Unsplit ();
			vbox.Remove (this.mainsw);
			
			RecreateMainSw ();

			this.splitContainer = vSplit ? (Gtk.Paned)new VPaned () : (Gtk.Paned)new HPaned ();

			splitContainer.Add1 (mainsw);

			this.splitContainer.ButtonPressEvent += delegate(object sender, ButtonPressEventArgs args) {
				if (args.Event.Type == Gdk.EventType.TwoButtonPress && args.RetVal == null) {
					Unsplit ();
				}
			};
			secondsw = new DecoratedScrolledWindow (this);
			splittedTextEditor = new MonoDevelop.SourceEditor.ExtensibleTextEditor (view, textEditor.Options, textEditor.Document);
			splittedTextEditor.TextArea.FocusInEvent += (o, s) => {
				lastActiveEditor = (ExtensibleTextEditor)((TextArea)o).GetTextEditorData ().Parent;
				view.FireCompletionContextChanged ();
			};
			splittedTextEditor.TextArea.FocusOutEvent += delegate {
				 if (!textEditor.TextArea.HasFocus)
					OnLostFocus ();
			};
			splittedTextEditor.Extension = textEditor.Extension;
			if (textEditor.GetTextEditorData ().HasIndentationTracker)
				splittedTextEditor.GetTextEditorData ().IndentationTracker = textEditor.GetTextEditorData ().IndentationTracker;
			splittedTextEditor.Document.BracketMatcher = textEditor.Document.BracketMatcher;

			secondsw.SetTextEditor (splittedTextEditor);
			splitContainer.Add2 (secondsw);
			
			vbox.PackStart (splitContainer, true, true, 0);
			splitContainer.Position = (vSplit ? vbox.Allocation.Height : vbox.Allocation.Width) / 2 - 1;
			
			vbox.ShowAll ();
			secondsw.Vadjustment.Value = mainsw.Vadjustment.Value = vadjustment; 
			secondsw.Hadjustment.Value = mainsw.Hadjustment.Value = hadjustment;
		}
Ejemplo n.º 30
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;
		}
Ejemplo n.º 31
0
		public NewIdeViMode (ExtensibleTextEditor editor)
		{
			this.editor = editor;
		}
Ejemplo n.º 32
0
		public void Unsplit ()
		{
			if (splitContainer == null)
				return;
			double vadjustment = mainsw.Vadjustment.Value;
			double hadjustment = mainsw.Hadjustment.Value;
			
			splitContainer.Remove (mainsw);
			secondsw.Destroy ();
			secondsw = null;
			splittedTextEditor = null;
			
			vbox.Remove (splitContainer);
			splitContainer.Destroy ();
			splitContainer = null;
			
			RecreateMainSw ();
			vbox.PackStart (mainsw, true, true, 0);
			vbox.ShowAll ();
			mainsw.Vadjustment.Value = vadjustment; 
			mainsw.Hadjustment.Value = hadjustment;
		}
Ejemplo n.º 33
0
 public TabAction(ExtensibleTextEditor editor)
 {
     this.editor = editor;
 }
Ejemplo n.º 34
0
		void RecreateMainSw ()
		{
			// destroy old scrolled window to work around Bug 526721 - When splitting window vertically, 
			// the slider under left split is not shown unitl window is resized
			double vadjustment = mainsw.Vadjustment.Value;
			double hadjustment = mainsw.Hadjustment.Value;
			
			var removedTextEditor = mainsw.RemoveTextEditor ();
			mainsw.Destroy ();
			
			mainsw = new DecoratedScrolledWindow (this);
			mainsw.SetTextEditor (removedTextEditor);
			mainsw.Vadjustment.Value = vadjustment; 
			mainsw.Hadjustment.Value = hadjustment;
			lastActiveEditor = textEditor;
		}
Ejemplo n.º 35
0
			public LastEditorExtension (ExtensibleTextEditor ext)
			{
				if (ext == null)
					throw new ArgumentNullException ("ext");
				this.ext = ext;
			}