01: /*******************************************************************************
02: * Copyright (c) 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.ui.examples.undo;
11:
12: import org.eclipse.core.commands.operations.AbstractOperation;
13: import org.eclipse.core.commands.operations.IUndoContext;
14: import org.eclipse.jface.dialogs.MessageDialog;
15: import org.eclipse.swt.widgets.Canvas;
16:
17: /**
18: * An undoable operation that represents a change to a box.
19: */
20: public abstract class BoxOperation extends AbstractOperation {
21:
22: /*
23: * The box involved in the operation
24: */
25: Box box;
26:
27: /*
28: * The group of boxes involved in the operation
29: */
30: Boxes boxes;
31:
32: /*
33: * The canvas to update or draw on during an operation
34: */
35: Canvas canvas;
36:
37: public BoxOperation(String label, IUndoContext undoContext,
38: Boxes boxes, Box box, Canvas canvas) {
39: super (label);
40: addContext(undoContext);
41: this .boxes = boxes;
42: this .box = box;
43: this .canvas = canvas;
44: }
45:
46: /*
47: * Show the specified prompt in an info dialog.
48: */
49: void showMessage(String message) {
50: MessageDialog.openInformation(canvas.getShell(),
51: UndoExampleMessages.BoxView_Title, message);
52: }
53: }
|