Debian Codegraph @

bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/actions/MergeResultsAction.java

raw
1 /*******************************************************************************
2 * Copyright (c) 2008, 2017 Code 9 and others.
3 *
4 * This
5 * program and the accompanying materials are made available under the terms of
6 * the Eclipse Public License 2.0 which accompanies this distribution, and is
7 * available at
8 * https://www.eclipse.org/legal/epl-2.0/
9 *
10 * SPDX-License-Identifier: EPL-2.0
11 *
12 * Contributors:
13 * Code 9 - initial API and implementation
14 * IBM - ongoing development
15 ******************************************************************************/
16 package org.eclipse.equinox.p2.publisher.actions;
17
18 import org.eclipse.core.runtime.*;
19 import org.eclipse.equinox.p2.publisher.*;
20
21 public class MergeResultsAction extends AbstractPublisherAction {
22
23 private IPublisherAction[] actions;
24 private int mode;
25
26 public MergeResultsAction(IPublisherAction[] actions, int mode) {
27 this.actions = actions;
28 this.mode = mode;
29 }
30
31 @Override
32 public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor) {
33 MultiStatus finalStatus = new MultiStatus(MergeResultsAction.class.getName(), 0, "publishing result", null); //$NON-NLS-1$
34 for (IPublisherAction action : actions) {
35 if (monitor.isCanceled())
36 return Status.CANCEL_STATUS;
37 IPublisherResult result = new PublisherResult();
38 finalStatus.merge(action.perform(publisherInfo, result, monitor));
39 results.merge(result, mode);
40 }
41 if (!finalStatus.isOK())
42 return finalStatus;
43 return Status.OK_STATUS;
44 }
45 }