org.eclipse.ltk.core.refactoring.participants.CopyArguments Java Examples

The following examples show how to use org.eclipse.ltk.core.refactoring.participants.CopyArguments. 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: ReorgPolicyFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected RefactoringModifications getModifications() throws CoreException {
	if (fModifications != null) {
		return fModifications;
	}
	fModifications= new CopyModifications();
	fReorgExecutionLog= new ReorgExecutionLog();
	CopyArguments jArgs= new CopyArguments(getDestination(), fReorgExecutionLog);
	CopyArguments rArgs= new CopyArguments(getDestinationAsContainer(), fReorgExecutionLog);
	ICompilationUnit[] cus= getCus();
	for (int i= 0; i < cus.length; i++) {
		fModifications.copy(cus[i], jArgs, rArgs);
	}
	IResource[] resources= ReorgUtils.union(getFiles(), getFolders());
	for (int i= 0; i < resources.length; i++) {
		fModifications.copy(resources[i], rArgs);
	}
	return fModifications;
}
 
Example #2
Source File: ReorgPolicyFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected RefactoringModifications getModifications() throws CoreException {
	if (fModifications != null)
		return fModifications;
	fModifications= new CopyModifications();
	fReorgExecutionLog= new ReorgExecutionLog();
	CopyArguments jArgs= new CopyArguments(getDestination(), fReorgExecutionLog);
	CopyArguments rArgs= new CopyArguments(getDestinationAsContainer(), fReorgExecutionLog);
	ICompilationUnit[] cus= getCus();
	for (int i= 0; i < cus.length; i++) {
		fModifications.copy(cus[i], jArgs, rArgs);
	}
	IResource[] resources= ReorgUtils.union(getFiles(), getFolders());
	for (int i= 0; i < resources.length; i++) {
		fModifications.copy(resources[i], rArgs);
	}
	return fModifications;
}
 
Example #3
Source File: CopyModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor owner, String[] natures, SharableParticipants shared) {
	List<RefactoringParticipant> result= new ArrayList<>();
	for (int i= 0; i < fCopies.size(); i++) {
		result.addAll(Arrays.asList(ParticipantManager.loadCopyParticipants(status,
			owner, fCopies.get(i),
			(CopyArguments) fCopyArguments.get(i),
			fParticipantDescriptorFilter.get(i),
			natures, shared)));
	}
	result.addAll(Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
	return result.toArray(new RefactoringParticipant[result.size()]);
}
 
Example #4
Source File: CopyModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor owner, String[] natures, SharableParticipants shared) {
	List<RefactoringParticipant> result= new ArrayList<RefactoringParticipant>();
	for (int i= 0; i < fCopies.size(); i++) {
		result.addAll(Arrays.asList(ParticipantManager.loadCopyParticipants(status,
			owner, fCopies.get(i),
			(CopyArguments) fCopyArguments.get(i),
			fParticipantDescriptorFilter.get(i),
			natures, shared)));
	}
	result.addAll(Arrays.asList(getResourceModifications().getParticipants(status, owner, natures, shared)));
	return result.toArray(new RefactoringParticipant[result.size()]);
}
 
Example #5
Source File: CopyModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void buildDelta(IResourceChangeDescriptionFactory builder) {
	for (int i= 0; i < fCopies.size(); i++) {
		Object element= fCopies.get(i);
		if (element instanceof IResource) {
			ResourceModifications.buildCopyDelta(builder, (IResource) element, (CopyArguments) fCopyArguments.get(i));
		}
	}
	getResourceModifications().buildDelta(builder);
}
 
Example #6
Source File: CopyModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void copy(ICompilationUnit unit, CopyArguments javaArgs, CopyArguments resourceArgs) {
	add(unit, javaArgs, null);
	ResourceMapping mapping= JavaElementResourceMapping.create(unit);
	if (mapping != null) {
		add(mapping, resourceArgs, null);
	}
	if (unit.getResource() != null) {
		getResourceModifications().addCopyDelta(unit.getResource(), resourceArgs);
	}
}
 
