use of org.eclipse.egit.core.op.UntrackOperation in project egit by eclipse.
the class TrackUntrackOperationTest method testTrackProject.
@Test
public void testTrackProject() throws Exception {
final ArrayList<IContainer> containers = new ArrayList<IContainer>();
containers.add(project);
final ArrayList<IFile> files = new ArrayList<IFile>();
project.accept(new IResourceVisitor() {
@Override
public boolean visit(IResource resource) throws CoreException {
if (resource instanceof IFile)
files.add((IFile) resource);
return true;
}
});
IFile[] fileArr = files.toArray(new IFile[files.size()]);
assertTrackedState(fileArr, false);
AddToIndexOperation trop = new AddToIndexOperation(containers);
trop.execute(new NullProgressMonitor());
assertTrackedState(fileArr, true);
UntrackOperation utrop = new UntrackOperation(containers);
utrop.execute(new NullProgressMonitor());
assertTrackedState(fileArr, false);
}
use of org.eclipse.egit.core.op.UntrackOperation in project egit by eclipse.
the class UntrackActionHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IResource[] resources = getSelectedResources();
if (resources.length == 0)
return null;
JobUtil.scheduleUserJob(new UntrackOperation(Arrays.asList(resources)), UIText.Untrack_untrack, JobFamilies.UNTRACK);
return null;
}
use of org.eclipse.egit.core.op.UntrackOperation in project egit by eclipse.
the class TrackUntrackOperationTest method testTrackFiles.
@Test
public void testTrackFiles() throws Exception {
final ArrayList<IFile> files = new ArrayList<IFile>();
project.accept(new IResourceVisitor() {
@Override
public boolean visit(IResource resource) throws CoreException {
if (resource instanceof IFile)
files.add((IFile) resource);
return true;
}
});
IFile[] fileArr = files.toArray(new IFile[files.size()]);
assertTrackedState(fileArr, false);
AddToIndexOperation trop = new AddToIndexOperation(files);
trop.execute(new NullProgressMonitor());
assertTrackedState(fileArr, true);
UntrackOperation utop = new UntrackOperation(Arrays.asList(fileArr));
utop.execute(new NullProgressMonitor());
assertTrackedState(fileArr, false);
}
use of org.eclipse.egit.core.op.UntrackOperation in project egit by eclipse.
the class StagingView method untrack.
private void untrack(@NonNull IStructuredSelection selection) {
List<IPath> locations = new ArrayList<>();
collectPaths(selection.toList(), locations);
if (locations.isEmpty()) {
return;
}
JobUtil.scheduleUserJob(new UntrackOperation(currentRepository, locations), UIText.Untrack_untrack, JobFamilies.UNTRACK);
}
Aggregations