1 /******************************************************************************* 2 * Copyright (c) 2005, 2006 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 *******************************************************************************/ 11 12 package org.eclipse.core.commands; 13 14 /** 15 * <p> 16 * An object that holds zero or more state objects. This state information can 17 * be shared between different instances of <code>IObjectWithState</code>. 18 * </p> 19 * <p> 20 * Clients may implement, but must not extend this interface. 21 * </p> 22 * 23 * @see AbstractHandlerWithState 24 * @since 3.2 25 */ 26 public interface IObjectWithState { 27 28 /** 29 * Adds state to this object. 30 * 31 * @param id 32 * The identifier indicating the type of state being added; must 33 * not be <code>null</code>. 34 * @param state 35 * The new state to add to this object; must not be 36 * <code>null</code>. 37 */ 38 public void addState(String id, State state); 39 40 /** 41 * Gets the state with the given id. 42 * 43 * @param stateId 44 * The identifier of the state to retrieve; must not be 45 * <code>null</code>. 46 * @return The state; may be <code>null</code> if there is no state with 47 * the given id. 48 */ 49 public State getState(String stateId); 50 51 /** 52 * Gets the identifiers for all of the state associated with this object. 53 * 54 * @return All of the state identifiers; may be empty, but never 55 * <code>null</code>. 56 */ 57 public String[] getStateIds(); 58 59 /** 60 * Removes state from this object. 61 * 62 * @param stateId 63 * The id of the state to remove from this object; must not be 64 * <code>null</code>. 65 */ 66 public void removeState(String stateId); 67 } 68