bundles/org.eclipse.orion.client.ui/web/edit/setup.js
function() {
		/** All events from last tick */
		var pendingEvents = this._annotationChangedContext.events;
		var pendingLocations = this._annotationChangedContext.locations;
		var pendingModels = this._annotationChangedContext.textModels;
		/** All unique events from last tick */
		var handlingEvents = [];
		var handlingLocations = [];
		var handlingModels = [];
		// Cleanup
		this._annotationChangedContext.timeout = undefined;
		this._annotationChangedContext.events = [];
		this._annotationChangedContext.locations = [];
		// Remove duplicate events
		for (var i = 0; i < pendingEvents.length; i++) {
			var duplicate = false;
			for (var j = 0; j < i; j++) {
				if (pendingEvents[i].textModelChangedEvent === pendingEvents[j].textModelChangedEvent) {
					duplicate = true;
				}
				break;
			}
			if (!duplicate) {
				handlingEvents.push(pendingEvents[i]);
				handlingLocations.push(pendingLocations[i]);
				handlingModels.push(pendingModels[i]);
			}
		}

		// Handle
		for (i = 0; i < handlingEvents.length; i++) {
			var e = handlingEvents[i];
			for (j = 0; j < e.changed.length; j++) {
				var annotation = e.changed[j];
				var location = handlingLocations[i];
				var oldLine;
				var newLine = handlingModels[i].getLineAtOffset(annotation.start);
				if (annotation._oldStart > e.textModelChangedEvent.start) {
					oldLine = newLine - e.textModelChangedEvent.addedLineCount + e.textModelChangedEvent.removedLineCount;
				} else {
					oldLine = handlingModels[i].getLineAtOffset(annotation._oldStart);
				}
				var before = null;
				var after = null;
				if (annotation.type === AT.ANNOTATION_BOOKMARK) {
					before = new mBreakpoint.LineBookmark(location, oldLine, annotation.title);
					after = new mBreakpoint.LineBookmark(location, newLine, annotation.title);
				} else if (annotation.type === AT.ANNOTATION_BREAKPOINT) {
					before = new mBreakpoint.LineBreakpoint(location, oldLine, annotation.title, true);
					after = new mBreakpoint.LineBreakpoint(location, newLine, annotation.title, true);
				} else if (annotation.type === AT.ANNOTATION_CONDITIONAL_BREAKPOINT) {
					before = new mBreakpoint.LineConditionalBreakpoint(location, oldLine, annotation.title, annotation.title, true);
					after = new mBreakpoint.LineConditionalBreakpoint(location, newLine, annotation.title, annotation.title, true);
				}
				if (before && after) {
					this.debugService.updateBreakpoint(before, after, true);
				}
			}
		}
	}
function() {
		/** All events from last tick */
		var pendingEvents = this._annotationChangedContext.events;
		var pendingLocations = this._annotationChangedContext.locations;
		var pendingModels = this._annotationChangedContext.textModels;
		/** All unique events from last tick */
		var handlingEvents = [];
		var handlingLocations = [];
		var handlingModels = [];
		// Cleanup
		this._annotationChangedContext.timeout = undefined;
		this._annotationChangedContext.events = [];
		this._annotationChangedContext.locations = [];
		// Remove duplicate events
		for (var i = 0; i < pendingEvents.length; i++) {
			var duplicate = false;
			for (var j = 0; j < i; j++) {
				if (pendingEvents[i].textModelChangedEvent === pendingEvents[j].textModelChangedEvent) {
					duplicate = true;
				}
				break;
			}
			if (!duplicate) {
				handlingEvents.push(pendingEvents[i]);
				handlingLocations.push(pendingLocations[i]);
				handlingModels.push(pendingModels[i]);
			}
		}

		// Handle
		for (i = 0; i < handlingEvents.length; i++) {
			var e = handlingEvents[i];
			for (j = 0; j < e.changed.length; j++) {
				var annotation = e.changed[j];
				var location = handlingLocations[i];
				var oldLine;
				var newLine = handlingModels[i].getLineAtOffset(annotation.start);
				if (annotation._oldStart > e.textModelChangedEvent.start) {
					oldLine = newLine - e.textModelChangedEvent.addedLineCount + e.textModelChangedEvent.removedLineCount;
				} else {
					oldLine = handlingModels[i].getLineAtOffset(annotation._oldStart);
				}
				var before = null;
				var after = null;
				if (annotation.type === AT.ANNOTATION_BOOKMARK) {
					before = new mBreakpoint.LineBookmark(location, oldLine, annotation.title);
					after = new mBreakpoint.LineBookmark(location, newLine, annotation.title);
				} else if (annotation.type === AT.ANNOTATION_BREAKPOINT) {
					before = new mBreakpoint.LineBreakpoint(location, oldLine, annotation.title, true);
					after = new mBreakpoint.LineBreakpoint(location, newLine, annotation.title, true);
				} else if (annotation.type === AT.ANNOTATION_CONDITIONAL_BREAKPOINT) {
					before = new mBreakpoint.LineConditionalBreakpoint(location, oldLine, annotation.title, annotation.title, true);
					after = new mBreakpoint.LineConditionalBreakpoint(location, newLine, annotation.title, annotation.title, true);
				}
				if (before && after) {
					this.debugService.updateBreakpoint(before, after, true);
				}
			}
		}
	}
