Skip to content

Package: UpdateHandler

UpdateHandler

nameinstructionbranchcomplexitylinemethod
UpdateHandler()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
execute(ExecutionEvent, CDOWorkspace, IProgressMonitor)
M: 32 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011 Eike Stepper (Berlin, Germany) and others.
3: *
4: * All rights reserved. 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: * Eike Stepper - initial API and implementation
13: *******************************************************************************/
14: package org.eclipse.emf.ecp.cdo.internal.ui.handlers;
15:
16: import org.eclipse.core.commands.ExecutionEvent;
17: import org.eclipse.core.commands.ExecutionException;
18: import org.eclipse.core.runtime.IProgressMonitor;
19: import org.eclipse.emf.cdo.transaction.CDOTransaction;
20: import org.eclipse.emf.cdo.util.CDOUtil;
21: import org.eclipse.emf.cdo.util.CommitException;
22: import org.eclipse.emf.cdo.util.ConcurrentAccessException;
23: import org.eclipse.emf.cdo.workspace.CDOWorkspace;
24: import org.eclipse.emf.spi.cdo.DefaultCDOMerger;
25:
26: /**
27: * Handles Updates.
28: *
29: * @author Eike Stepper
30: */
31: public class UpdateHandler extends AbstractWorkspaceHandler {
32:
33:         /**
34:          * Default Constructor.
35:          */
36:         public UpdateHandler() {
37:                 super("Checking in..."); //$NON-NLS-1$
38:         }
39:
40:         @SuppressWarnings("deprecation")
41:         @Override
42:         protected void execute(ExecutionEvent event, CDOWorkspace workspace, IProgressMonitor monitor)
43:                 throws ExecutionException {
44:                 CDOUtil.setLegacyModeDefault(true);
45:                 final CDOTransaction transaction = workspace.update(new DefaultCDOMerger.PerFeature.ManyValued());
46:                 transaction.setCommitComment("Updated from remote"); //$NON-NLS-1$
47:                 try {
48:                         transaction.commit();
49:                 } catch (final ConcurrentAccessException ex) {
50:                         throw new ExecutionException("Commit failed!", ex); //$NON-NLS-1$
51:                 } catch (final CommitException ex) {
52:                         throw new ExecutionException("Commit failed!", ex); //$NON-NLS-1$
53:                 }
54:                 refreshDirtyState(event);
55:         }
56: }