Add update index action
[egit.git] / org.spearce.egit.core / src / org / spearce / egit / core / op / UpdateOperation.java
blob34c5a3081083a530284a3b2fb263f90f54302472
1 /*
2 * Copyright (C) 2007 Robin Rosenberg
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License, version 2.1, as published by the Free Software Foundation.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
17 package org.spearce.egit.core.op;
19 import java.util.Collection;
21 import org.eclipse.core.resources.IResource;
22 import org.eclipse.core.resources.IWorkspaceRunnable;
23 import org.eclipse.core.runtime.CoreException;
24 import org.eclipse.core.runtime.IProgressMonitor;
25 import org.spearce.egit.core.internal.UpdateJob;
27 /**
28 * Updates the Git index for the selected resources. Only tracked resources
29 * are updated.
30 * <p>
31 * Accepts a collection of resources (files and/or directories) whose content
32 * should be updated in the corresponding Git repositories. Resources in the
33 * collection can be associated with multiple repositories.
34 * </p>
36 public class UpdateOperation implements IWorkspaceRunnable {
37 private final Collection rsrcList;
39 /**
40 * Create a new operation to update files/folders.
42 * @param rsrcs
43 * collection of {@link IResource}s which should be added to the
44 * relevant Git repositories.
46 public UpdateOperation(final Collection rsrcs) {
47 rsrcList = rsrcs;
50 public void run(IProgressMonitor m) throws CoreException {
51 new UpdateJob(rsrcList).schedule();