Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2013-12-11 20:52:33 +0000
committerGerrit Code Review @ Eclipse.org2013-12-13 20:37:02 +0000
commitfb3de00135ad066dd29f64b184cc22566adee48b (patch)
tree7a1d9741bb1fe4085ebc765c8d8040790d33476b /plugins/org.eclipse.osee.framework.core
parent72f4c7db3fafecda996a2e7ed512a64d93b75388 (diff)
downloadorg.eclipse.osee-fb3de00135ad066dd29f64b184cc22566adee48b.tar.gz
org.eclipse.osee-fb3de00135ad066dd29f64b184cc22566adee48b.tar.xz
org.eclipse.osee-fb3de00135ad066dd29f64b184cc22566adee48b.zip
refactor: Delete deprecated CompositeOperation
Diffstat (limited to 'plugins/org.eclipse.osee.framework.core')
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java120
-rw-r--r--plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java9
2 files changed, 9 insertions, 120 deletions
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java
deleted file mode 100644
index c61ab93e4cf..00000000000
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/CompositeOperation.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 Boeing.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Boeing - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osee.framework.core.operation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.osee.framework.core.enums.OperationBehavior;
-import org.eclipse.osee.framework.jdk.core.util.Conditions;
-
-/**
- * @author Roberto E. Escobar
- * @deprecated Use {@link Operations#createBuilder(String) Operations.createBuilder(String name)} instead
- */
-@Deprecated
-public class CompositeOperation extends AbstractOperation {
- private final List<IStatus> statuses = new ArrayList<IStatus>();
- private final List<? extends IOperation> operations;
- private final OperationBehavior behavior;
-
- public CompositeOperation(String name, String pluginId, OperationBehavior behavior, OperationLogger logger, List<? extends IOperation> operations) {
- super(name, pluginId, logger);
- this.operations = operations;
- this.behavior = behavior;
- }
-
- public CompositeOperation(String name, String pluginId, OperationBehavior behavior, List<? extends IOperation> operations) {
- this(name, pluginId, behavior, NullOperationLogger.getSingleton(), operations);
- }
-
- public CompositeOperation(String name, String pluginId, OperationLogger logger, List<? extends IOperation> operations) {
- this(name, pluginId, OperationBehavior.TerminateOnError, logger, operations);
- }
-
- public CompositeOperation(String name, String pluginId, List<? extends IOperation> operations) {
- this(name, pluginId, OperationBehavior.TerminateOnError, operations);
- }
-
- public CompositeOperation(String name, String pluginId, OperationBehavior behavior, OperationLogger logger, IOperation... operations) {
- this(name, pluginId, behavior, logger, Arrays.asList(operations));
- }
-
- public CompositeOperation(String name, String pluginId, OperationBehavior behavior, IOperation... operations) {
- this(name, pluginId, behavior, Arrays.asList(operations));
- }
-
- public CompositeOperation(String name, String pluginId, OperationLogger logger, IOperation... operations) {
- this(name, pluginId, logger, Arrays.asList(operations));
- }
-
- public CompositeOperation(String name, String pluginId, IOperation... operations) {
- this(name, pluginId, Arrays.asList(operations));
- }
-
- @Override
- protected void doWork(IProgressMonitor parentMonitor) throws Exception {
- Conditions.checkNotNullOrEmpty(operations, "sub-operations");
-
- SubMonitor subMonitor = SubMonitor.convert(parentMonitor, getName(), Operations.TASK_WORK_RESOLUTION);
- try {
- processSubWork(subMonitor);
- } finally {
- subMonitor.done();
- }
- }
-
- private void processSubWork(SubMonitor subMonitor) throws Exception {
- int subTicks = Operations.TASK_WORK_RESOLUTION / operations.size();
- for (IOperation operation : operations) {
- checkForCancelledStatus(subMonitor);
-
- SubMonitor childMonitor = subMonitor.newChild(subTicks);
- childMonitor.subTask(operation.getName());
-
- IStatus status;
- try {
- status = operation.run(childMonitor);
- } finally {
- childMonitor.done();
- }
-
- if (behavior == OperationBehavior.TerminateOnError && status.getSeverity() == IStatus.ERROR) {
- setStatus(status);
- return;
- } else if (status.getSeverity() != IStatus.OK) {
- statuses.add(status);
- }
- }
- setStatus(computeCombinedStatus());
- }
-
- private IStatus computeCombinedStatus() {
- if (statuses.isEmpty()) {
- return null;
- }
- if (statuses.size() == 1) {
- return statuses.get(0);
- }
-
- StringBuilder strB = new StringBuilder();
- for (IStatus status : statuses) {
- strB.append(status.getMessage());
- strB.append("\n");
- }
- IStatus[] statusArray = statuses.toArray(new IStatus[statuses.size()]);
- return new MultiStatus(getPluginId(), IStatus.OK, statusArray, strB.toString(), null);
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java
index fe2246d3ec8..8a0f73b3518 100644
--- a/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java
+++ b/plugins/org.eclipse.osee.framework.core/src/org/eclipse/osee/framework/core/operation/Operations.java
@@ -144,6 +144,14 @@ public final class Operations {
return new OperationBuilderImpl(operationName, Activator.PLUGIN_ID);
}
+ public static OperationBuilder createBuilder(String name, IOperation operation, IOperation... operations) {
+ OperationBuilder builder = createBuilder(name);
+ builder.addOp(operation);
+ for (IOperation op : operations) {
+ builder.addOp(op);
+ }
+ return builder;
+ }
private static final class OperationJob extends Job {
private final IOperation operation;
@@ -165,4 +173,5 @@ public final class Operations {
return OperationJob.class.equals(family);
}
}
+
} \ No newline at end of file

Back to the top