01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.tests.macro;
11:
12: import java.util.Hashtable;
13: import java.util.Map;
14:
15: import org.eclipse.core.runtime.CoreException;
16: import org.eclipse.core.runtime.IProgressMonitor;
17: import org.eclipse.swt.widgets.Composite;
18: import org.eclipse.swt.widgets.Display;
19: import org.w3c.dom.Node;
20:
21: public abstract class MacroInstruction implements IWritable, IPlayable {
22: private int[] range;
23: private String id;
24:
25: public MacroInstruction(String id) {
26: this .id = id;
27: }
28:
29: public String getId() {
30: return id;
31: }
32:
33: protected void load(Node node, Hashtable lineTable) {
34: this .id = MacroUtil.getAttribute(node, "id");
35: bindSourceLocation(node, lineTable);
36: }
37:
38: void bindSourceLocation(Node node, Map lineTable) {
39: Integer[] lines = (Integer[]) lineTable.get(node);
40: if (lines != null) {
41: range = new int[2];
42: range[0] = lines[0].intValue();
43: range[1] = lines[1].intValue();
44: }
45: }
46:
47: public int getStartLine() {
48: if (range == null)
49: return -1;
50: return range[0];
51: }
52:
53: public int getStopLine() {
54: if (range == null)
55: return -1;
56: return range[1];
57: }
58:
59: public boolean playback(Display display, Composite parent,
60: IProgressMonitor monitor) throws CoreException {
61: return false;
62: }
63: }
|