1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.team.tests.ccvs.core.subscriber;
15 
16 import org.eclipse.compare.structuremergeviewer.IDiffElement;
17 import org.eclipse.core.resources.IResource;
18 import org.eclipse.team.core.synchronize.SyncInfoSet;
19 import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
20 import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceCommitOperation;
21 
22 class TestCommitOperation extends WorkspaceCommitOperation {
23 
24 	private boolean prompted;
25 
TestCommitOperation(IDiffElement[] elements, boolean override)26 	public TestCommitOperation(IDiffElement[] elements, boolean override) {
27 		super(null, elements, override);
28 	}
29 
30 	@Override
canRunAsJob()31 	protected boolean canRunAsJob() {
32 		return false;
33 	}
34 
35 	@Override
promptForComment(RepositoryManager manager, IResource[] resourcesToCommit)36 	protected String promptForComment(RepositoryManager manager, IResource[] resourcesToCommit) {
37 		return "dummy comment";
38 	}
39 
40 	@Override
promptForConflicts(SyncInfoSet syncSet)41 	protected int promptForConflicts(SyncInfoSet syncSet) {
42 		this.prompted = true;
43 		return 0; // ok to commit all conflicts
44 	}
45 
46 	@Override
promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded)47 	protected IResource[] promptForResourcesToBeAdded(RepositoryManager manager, IResource[] unadded) {
48 		return unadded;
49 	}
50 
51 	@Override
promptForConflictHandling(SyncInfoSet syncSet)52 	protected boolean promptForConflictHandling(SyncInfoSet syncSet) {
53 		return true;
54 	}
55 
isPrompted()56 	public boolean isPrompted() {
57 		return this.prompted;
58 	}
59 }
60