Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
blob: 6907bddcee2433bec7421396bd5b0e2ed7da116d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*******************************************************************************
 * Copyright (c) 2001, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.wst.command.internal.provisional.env.core;

import org.eclipse.wst.command.internal.provisional.env.core.common.Environment;
import org.eclipse.wst.command.internal.provisional.env.core.common.Status;

/**
 * Commands are executable, undoable, redoable objects.
 * Every Command has a name and a description.
 */
public interface Command
{
  /**
   * 
   * @return Returns a unique ID for this Command.
   */
  public String getId();
  
  /**
   * Returns the name of the Command, a short translatable string
   * indicating what the Command does. Can be null.
   * @return The name of the Command. Can be null.
   */
  public String getName ();

  /**
   * Returns the description of the Command. Can be null.
   * @return The description of the Command. Can be null.
   */
  public String getDescription ();
  
  /**
   * Executes the Command.
   * @param environment The environment.
   * Must not be null.
   * @return A <code>Status</code> object indicating the degree
   * to which the <code>execute</code> method was successful.
   * A valud of <code>null</code>, or a Status with a severity
   * of less than <code>Status.ERROR</code> signifies success.
   */
  public Status execute ( Environment environment );

  /**
   * Returns <code>true</code> if, and only if, the Command's
   * <code>undo</code> method is supported.
   * @return True if the Command supports being undone.
   */
  public boolean isUndoable ();

  /**
   * Undoes the Command.
   * @param environment The environment.
   * Must not be null.
   * @return A <code>Status</code> object indicating the degree
   * to which the <code>undo</code> method was successful.
   * A valud of <code>null</code>, or a Status with a severity
   * of less than <code>Status.ERROR</code> signifies success.
   */
  public Status undo ( Environment environment );

  /**
   * Returns <code>true</code> if, and only if, the Command's
   * <code>redo</code> method is supported.
   * @return True if the Command supports being redone.
   */
  public boolean isRedoable ();

  /**
   * Re-executes the Command.
   * @param environment The environment.
   * Must not be null.
   * @return A <code>Status</code> object indicating the degree
   * to which the <code>redo</code> method was successful.
   * A value of <code>null</code>, or a Status with a severity
   * of less then <code>Status.ERROR</code> signifies success.
   */
  public Status redo ( Environment environment );
}

Back to the top