KickJava   Java API By Example, From Geeks To Geeks.

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


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.resources.mapping.ResourceMappingContext;
15 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.core.runtime.IStatus;
17 import org.eclipse.osgi.util.NLS;
18 import org.eclipse.team.core.subscribers.SubscriberResourceMappingContext;
19 import org.eclipse.team.internal.ccvs.core.*;
20 import org.eclipse.team.internal.ccvs.core.client.*;
21 import org.eclipse.team.internal.ccvs.core.client.Command.LocalOption;
22 import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
23 import org.eclipse.ui.IWorkbenchPart;
24
25 /**
26  * Perform a "cvs commit"
27  */

28 public class CommitOperation extends SingleCommandOperation {
29
30     public CommitOperation(IWorkbenchPart part, ResourceMapping[] mappers, LocalOption[] options, String JavaDoc comment) {
31         super(part, mappers, options);
32         addLocalOption(Command.makeArgumentOption(Command.MESSAGE_OPTION, comment));
33     }
34     
35     /* (non-Javadoc)
36      * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeCommand(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.CVSTeamProvider, org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor)
37      */

38     protected IStatus executeCommand(Session session, CVSTeamProvider provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) throws CVSException, InterruptedException JavaDoc {
39         return Command.COMMIT.execute(session,
40                 Command.NO_GLOBAL_OPTIONS,
41                 getLocalOptions(recurse),
42                 resources,
43                 null,
44                 monitor);
45     }
46     
47     /* (non-Javadoc)
48      * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getTaskName()
49      */

50     protected String JavaDoc getTaskName() {
51         return CVSUIMessages.RepositoryManager_committing;
52     }
53     
54     /* (non-Javadoc)
55      * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getTaskName(org.eclipse.team.internal.ccvs.core.CVSTeamProvider)
56      */

57     protected String JavaDoc getTaskName(CVSTeamProvider provider) {
58         return NLS.bind(CVSUIMessages.CommitOperation_0, new String JavaDoc[] { provider.getProject().getName() });
59     }
60     
61     /* (non-Javadoc)
62      * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#getErrorMessage(org.eclipse.core.runtime.IStatus[], int)
63      */

64     protected String JavaDoc getErrorMessage(IStatus[] failures, int totalOperations) {
65         return CVSUIMessages.CommitAction_commitFailed;
66     }
67     
68     /* (non-Javadoc)
69      * @see org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#isServerModificationOperation()
70      */

71     protected boolean isServerModificationOperation() {
72         return true;
73     }
74     
75     /* (non-Javadoc)
76      * @see org.eclipse.team.internal.ccvs.ui.operations.RepositoryProviderOperation#getResourceMappingContext()
77      */

78     protected ResourceMappingContext getResourceMappingContext() {
79         return SubscriberResourceMappingContext.createContext(CVSProviderPlugin.getPlugin().getCVSWorkspaceSubscriber());
80     }
81 }
82
Popular Tags