001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui;
011:
012: import org.eclipse.jface.util.IPropertyChangeListener;
013: import org.eclipse.swt.graphics.Image;
014:
015: /**
016: * Implements a reference to a IWorkbenchPart.
017: * The IWorkbenchPart will not be instanciated until the part
018: * becomes visible or the API getPart is sent with true;
019: * <p>
020: * This interface is not intended to be implemented by clients.
021: * </p>
022: */
023: public interface IWorkbenchPartReference {
024: /**
025: * Returns the IWorkbenchPart referenced by this object.
026: * Returns <code>null</code> if the editors was not instantiated or
027: * it failed to be restored. Tries to restore the editor
028: * if <code>restore</code> is true.
029: */
030: public IWorkbenchPart getPart(boolean restore);
031:
032: /**
033: * @see IWorkbenchPart#getTitle
034: */
035: public String getTitle();
036:
037: /**
038: * @see IWorkbenchPart#getTitleImage
039: */
040: public Image getTitleImage();
041:
042: /**
043: * @see IWorkbenchPart#getTitleToolTip
044: */
045: public String getTitleToolTip();
046:
047: /**
048: * @see IWorkbenchPartSite#getId
049: */
050: public String getId();
051:
052: /**
053: * @see IWorkbenchPart#addPropertyListener
054: */
055: public void addPropertyListener(IPropertyListener listener);
056:
057: /**
058: * @see IWorkbenchPart#removePropertyListener
059: */
060: public void removePropertyListener(IPropertyListener listener);
061:
062: /**
063: * Returns the workbench page that contains this part
064: */
065: public IWorkbenchPage getPage();
066:
067: /**
068: * Returns the name of the part, as it should be shown in tabs.
069: *
070: * @return the part name
071: *
072: * @since 3.0
073: */
074: public String getPartName();
075:
076: /**
077: * Returns the content description for the part (or the empty string if none)
078: *
079: * @return the content description for the part
080: *
081: * @since 3.0
082: */
083: public String getContentDescription();
084:
085: /**
086: * Returns whether the part is dirty (i.e. has unsaved changes).
087: *
088: * @return <code>true</code> if the part is dirty, <code>false</code> otherwise
089: *
090: * @since 3.2 (previously existed on IEditorReference)
091: */
092: public boolean isDirty();
093:
094: /**
095: * Return an arbitrary property from the reference. If the part has been
096: * instantiated, it just delegates to the part. If not, then it looks in its
097: * own cache of properties. If the property is not available or the part has
098: * never been instantiated, it can return <code>null</code>.
099: *
100: * @param key
101: * The property to return. Must not be <code>null</code>.
102: * @return The String property, or <code>null</code>.
103: * @since 3.3
104: */
105: public String getPartProperty(String key);
106:
107: /**
108: * Add a listener for changes in the arbitrary properties set.
109: *
110: * @param listener
111: * Must not be <code>null</code>.
112: * @since 3.3
113: */
114: public void addPartPropertyListener(IPropertyChangeListener listener);
115:
116: /**
117: * Remove a listener for changes in the arbitrary properties set.
118: *
119: * @param listener
120: * Must not be <code>null</code>.
121: * @since 3.3
122: */
123: public void removePartPropertyListener(
124: IPropertyChangeListener listener);
125: }
|