예제 #1
0
        public void Toggle(ITextEditorUIContext uiContext, int line, int column = 0)
        {
            var bps   = uiContext.GetCodeMappings().Find(line, column);
            var ilbps = GetILCodeBreakpoints(uiContext, bps);

            if (ilbps.Count > 0)
            {
                if (IsEnabled(ilbps))
                {
                    foreach (var ilbp in ilbps)
                    {
                        Remove(ilbp);
                    }
                }
                else
                {
                    foreach (var bpm in ilbps)
                    {
                        bpm.IsEnabled = true;
                    }
                }
            }
            else if (bps.Count > 0)
            {
                foreach (var bp in bps)
                {
                    var md     = bp.Mapping.Method;
                    var serMod = serializedDnModuleCreator.Create(md.Module);
                    var key    = new SerializedDnToken(serMod, md.MDToken);
                    Add(new ILCodeBreakpoint(key, bp.ILRange.From));
                }
                uiContext.ScrollAndMoveCaretTo(bps[0].StartPosition.Line, bps[0].StartPosition.Column);
            }
        }
예제 #2
0
		public ITextMarker CreateMarker(ITextEditorUIContext uiContext, ITextMarkerService markerService) {
			var marker = CreateMarkerInternal(markerService, uiContext);
			var cm = uiContext.GetCodeMappings();
			marker.ZOrder = ZOrder;
			marker.IsVisible = b => cm.TryGetMapping(SerializedDnToken) != null;
			marker.TextMarkerObject = this;
			Initialize(uiContext, markerService, marker);
			return marker;
		}
예제 #3
0
        public ITextMarker CreateMarker(ITextEditorUIContext uiContext, ITextMarkerService markerService)
        {
            var marker = CreateMarkerInternal(markerService, uiContext);
            var cm     = uiContext.GetCodeMappings();

            marker.ZOrder           = ZOrder;
            marker.IsVisible        = b => cm.TryGetMapping(SerializedDnToken) != null;
            marker.TextMarkerObject = this;
            Initialize(uiContext, markerService, marker);
            return(marker);
        }
예제 #4
0
			public override bool IsVisible(ITextEditorUIContext uiContext) {
				TextPosition location, endLocation;
				var cm = uiContext.GetCodeMappings();
				var mm = cm.TryGetMapping(SerializedDnToken);
				if (mm == null)
					return false;
				if (!mm.GetInstructionByTokenAndOffset(ILOffset, out location, out endLocation))
					return false;

				return true;
			}
예제 #5
0
            public override bool IsVisible(ITextEditorUIContext uiContext)
            {
                TextPosition location, endLocation;
                var          cm = uiContext.GetCodeMappings();
                var          mm = cm.TryGetMapping(SerializedDnToken);

                if (mm == null)
                {
                    return(false);
                }
                if (!mm.GetInstructionByTokenAndOffset(ILOffset, out location, out endLocation))
                {
                    return(false);
                }

                return(true);
            }
예제 #6
0
        internal static IList <SourceCodeMapping> GetMappings(ITextEditorUIContext uiContext, int line, int col)
        {
            if (uiContext == null)
            {
                return(null);
            }
            var cm   = uiContext.GetCodeMappings();
            var list = cm.Find(line, col);

            if (list.Count == 0)
            {
                return(null);
            }
            if (!(list[0].StartPosition.Line <= line && line <= list[0].EndPosition.Line))
            {
                return(null);
            }
            return(list);
        }
예제 #7
0
		public bool GetLocation(ITextEditorUIContext uiContext, out TextPosition location, out TextPosition endLocation) {
			var cm = uiContext.GetCodeMappings();
			var mapping = cm.TryGetMapping(methodKey);
			if (mapping == null) {
				location = endLocation = new TextPosition();
				return false;
			}

			bool isMatch;
			var map = mapping.GetInstructionByOffset(ilOffset, out isMatch);
			if (map == null) {
				location = endLocation = new TextPosition();
				return false;
			}

			location = map.StartPosition;
			endLocation = map.EndPosition;
			return true;
		}
예제 #8
0
        public bool GetLocation(ITextEditorUIContext uiContext, out TextPosition location, out TextPosition endLocation)
        {
            var cm      = uiContext.GetCodeMappings();
            var mapping = cm.TryGetMapping(methodKey);

            if (mapping == null)
            {
                location = endLocation = new TextPosition();
                return(false);
            }

            bool isMatch;
            var  map = mapping.GetInstructionByOffset(ilOffset, out isMatch);

            if (map == null)
            {
                location = endLocation = new TextPosition();
                return(false);
            }

            location    = map.StartPosition;
            endLocation = map.EndPosition;
            return(true);
        }
예제 #9
0
		internal static IList<SourceCodeMapping> GetMappings(ITextEditorUIContext uiContext, int line, int col) {
			if (uiContext == null)
				return null;
			var cm = uiContext.GetCodeMappings();
			var list = cm.Find(line, col);
			if (list.Count == 0)
				return null;
			if (!(list[0].StartPosition.Line <= line && line <= list[0].EndPosition.Line))
				return null;
			return list;
		}
예제 #10
0
 List <ILCodeBreakpoint> GetILCodeBreakpoints(ITextEditorUIContext uiContext, int line, int column)
 {
     return(GetILCodeBreakpoints(uiContext, uiContext.GetCodeMappings().Find(line, column)));
 }
예제 #11
0
 List<ILCodeBreakpoint> GetILCodeBreakpoints(ITextEditorUIContext uiContext, int line, int column)
 {
     return GetILCodeBreakpoints(uiContext, uiContext.GetCodeMappings().Find(line, column));
 }
예제 #12
0
 public void Toggle(ITextEditorUIContext uiContext, int line, int column = 0)
 {
     var bps = uiContext.GetCodeMappings().Find(line, column);
     var ilbps = GetILCodeBreakpoints(uiContext, bps);
     if (ilbps.Count > 0) {
         if (IsEnabled(ilbps)) {
             foreach (var ilbp in ilbps)
                 Remove(ilbp);
         }
         else {
             foreach (var bpm in ilbps)
                 bpm.IsEnabled = true;
         }
     }
     else if (bps.Count > 0) {
         foreach (var bp in bps) {
             var md = bp.Mapping.Method;
             var serMod = serializedDnModuleCreator.Create(md.Module);
             var key = new SerializedDnToken(serMod, md.MDToken);
             Add(new ILCodeBreakpoint(key, bp.ILRange.From));
         }
         uiContext.ScrollAndMoveCaretTo(bps[0].StartPosition.Line, bps[0].StartPosition.Column);
     }
 }
예제 #13
0
		public static bool VerifyAndGetCurrentDebuggedMethod(ITextEditorUIContext uiContext, SerializedDnToken serToken, out CodeMappings codeMappings) {
			codeMappings = uiContext.GetCodeMappings();
			return codeMappings.TryGetMapping(serToken) != null;
		}
예제 #14
0
 public static bool VerifyAndGetCurrentDebuggedMethod(ITextEditorUIContext uiContext, SerializedDnToken serToken, out CodeMappings codeMappings)
 {
     codeMappings = uiContext.GetCodeMappings();
     return(codeMappings.TryGetMapping(serToken) != null);
 }