Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2011 itemis AG ( and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at /
 package org.eclipse.xtext.ui.refactoring.impl;
import  org.eclipse.text.edits.ReplaceEdit;
import  org.eclipse.text.edits.TextEdit;
Serialize an EMF resource and delivers the resulting text as an TextEdit that replaces the old content.

Jan Koehnlein - Initial contribution and API
public class EmfResourceChangeUtil {
	public void addSaveAsUpdate(Resource resourceIRefactoringUpdateAcceptor updateAcceptorthrows IOException {
		IRefactoringDocument document = updateAcceptor.getDocument(resource.getURI());;
		String newContent = new String(outputStream.toByteArray(), .getEncoding(resource.getURI()));
				new ReplaceEdit(0, document.getOriginalContents().length(), newContent));
New to GrepCode? Check out our FAQ X