function ( ) { /** All events from last tick */ var pendingEvents = this . _annotationChangedContext . events ; var pendingLocations = this . _annotationChangedContext . locations ; var pendingModels = this . _annotationChangedContext . textModels ; /** All unique events from last tick */ var handlingEvents = [ ] ; var handlingLocations = [ ] ; var handlingModels = [ ] ; // Cleanup this . _annotationChangedContext . timeout = undefined ; this . _annotationChangedContext . events = [ ] ; this . _annotationChangedContext . locations = [ ] ; // Remove duplicate events for ( var i = 0 ; i < pendingEvents . length ; i ++ ) { var duplicate = false ; for ( var j = 0 ; j < i ; j ++ ) { if ( pendingEvents [ i ] . textModelChangedEvent === pendingEvents [ j ] . textModelChangedEvent ) { duplicate = true ; } break ; } if ( ! duplicate ) { handlingEvents . push ( pendingEvents [ i ] ) ; handlingLocations . push ( pendingLocations [ i ] ) ; handlingModels . push ( pendingModels [ i ] ) ; } } // Handle for ( i = 0 ; i < handlingEvents . length ; i ++ ) { var e = handlingEvents [ i ] ; for ( j = 0 ; j < e . changed . length ; j ++ ) { var annotation = e . changed [ j ] ; var location = handlingLocations [ i ] ; var oldLine ; var newLine = handlingModels [ i ] . getLineAtOffset ( annotation . start ) ; if ( annotation . _oldStart > e . textModelChangedEvent . start ) { oldLine = newLine - e . textModelChangedEvent . addedLineCount + e . textModelChangedEvent . removedLineCount ; } else { oldLine = handlingModels [ i ] . getLineAtOffset ( annotation . _oldStart ) ; } var before = null ; var after = null ; if ( annotation . type === AT . ANNOTATION_BOOKMARK ) { before = new mBreakpoint . LineBookmark ( location , oldLine , annotation . title ) ; after = new mBreakpoint . LineBookmark ( location , newLine , annotation . title ) ; } else if ( annotation . type === AT . ANNOTATION_BREAKPOINT ) { before = new mBreakpoint . LineBreakpoint ( location , oldLine , annotation . title , true ) ; after = new mBreakpoint . LineBreakpoint ( location , newLine , annotation . title , true ) ; } else if ( annotation . type === AT . ANNOTATION_CONDITIONAL_BREAKPOINT ) { before = new mBreakpoint . LineConditionalBreakpoint ( location , oldLine , annotation . title , annotation . title , true ) ; after = new mBreakpoint . LineConditionalBreakpoint ( location , newLine , annotation . title , annotation . title , true ) ; } if ( before && after ) { this . debugService . updateBreakpoint ( before , after , true ) ; } } } }
Handle all annotation changed events in the last tick.
This avoids duplicate events from a single text model.
Handle all annotation changed events in the last tick . This avoids duplicate events from a single text model .