01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 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 org.eclipse.swt.widgets.Control;
13: import org.eclipse.swt.widgets.Display;
14: import org.eclipse.swt.widgets.Widget;
15:
16: public class CommandTarget {
17: private Widget widget;
18: private Object context;
19:
20: public CommandTarget(Widget widget, Object context) {
21: this .widget = widget;
22: this .context = context;
23: }
24:
25: public void ensureVisible() {
26: }
27:
28: public Widget getWidget() {
29: return widget;
30: }
31:
32: public Object getContext() {
33: return context;
34: }
35:
36: public void setFocus() {
37: ensureVisible();
38: Display display = widget.getDisplay();
39: if (widget instanceof Control) {
40: Control c = (Control) widget;
41: if (!c.equals(display.getFocusControl()))
42: c.setFocus();
43: }
44: }
45: }
|