blob: 08703dd84d749e09dc33b76254fcac1359d96a56 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2000, 2003 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - 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.ui.IHelpContextIds;
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.hasOutgoingChanges();
}
protected void removeNonApplicableNodes(SyncSet set, int syncMode) {
set.removeConflictingNodes();
set.removeIncomingNodes();
}
/**
* @see MergeAction#getHelpContextID()
*/
protected String getHelpContextID() {
return IHelpContextIds.SYNC_COMMIT_ACTION;
}
}