Skip to main content
summaryrefslogtreecommitdiffstats
blob: 63b3e58d04f153ea1552b3d3e785976ee9a11645 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************************************************
 * 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
 *******************************************************************************/
/**
 * @author Roberto E. Escobar
 * @author Jeff C. Phillips
 */
package org.eclipse.osee.framework.lifecycle;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.operation.AbstractOperation;
import org.eclipse.osee.framework.lifecycle.internal.OperationPointId;

public abstract class AbstractLifecycleOperation extends AbstractOperation {

   private final LifecycleService service;
   private final AbstractLifecyclePoint<?> lifecyclepoint;

   public AbstractLifecycleOperation(LifecycleService service, AbstractLifecyclePoint<?> lifecyclePoint, String operationName, String pluginId) {
      super(operationName, pluginId);
      this.service = service;
      this.lifecyclepoint = lifecyclePoint;
   }

   @Override
   protected final void doWork(IProgressMonitor monitor) throws Exception {
      service.dispatch(monitor, lifecyclepoint, OperationPointId.CHECK_CONDITION_ID.name());
      service.dispatch(monitor, lifecyclepoint, OperationPointId.PRE_CONDITION_ID.name());
      try {
         doCoreWork(monitor);
      } finally {
         service.dispatch(monitor, lifecyclepoint, OperationPointId.POST_CONDITION_ID.name());
      }
   }

   abstract protected void doCoreWork(IProgressMonitor monitor) throws Exception;

}

Back to the top