Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 8b57dc387ed40adc749415df742ac84b2cc557e9 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/**
 * AbstractStepperService.java
 * Created on Apr 10, 2013
 *
 * Copyright (c) 2013 Wind River Systems, Inc.
 *
 * The right to copy, distribute, modify, or otherwise make use
 * of this software may be licensed only pursuant to the terms
 * of an applicable Wind River license agreement.
 */
package org.eclipse.tcf.te.tcf.locator.services;

import org.eclipse.core.runtime.Assert;
import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerModel;
import org.eclipse.tcf.te.tcf.locator.interfaces.services.IStepperServiceOperations;

/**
 * Abstract connect/disconnect stepper service implementation.
 */
public abstract class AbstractStepperService extends org.eclipse.tcf.te.runtime.stepper.services.AbstractStepperService {

	/**
	 * Constructor.
	 */
	public AbstractStepperService() {
	}

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService#isHandledOperation(java.lang.Object, java.lang.String)
	 */
	@Override
	public boolean isHandledOperation(Object context, String operation) {
		return IStepperServiceOperations.CONNECT.equals(operation) ||
						IStepperServiceOperations.DISCONNECT.equals(operation) ||
						IStepperServiceOperations.ATTACH_DEBUGGER.equals(operation);
	}

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.runtime.services.interfaces.IStepperService#getStepGroupId(java.lang.Object, java.lang.String)
	 */
	@Override
	public String getStepGroupId(Object context, String operation) {
		Assert.isTrue(context instanceof IPeerModel);

		if (IStepperServiceOperations.CONNECT.equals(operation) || IStepperServiceOperations.ATTACH_DEBUGGER.equals(operation)) {
			return "org.eclipse.tcf.te.tcf.locator.connectStepGroup"; //$NON-NLS-1$
		}
		if (IStepperServiceOperations.DISCONNECT.equals(operation)) {
			return "org.eclipse.tcf.te.tcf.locator.disconnectStepGroup"; //$NON-NLS-1$
		}

		return null;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.runtime.services.interfaces.IStepperService#getStepGroupName(java.lang.Object, java.lang.String)
	 */
	@Override
	public String getStepGroupName(Object context, String operation) {
		Assert.isTrue(context instanceof IPeerModel);

		if (IStepperServiceOperations.CONNECT.equals(operation)) {
			return "Connect "+((IPeerModel)context).getName(); //$NON-NLS-1$
		}
		if (IStepperServiceOperations.DISCONNECT.equals(operation)) {
			return "Disconnect "+((IPeerModel)context).getName(); //$NON-NLS-1$
		}
		if (IStepperServiceOperations.ATTACH_DEBUGGER.equals(operation)) {
			return "Attach Debugger to "+((IPeerModel)context).getName(); //$NON-NLS-1$
		}

		return null;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepperService#isCancelable(java.lang.Object, java.lang.String)
	 */
	@Override
	public boolean isCancelable(Object context, String operation) {
		return IStepperServiceOperations.CONNECT.equals(operation) || IStepperServiceOperations.ATTACH_DEBUGGER.equals(operation);
	}
}

Back to the top