comparison org.eclipse.jface/src/org/eclipse/jface/commands/PersistentState.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13
14 module org.eclipse.jface.commands.PersistentState;
15
16 import org.eclipse.core.commands.State;
17 import org.eclipse.jface.preference.IPreferenceStore;
18
19 import java.lang.all;
20 import java.util.Set;
21
22 /**
23 * <p>
24 * This is a state that can be made persistent. A state is persisted to a
25 * preference store.
26 * </p>
27 * <p>
28 * Clients may extend this class.
29 * </p>
30 *
31 * @since 3.2
32 */
33 public abstract class PersistentState : State {
34
35 /**
36 * Whether this state should be persisted.
37 */
38 private bool persisted;
39
40 /**
41 * Loads this state from the preference store, given the location at which
42 * to look. This method must be symmetric with a call to
43 * {@link #save(IPreferenceStore, String)}.
44 *
45 * @param store
46 * The store from which to read; must not be <code>null</code>.
47 * @param preferenceKey
48 * The key at which the state is stored; must not be
49 * <code>null</code>.
50 */
51 public abstract void load(IPreferenceStore store,
52 String preferenceKey);
53
54 /**
55 * Saves this state to the preference store, given the location at which to
56 * write. This method must be symmetric with a call to
57 * {@link #load(IPreferenceStore, String)}.
58 *
59 * @param store
60 * The store to which the state should be written; must not be
61 * <code>null</code>.
62 * @param preferenceKey
63 * The key at which the state should be stored; must not be
64 * <code>null</code>.
65 */
66 public abstract void save(IPreferenceStore store,
67 String preferenceKey);
68
69 /**
70 * Sets whether this state should be persisted.
71 *
72 * @param persisted
73 * Whether this state should be persisted.
74 */
75 public void setShouldPersist(bool persisted) {
76 this.persisted = persisted;
77 }
78
79 /**
80 * Whether this state should be persisted. Subclasses should check this
81 * method before loading or saving.
82 *
83 * @return <code>true</code> if this state should be persisted;
84 * <code>false</code> otherwise.
85 */
86 public bool shouldPersist() {
87 return persisted;
88 }
89 }