Example #7
Source File: CopyModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void copy(IPackageFragmentRoot sourceFolder, CopyArguments javaArgs, CopyArguments resourceArgs) {
	add(sourceFolder, javaArgs, null);
	ResourceMapping mapping= JavaElementResourceMapping.create(sourceFolder);
	if (mapping != null) {
		add(mapping, resourceArgs, null);
	}
	IResource sourceResource= sourceFolder.getResource();
	if (sourceResource != null) {
		getResourceModifications().addCopyDelta(sourceResource, resourceArgs);
		IFile classpath= getClasspathFile((IResource) resourceArgs.getDestination());
		if (classpath != null) {
			getResourceModifications().addChanged(classpath);
		}
	}
}
 
Example #8
Source File: CopyModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void copy(IJavaElement element, CopyArguments javaArgs, CopyArguments resourceArgs) throws CoreException {
	switch(element.getElementType()) {
		case IJavaElement.PACKAGE_FRAGMENT_ROOT:
			copy((IPackageFragmentRoot)element, javaArgs, resourceArgs);
			break;
		case IJavaElement.PACKAGE_FRAGMENT:
			copy((IPackageFragment)element, javaArgs, resourceArgs);
			break;
		case IJavaElement.COMPILATION_UNIT:
			copy((ICompilationUnit)element, javaArgs, resourceArgs);
			break;
		default:
			add(element, javaArgs, null);
	}
}
 
Example #9
Source File: ReorgPolicyFactory.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected RefactoringModifications getModifications() throws CoreException {
	if (fModifications != null)
		return fModifications;

	fModifications= new CopyModifications();
	fReorgExecutionLog= new ReorgExecutionLog();
	CopyArguments args= new CopyArguments(getJavaElementDestination(), fReorgExecutionLog);
	IJavaElement[] javaElements= getJavaElements();
	for (int i= 0; i < javaElements.length; i++) {
		fModifications.copy(javaElements[i], args, null);
	}
	return fModifications;
}
 
Example #10
Source File: ResourceModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adds the given resource to the list of resources
 * to be copied.
 *
 * @param copy the resource to be copied
 * @param arguments the copy arguments
 */
public void addCopy(IResource copy, CopyArguments arguments) {
	if (fCopy == null) {
		fCopy= new ArrayList<IResource>(2);
		fCopyArguments= new ArrayList<CopyArguments>(2);
	}
	fCopy.add(copy);
	fCopyArguments.add(arguments);
	addCopyDelta(copy, arguments);
}
 
Example #11
Source File: XtextCopyResourceParticipant.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void addElement(Object element, RefactoringArguments arguments) {
	if (arguments instanceof CopyArguments) {
		if (element instanceof IResource) {
			Object destination = ((CopyArguments) arguments).getDestination();
			if (destination instanceof IFolder || destination instanceof IProject) {
				IFile destinationFile = ((IContainer) destination).getFile(new Path(((IResource) element).getName()));
				processor.addChangedResource(((IResource) element), ((IResource) element).getFullPath(), destinationFile.getFullPath());
			}
		}
	}
}
 
Example #12
Source File: CopyModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void buildDelta(IResourceChangeDescriptionFactory builder) {
	for (int i= 0; i < fCopies.size(); i++) {
		Object element= fCopies.get(i);
		if (element instanceof IResource) {
			ResourceModifications.buildCopyDelta(builder, (IResource) element, (CopyArguments) fCopyArguments.get(i));
		}
	}
	getResourceModifications().buildDelta(builder);
}
 
Example #13
Source File: CopyModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public void copy(ICompilationUnit unit, CopyArguments javaArgs, CopyArguments resourceArgs) {
	add(unit, javaArgs, null);
	ResourceMapping mapping= JavaElementResourceMapping.create(unit);
	if (mapping != null) {
		add(mapping, resourceArgs, null);
	}
	if (unit.getResource() != null) {
		getResourceModifications().addCopyDelta(unit.getResource(), resourceArgs);
	}
}
 
