blob: 4d452f44c1fc48bb5cc4c9cdeaec71082cf45d89 (
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
|
/*******************************************************************************
* Copyright (c) 2000, 2002 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM - Initial API and implementation
******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.sync;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ui.sync.ITeamNode;
import org.eclipse.team.internal.ui.sync.SyncSet;
/**
* Override ForceCommitSyncAction to only work on outgoing nodes
*/
public class CommitSyncAction extends ForceCommitSyncAction {
public CommitSyncAction(CVSSyncCompareInput model, ISelectionProvider sp, String label, Shell shell) {
super(model, sp, label, shell);
}
protected boolean isEnabled(ITeamNode node) {
// The commit action is enabled only for non-conflicting outgoing changes
CVSSyncSet set = new CVSSyncSet(new StructuredSelection(node));
return set.hasCommitableChanges();
}
protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
set.removeConflictingNodes();
set.removeIncomingNodes();
((CVSSyncSet)set).removeNonAddedChanges();
}
}
|