Java Code Examples for org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory#change()

The following examples show how to use org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory#change() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaRenameProcessor.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public final RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException {
	ResourceChangeChecker checker= context.getChecker(ResourceChangeChecker.class);
	IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory();
	RefactoringStatus result= doCheckFinalConditions(pm, context);
	if (result.hasFatalError()) {
		return result;
	}
	IFile[] changed= getChangedFiles();
	for (int i= 0; i < changed.length; i++) {
		deltaFactory.change(changed[i]);
	}
	fRenameModifications= computeRenameModifications();
	fRenameModifications.buildDelta(deltaFactory);
	fRenameModifications.buildValidateEdits(context.getChecker(ValidateEditChecker.class));
	return result;
}
 
Example 2
Source File: ReorgPolicyFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, IReorgQueries reorgQueries) throws CoreException {
	Assert.isNotNull(reorgQueries);
	ResourceChangeChecker checker= context.getChecker(ResourceChangeChecker.class);
	IFile[] allModifiedFiles= getAllModifiedFiles();
	RefactoringModifications modifications= getModifications();
	IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory();
	for (int i= 0; i < allModifiedFiles.length; i++) {
		deltaFactory.change(allModifiedFiles[i]);
	}
	if (modifications != null) {
		modifications.buildDelta(deltaFactory);
		modifications.buildValidateEdits(context.getChecker(ValidateEditChecker.class));
	}
	return new RefactoringStatus();
}
 
Example 3
Source File: JavaRenameProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public final RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException {
	ResourceChangeChecker checker= (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
	IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory();
	RefactoringStatus result= doCheckFinalConditions(pm, context);
	if (result.hasFatalError())
		return result;
	IFile[] changed= getChangedFiles();
	for (int i= 0; i < changed.length; i++) {
		deltaFactory.change(changed[i]);
	}
	fRenameModifications= computeRenameModifications();
	fRenameModifications.buildDelta(deltaFactory);
	fRenameModifications.buildValidateEdits((ValidateEditChecker)context.getChecker(ValidateEditChecker.class));
	return result;
}
 
Example 4
Source File: Checks.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public static void addModifiedFilesToChecker(IFile[] filesToModify, CheckConditionsContext context) {
	ResourceChangeChecker checker= (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
	IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory();

	for (int i= 0; i < filesToModify.length; i++) {
		deltaFactory.change(filesToModify[i]);
	}
}
 
Example 5
Source File: JavaDeleteProcessor.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException {
	pm.beginTask(RefactoringCoreMessages.DeleteRefactoring_1, 1);
	try{
		fWasCanceled= false;
		RefactoringStatus result= new RefactoringStatus();

		recalculateElementsToDelete();

		checkDirtyCompilationUnits(result);
		checkDirtyResources(result);
		fDeleteModifications= new DeleteModifications();
		fDeleteModifications.delete(fResources);
		fDeleteModifications.delete(fJavaElements);
		List<IResource> packageDeletes= fDeleteModifications.postProcess();

		TextChangeManager manager= new TextChangeManager();
		fDeleteChange= DeleteChangeCreator.createDeleteChange(manager, fResources, fJavaElements, getProcessorName(), packageDeletes);

		ResourceChangeChecker checker= (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
		IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory();
		fDeleteModifications.buildDelta(deltaFactory);
		IFile[] files= ResourceUtil.getFiles(manager.getAllCompilationUnits());
		for (int i= 0; i < files.length; i++) {
			deltaFactory.change(files[i]);
		}
		return result;
	} catch (OperationCanceledException e) {
		fWasCanceled= true;
		throw e;
	} finally{
		pm.done();
	}
}
 
Example 6
Source File: ReorgPolicyFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context, IReorgQueries reorgQueries) throws CoreException {
	Assert.isNotNull(reorgQueries);
	ResourceChangeChecker checker= (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class);
	IFile[] allModifiedFiles= getAllModifiedFiles();
	RefactoringModifications modifications= getModifications();
	IResourceChangeDescriptionFactory deltaFactory= checker.getDeltaFactory();
	for (int i= 0; i < allModifiedFiles.length; i++) {
		deltaFactory.change(allModifiedFiles[i]);
	}
	if (modifications != null) {
		modifications.buildDelta(deltaFactory);
		modifications.buildValidateEdits((ValidateEditChecker) context.getChecker(ValidateEditChecker.class));
	}
	return new RefactoringStatus();
}
 
Example 7
Source File: ResourceModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void buildDelta(IResourceChangeDescriptionFactory builder) {
	builder.change((IFile)fResource);
}
 
Example 8
Source File: ResourceModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void buildDelta(IResourceChangeDescriptionFactory builder) {
	builder.change((IFile)fResource);
}