Example #14
Source File: CopyModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public void copy(IPackageFragmentRoot sourceFolder, CopyArguments javaArgs, CopyArguments resourceArgs) {
	add(sourceFolder, javaArgs, null);
	ResourceMapping mapping= JavaElementResourceMapping.create(sourceFolder);
	if (mapping != null) {
		add(mapping, resourceArgs, null);
	}
	IResource sourceResource= sourceFolder.getResource();
	if (sourceResource != null) {
		getResourceModifications().addCopyDelta(sourceResource, resourceArgs);
		IFile classpath= getClasspathFile((IResource) resourceArgs.getDestination());
		if (classpath != null) {
			getResourceModifications().addChanged(classpath);
		}
	}
}
 
Example #15
Source File: CopyModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
public void copy(IJavaElement element, CopyArguments javaArgs, CopyArguments resourceArgs) throws CoreException {
	switch(element.getElementType()) {
		case IJavaElement.PACKAGE_FRAGMENT_ROOT:
			copy((IPackageFragmentRoot)element, javaArgs, resourceArgs);
			break;
		case IJavaElement.PACKAGE_FRAGMENT:
			copy((IPackageFragment)element, javaArgs, resourceArgs);
			break;
		case IJavaElement.COMPILATION_UNIT:
			copy((ICompilationUnit)element, javaArgs, resourceArgs);
			break;
		default:
			add(element, javaArgs, null);
	}
}
 
Example #16
Source File: ReorgPolicyFactory.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected RefactoringModifications getModifications() throws CoreException {
	if (fModifications != null) {
		return fModifications;
	}

	fModifications= new CopyModifications();
	fReorgExecutionLog= new ReorgExecutionLog();
	CopyArguments args= new CopyArguments(getJavaElementDestination(), fReorgExecutionLog);
	IJavaElement[] javaElements= getJavaElements();
	for (int i= 0; i < javaElements.length; i++) {
		fModifications.copy(javaElements[i], args, null);
	}
	return fModifications;
}
 
Example #17
Source File: ResourceModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Adds the given resource to the list of resources
 * to be copied.
 *
 * @param copy the resource to be copied
 * @param arguments the copy arguments
 */
public void addCopy(IResource copy, CopyArguments arguments) {
	if (fCopy == null) {
		fCopy= new ArrayList<>(2);
		fCopyArguments= new ArrayList<>(2);
	}
	fCopy.add(copy);
	fCopyArguments.add(arguments);
	addCopyDelta(copy, arguments);
}
 
Example #18
Source File: ResourceModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void addCopyDelta(IResource copy, CopyArguments arguments) {
	if (fIgnoreCount == 0) {
		IPath destination= ((IResource)arguments.getDestination()).getFullPath().append(copy.getName());
		internalAdd(new CopyDescription(copy, destination));
	}
}
 
Example #19
Source File: ResourceModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public static void buildCopyDelta(IResourceChangeDescriptionFactory builder, IResource resource, CopyArguments args) {
	IPath destination= ((IResource)args.getDestination()).getFullPath().append(resource.getName());
	new CopyDescription(resource, destination).buildDelta(builder);
}
 
Example #20
Source File: CopyModifications.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void copy(IResource resource, CopyArguments args) {
	add(resource, args, null);
}
 
Example #21
Source File: CopyModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
public void copy(IResource resource, CopyArguments args) {
	add(resource, args, null);
}
 
Example #22
Source File: ResourceModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
public static void buildCopyDelta(IResourceChangeDescriptionFactory builder, IResource resource, CopyArguments args) {
	IPath destination= ((IResource)args.getDestination()).getFullPath().append(resource.getName());
	new CopyDescription(resource, destination).buildDelta(builder);
}
 
Example #23
Source File: ResourceModifications.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
public void addCopyDelta(IResource copy, CopyArguments arguments) {
	if (fIgnoreCount == 0) {
		IPath destination= ((IResource)arguments.getDestination()).getFullPath().append(copy.getName());
		internalAdd(new CopyDescription(copy, destination));
	}
}