blob: 6cc9c7f980937965a3dbab142725148ec86a4333 (
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
51
52
53
54
55
56
57
58
59
|
/*******************************************************************************
* Copyright (c) 2007, 2009 Red Hat, Inc.
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.rpm.ui.editor.tests;
import java.io.IOException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.linuxtools.rpm.core.utils.Utils;
public class SpecfileTestProject {
private IProject project;
public SpecfileTestProject() throws CoreException {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
project = workspaceRoot.getProject("TestSpecfileProject");
project.create(null);
project.open(null);
}
public void dispose() throws CoreException {
project.delete(true, true, null);
try {
Utils.runCommandToInputStream("rm", "-f", "/tmp/pkglist");
} catch (IOException e) {
e.printStackTrace();
}
}
public IFile createFile(String filename) throws CoreException {
IFile testSpecfile = project.getFile(filename);
testSpecfile.create(null, true, null);
return testSpecfile;
}
protected IMarker[] getFailureMarkers() throws CoreException {
return project.findMarkers(
"org.eclipse.linuxtools.rpm.ui.editor.specfileerror", false,
IResource.DEPTH_INFINITE);
}
public void refresh() throws CoreException {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
}
}
|