Initial EGit contribution to eclipse.org
[egit.git] / org.eclipse.egit.core / src / org / eclipse / egit / core / op / UpdateOperation.java
blob1120da9935ea6b0e20b8d3b4ff3946d42afb50b8
1 /*******************************************************************************
2 * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
3 * Copyright (C) 2007, Shawn O. Pearce <spearce@spearce.org>
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *******************************************************************************/
10 package org.eclipse.egit.core.op;
12 import java.util.Collection;
14 import org.eclipse.core.resources.IResource;
15 import org.eclipse.core.resources.IWorkspaceRunnable;
16 import org.eclipse.core.runtime.CoreException;
17 import org.eclipse.core.runtime.IProgressMonitor;
18 import org.eclipse.egit.core.internal.UpdateJob;
20 /**
21 * Updates the Git index for the selected resources. Only tracked resources
22 * are updated.
23 * <p>
24 * Accepts a collection of resources (files and/or directories) whose content
25 * should be updated in the corresponding Git repositories. Resources in the
26 * collection can be associated with multiple repositories.
27 * </p>
29 public class UpdateOperation implements IWorkspaceRunnable {
30 private final Collection rsrcList;
32 /**
33 * Create a new operation to update files/folders.
35 * @param rsrcs
36 * collection of {@link IResource}s which should be added to the
37 * relevant Git repositories.
39 public UpdateOperation(final Collection rsrcs) {
40 rsrcList = rsrcs;
43 public void run(IProgressMonitor m) throws CoreException {
44 new UpdateJob(rsrcList).schedule();