Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 508765

Summary: CodeEdit: Need an API to create folding annotation.
Product: [ECD] Orion Reporter: libing wang <libingw>
Component: DockerAssignee: libing wang <libingw>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 12.0   
Target Milestone: 13.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description libing wang CLA 2016-12-06 11:04:19 EST
Need an editor level API to allow end user to create folding annotations.
Comment 2 libing wang CLA 2016-12-06 14:47:26 EST
			var editorModel = editorViewer.editor.getModel();
			var foldingAnnotations = [];
			editorModel.addEventListener("Changed", function(evt) {
				//			var modelChangedEvent = {
				//				type: "Changed", //$NON-NLS-0$
				//				start: eventStart,
				//				removedCharCount: removedCharCount,
				//				addedCharCount: addedCharCount,
				//				removedLineCount: removedLineCount,
				//				addedLineCount: addedLineCount
				//			};
				var annotationModel = editorViewer.editor.getAnnotationModel();
				foldingAnnotations.forEach(function(anno){
					annotationModel.removeAnnotation(anno);
				});
				foldingAnnotations = [];
				//window.setTimeout(function(){
					var fAnno1 = editorViewer.editor.addFoldingAnnotation(0, 250);
					if(fAnno1) {
						foldingAnnotations.push(fAnno1);
					}
				//}, 500);
			});