blob: 1f07a840e0abac2a634f614ad212eecc65be04ff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*****************************************************************************
* Copyright (c) 2012 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.junit.utils;
import java.io.IOException;
import java.net.URL;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
/**
*
* Useful methods to manipulate files
*
*/
public class FilesUtils {
/**
*
* @param testProject
* the destination projecr
* @param newFilename
* the new name of the copied file
* @param fileURL
* the URl of the file to copy
* @throws IOException
* @throws CoreException
*/
public static final void copyFiles(final IProject testProject, final String newFilename, final URL fileURL) throws CoreException, IOException {
// Copy EmptyModel from bundle to the test project
final IFile emptyModel = testProject.getFile(newFilename);
emptyModel.create(fileURL.openStream(), true, new NullProgressMonitor());
}
}
|