Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 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 static*;
 import java.util.Map;
 import  org.eclipse.core.runtime.IProgressMonitor;
 import  org.eclipse.core.runtime.OperationCanceledException;
 import  org.eclipse.ltk.core.refactoring.Change;
 import  org.eclipse.ltk.core.refactoring.CompositeChange;
 import  org.eclipse.text.edits.MultiTextEdit;
 import  org.eclipse.text.edits.TextEdit;
Aggregates TextEdits and/or Changes into a CompositeChange.

Jan Koehnlein - Initial contribution and API
 	public RefactoringUpdateAcceptor(IRefactoringDocument.Provider refactoringDocumentProvider) {
 		this. = refactoringDocumentProvider;
 	private StatusWrapper status;
 	private Multimap<IRefactoringDocument, TextEdit> document2textEdits = LinkedHashMultimap.create();
 	private Multimap<IRefactoringDocument, Change> document2change = LinkedHashMultimap.create();
 	public void accept(URI resourceURI, TextEdit textEdit) {
 		IRefactoringDocument document = getDocument(resourceURI);
 	public void accept(URI resourceURI, Change change) {
 		IRefactoringDocument document = getDocument(resourceURI);
 	public IRefactoringDocument getDocument(URI resourceURI) {
 		IRefactoringDocument document = .get(resourceURI);
 		if(document != null
 			return document;
 		IRefactoringDocument newDocument = .get(resourceURI); 
 		return newDocument;
 		return ;
 	public Change createCompositeChange(String name, IProgressMonitor monitor) {
 		if(.isEmpty() && .isEmpty())
 			return null;
 		CompositeChange compositeChange = new CompositeChange(name);
 		for (IRefactoringDocument document : .keySet()) {
 			if (monitor.isCanceled()) {
 				throw new OperationCanceledException();
 			Iterable<TextEdit> textEdits = .get(document);
 			MultiTextEdit multiTextEdit = new MultiTextEdit();
 			for (TextEdit textEdit : textEdits) {
 			Change change = document.createChange(namemultiTextEdit);
 		for (IRefactoringDocument document : .keySet()) {
 			if (monitor.isCanceled()) {
 				throw new OperationCanceledException();
 			Iterable<Change> documentChanges = .get(document);
 			CompositeChange documentCompositeChange = new CompositeChange(name);
			documentCompositeChange.addAll(Iterables.toArray(documentChanges, Change.class));
		return compositeChange;
	public void setChangeRedirector(IChangeRedirector changeRedirector) {
New to GrepCode? Check out our FAQ X