01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui;
11:
12: import java.util.Map;
13:
14: import org.eclipse.jface.util.IPropertyChangeListener;
15:
16: /**
17: * A part can provide arbitrary properties. The properties will be persisted
18: * between sessions by the part reference, and will be available from the part
19: * reference as well as the part. The properties can only be set on a part, not
20: * on the reference. The properties will be available to the IPresentablePart.
21: * <p>
22: * Setting a property must fire a PropertyChangeEvent.
23: * </p>
24: *
25: * @since 3.3
26: */
27: public interface IWorkbenchPart3 extends IWorkbenchPart2 {
28: /**
29: * Add a listener for changes in the arbitrary properties set.
30: * <p>
31: * <b>Note:</b> this is a different set of properties than the ones covered
32: * by the IWorkbenchPartConstants.PROP_* constants.
33: * </p>
34: *
35: * @param listener
36: * Must not be <code>null</code>.
37: */
38: public void addPartPropertyListener(IPropertyChangeListener listener);
39:
40: /**
41: * Remove a change listener from the arbitrary properties set.
42: * <p>
43: * <b>Note:</b> this is a different set of properties than the ones covered
44: * by the IWorkbenchPartConstants.PROP_* constants.
45: * </p>
46: *
47: * @param listener
48: * Must not be <code>null</code>.
49: */
50: public void removePartPropertyListener(
51: IPropertyChangeListener listener);
52:
53: /**
54: * Return the value for the arbitrary property key, or <code>null</code>.
55: *
56: * @param key
57: * the arbitrary property. Must not be <code>null</code>.
58: * @return the property value, or <code>null</code>.
59: */
60: public String getPartProperty(String key);
61:
62: /**
63: * Set an arbitrary property on the part. It is the implementor's
64: * responsibility to fire the corresponding PropertyChangeEvent.
65: * <p>
66: * A default implementation has been added to WorkbenchPart.
67: * </p>
68: *
69: * @param key
70: * the arbitrary property. Must not be <code>null</code>.
71: * @param value
72: * the property value. A <code>null</code> value will remove
73: * that property.
74: */
75: public void setPartProperty(String key, String value);
76:
77: /**
78: * Return an unmodifiable map of the arbitrary properties. This method can
79: * be used to save the properties during workbench save/restore.
80: *
81: * @return A Map of the properties. Must not be <code>null</code>.
82: */
83: public Map getPartProperties();
84: }
|