Debian Codegraph @

bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingAction.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2009, 2017 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.equinox.internal.p2.engine;
15
16 import java.util.Map;
17 import org.eclipse.core.runtime.IStatus;
18 import org.eclipse.core.runtime.Status;
19 import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
20 import org.eclipse.equinox.p2.metadata.VersionRange;
21 import org.eclipse.osgi.util.NLS;
22
23 /**
24 * @since 2.0
25 */
26 public class MissingAction extends ProvisioningAction {
27
28 private String actionId;
29 private VersionRange versionRange;
30
31 public MissingAction(String actionId, VersionRange versionRange) {
32 this.actionId = actionId;
33 this.versionRange = versionRange;
34 }
35
36 public String getActionId() {
37 return actionId;
38 }
39
40 public VersionRange getVersionRange() {
41 return versionRange;
42 }
43
44 @Override
45 public IStatus execute(Map<String, Object> parameters) {
46 throw new IllegalArgumentException(NLS.bind(Messages.action_not_found, actionId + (versionRange == null ? "" : "/" + versionRange.toString()))); //$NON-NLS-1$ //$NON-NLS-2$
47 }
48
49 @Override
50 public IStatus undo(Map<String, Object> parameters) {
51 // do nothing as we want this action to undo successfully
52 return Status.OK_STATUS;
53 }
54 }