KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > operations > CacheRemoteContentsOperation


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.ui.operations;
12
13 import org.eclipse.core.resources.mapping.ResourceMapping;
14 import org.eclipse.core.runtime.NullProgressMonitor;
15 import org.eclipse.team.core.TeamException;
16 import org.eclipse.team.core.diff.IThreeWayDiff;
17 import org.eclipse.team.core.history.IFileRevision;
18 import org.eclipse.team.core.mapping.IResourceDiff;
19 import org.eclipse.team.core.mapping.IResourceDiffTree;
20 import org.eclipse.team.internal.ccvs.core.*;
21 import org.eclipse.ui.IWorkbenchPart;
22
23 /**
24  * Operation that ensures that the contents for remote
25  * of each local resource is cached.
26  */

27 public class CacheRemoteContentsOperation extends CacheTreeContentsOperation {
28
29     public CacheRemoteContentsOperation(IWorkbenchPart part, ResourceMapping[] mappers, IResourceDiffTree tree) {
30         super(part, mappers, tree);
31     }
32     
33     /* (non-Javadoc)
34      * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#getRemoteFileState(org.eclipse.team.core.diff.IThreeWayDiff)
35      */

36     protected IFileRevision getRemoteFileState(IThreeWayDiff twd) {
37         IResourceDiff diff = (IResourceDiff)twd.getRemoteChange();
38         if (diff == null)
39             return null;
40         return diff.getAfterState();
41     }
42
43     /* (non-Javadoc)
44      * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#isEnabledForDirection(int)
45      */

46     protected boolean isEnabledForDirection(int direction) {
47         return direction == IThreeWayDiff.CONFLICTING ||
48             direction == IThreeWayDiff.INCOMING;
49     }
50     /* (non-Javadoc)
51      * @see org.eclipse.team.internal.ccvs.ui.operations.CacheTreeContentsOperation#buildTree(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
52      */

53     protected ICVSRemoteResource buildTree(CVSTeamProvider provider) throws TeamException {
54         return CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber().buildRemoteTree(provider.getProject(), true, new NullProgressMonitor());
55     }
56
57 }
58
Popular Tags