1 /******************************************************************************* 2 * Copyright (c) 2005, 2015 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 15 package org.eclipse.core.commands; 16 17 /** 18 * <p> 19 * An object that holds zero or more state objects. This state information can 20 * be shared between different instances of <code>IObjectWithState</code>. 21 * </p> 22 * <p> 23 * Clients may implement, but must not extend this interface. 24 * </p> 25 * 26 * @see AbstractHandlerWithState 27 * @since 3.2 28 */ 29 public interface IObjectWithState { 30 31 /** 32 * Adds state to this object. 33 * 34 * @param id 35 * The identifier indicating the type of state being added; must 36 * not be <code>null</code>. 37 * @param state 38 * The new state to add to this object; must not be 39 * <code>null</code>. 40 */ addState(String id, State state)41 public void addState(String id, State state); 42 43 /** 44 * Gets the state with the given id. 45 * 46 * @param stateId 47 * The identifier of the state to retrieve; must not be 48 * <code>null</code>. 49 * @return The state; may be <code>null</code> if there is no state with 50 * the given id. 51 */ getState(String stateId)52 public State getState(String stateId); 53 54 /** 55 * Gets the identifiers for all of the state associated with this object. 56 * 57 * @return All of the state identifiers; may be empty, but never 58 * <code>null</code>. 59 */ getStateIds()60 public String[] getStateIds(); 61 62 /** 63 * Removes state from this object. 64 * 65 * @param stateId 66 * The id of the state to remove from this object; must not be 67 * <code>null</code>. 68 */ removeState(String stateId)69 public void removeState(String stateId); 70 } 71