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.io.PrintWriter;
13: import java.util.Hashtable;
14:
15: import org.eclipse.swt.widgets.Event;
16: import org.w3c.dom.Node;
17:
18: public abstract class ToggleStructuredCommand extends
19: AbstractStructuredCommand {
20: protected boolean value;
21:
22: /**
23: * @param wid
24: */
25: public ToggleStructuredCommand(WidgetIdentifier wid) {
26: super (wid);
27: }
28:
29: public boolean mergeEvent(Event e) {
30: return false;
31: }
32:
33: protected void load(Node node, Hashtable lineTable) {
34: super .load(node, lineTable);
35: String att = MacroUtil.getAttribute(node, "value");
36: this .value = att != null && att.equals("true");
37: }
38:
39: protected void writeAdditionalAttributes(PrintWriter writer) {
40: writer.print(" value=\"");
41: writer.print(value ? "true" : "false");
42: writer.print("\"");
43: }
44:
45: public boolean getValue() {
46: return value;
47: }
48: }
|