Mercurial > projects > dwt-addons
comparison dwtx/core/commands/operations/UndoContext.d @ 3:6518c18a01f7
eclipse.core package without osgi dependencies
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 26 Mar 2008 00:57:19 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:a012107a911c | 3:6518c18a01f7 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2005 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module dwtx.core.commands.operations.UndoContext; | |
14 | |
15 import dwtx.core.commands.operations.IUndoContext; | |
16 | |
17 import dwt.dwthelper.utils; | |
18 | |
19 /** | |
20 * <p> | |
21 * A simple, lightweight undo context that can be used to tag any operation. It | |
22 * does not provided a specialized label. This class may be instantiated by | |
23 * clients. This class may also be subclassed. | |
24 * </p> | |
25 * | |
26 * @since 3.1 | |
27 */ | |
28 public class UndoContext : IUndoContext { | |
29 | |
30 /** | |
31 * <p> | |
32 * Get the label that describes the undo context. The default implementation | |
33 * returns the empty String. Subclasses may override. | |
34 * </p> | |
35 * | |
36 * @return the label for the context. | |
37 */ | |
38 public String getLabel() { | |
39 return ""; //$NON-NLS-1$ | |
40 } | |
41 | |
42 /** | |
43 * <p> | |
44 * Return whether the specified context is considered a match for the | |
45 * receiving context. When a context matches another context, operations | |
46 * that have the context are considered to also have the matching context. | |
47 * The default implementation checks whether the supplied context is | |
48 * identical to this context. Subclasses may override. | |
49 * </p> | |
50 * | |
51 * @param context | |
52 * the context to be checked against the receiving context. | |
53 * | |
54 * @return <code>true</code> if the receiving context can be considered a | |
55 * match for the specified context, and <code>false</code> if it | |
56 * cannot. | |
57 */ | |
58 public bool matches(IUndoContext context) { | |
59 return context is this; | |
60 } | |
61 } |