KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > WorkbenchPartReference


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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 package org.eclipse.ui.internal;
12
13 import java.util.BitSet JavaDoc;
14 import java.util.HashMap JavaDoc;
15 import java.util.Iterator JavaDoc;
16 import java.util.Map JavaDoc;
17
18 import org.eclipse.core.runtime.Assert;
19 import org.eclipse.core.runtime.IStatus;
20 import org.eclipse.core.runtime.ListenerList;
21 import org.eclipse.jface.resource.ImageDescriptor;
22 import org.eclipse.jface.resource.JFaceResources;
23 import org.eclipse.jface.util.IPropertyChangeListener;
24 import org.eclipse.jface.util.PropertyChangeEvent;
25 import org.eclipse.osgi.util.NLS;
26 import org.eclipse.swt.events.DisposeEvent;
27 import org.eclipse.swt.events.DisposeListener;
28 import org.eclipse.swt.graphics.Image;
29 import org.eclipse.swt.widgets.Control;
30 import org.eclipse.swt.widgets.Display;
31 import org.eclipse.ui.IPropertyListener;
32 import org.eclipse.ui.ISaveablePart;
33 import org.eclipse.ui.ISaveablesLifecycleListener;
34 import org.eclipse.ui.ISharedImages;
35 import org.eclipse.ui.IWorkbenchPart;
36 import org.eclipse.ui.IWorkbenchPart2;
37 import org.eclipse.ui.IWorkbenchPart3;
38 import org.eclipse.ui.IWorkbenchPartConstants;
39 import org.eclipse.ui.IWorkbenchPartReference;
40 import org.eclipse.ui.IWorkbenchPartSite;
41 import org.eclipse.ui.PartInitException;
42 import org.eclipse.ui.PlatformUI;
43 import org.eclipse.ui.internal.misc.UIListenerLogging;
44 import org.eclipse.ui.internal.util.Util;
45
46 /**
47  *
48  */

49 public abstract class WorkbenchPartReference implements IWorkbenchPartReference {
50
51     /**
52      * Internal property ID: Indicates that the underlying part was created
53      */

54     public static final int INTERNAL_PROPERTY_OPENED = 0x211;
55     
56     /**
57      * Internal property ID: Indicates that the underlying part was destroyed
58      */

59     public static final int INTERNAL_PROPERTY_CLOSED = 0x212;
60
61     /**
62      * Internal property ID: Indicates that the result of IEditorReference.isPinned()
63      */

64     public static final int INTERNAL_PROPERTY_PINNED = 0x213;
65
66     /**
67      * Internal property ID: Indicates that the result of getVisible() has changed
68      */

69     public static final int INTERNAL_PROPERTY_VISIBLE = 0x214;
70
71     /**
72      * Internal property ID: Indicates that the result of isZoomed() has changed
73      */

74     public static final int INTERNAL_PROPERTY_ZOOMED = 0x215;
75
76     /**
77      * Internal property ID: Indicates that the part has an active child and the
78      * active child has changed. (fired by PartStack)
79      */

80     public static final int INTERNAL_PROPERTY_ACTIVE_CHILD_CHANGED = 0x216;
81
82     /**
83      * Internal property ID: Indicates that changed in the min / max
84      * state has changed
85      */

86     public static final int INTERNAL_PROPERTY_MAXIMIZED = 0x217;
87
88     // State constants //////////////////////////////
89

90     /**
91      * State constant indicating that the part is not created yet
92      */

93     public static int STATE_LAZY = 0;
94      
95     /**
96      * State constant indicating that the part is in the process of being created
97      */

98     public static int STATE_CREATION_IN_PROGRESS = 1;
99     
100     /**
101      * State constant indicating that the part has been created
102      */

103     public static int STATE_CREATED = 2;
104     
105     /**
106      * State constant indicating that the reference has been disposed (the reference shouldn't be
107      * used anymore)
108      */

109     public static int STATE_DISPOSED = 3;
110   
111     /**
112      * Current state of the reference. Used to detect recursive creation errors, disposed
113      * references, etc.
114      */

115     private int state = STATE_LAZY;
116    
117     protected IWorkbenchPart part;
118
119     private String JavaDoc id;
120
121     protected PartPane pane;
122
123     private boolean pinned = false;
124     
125     private String JavaDoc title;
126
127     private String JavaDoc tooltip;
128
129     /**
130      * Stores the current Image for this part reference. Lazily created. Null if not allocated.
131      */

132     private Image image = null;
133     
134     private ImageDescriptor defaultImageDescriptor;
135     
136     /**
137      * Stores the current image descriptor for the part.
138      */

139     private ImageDescriptor imageDescriptor;
140
141     /**
142      * API listener list
143      */

144     private ListenerList propChangeListeners = new ListenerList();
145
146     /**
147      * Internal listener list. Listens to the INTERNAL_PROPERTY_* property change events that are not yet API.
148      * TODO: Make these properties API in 3.2
149      */

150     private ListenerList internalPropChangeListeners = new ListenerList();
151     
152     private ListenerList partChangeListeners = new ListenerList();
153     
154     private String JavaDoc partName;
155
156     private String JavaDoc contentDescription;
157     
158     protected Map JavaDoc propertyCache = new HashMap JavaDoc();
159     
160     /**
161      * Used to remember which events have been queued.
162      */

163     private BitSet JavaDoc queuedEvents = new BitSet JavaDoc();
164
165     private boolean queueEvents = false;
166
167     private static DisposeListener prematureDisposeListener = new DisposeListener() {
168         public void widgetDisposed(DisposeEvent e) {
169             WorkbenchPlugin.log(new RuntimeException JavaDoc("Widget disposed too early!")); //$NON-NLS-1$
170
}
171     };
172     
173     private IPropertyListener propertyChangeListener = new IPropertyListener() {
174         /* (non-Javadoc)
175          * @see org.eclipse.ui.IPropertyListener#propertyChanged(java.lang.Object, int)
176          */

177         public void propertyChanged(Object JavaDoc source, int propId) {
178             partPropertyChanged(source, propId);
179         }
180     };
181     
182     private IPropertyChangeListener partPropertyChangeListener = new IPropertyChangeListener() {
183         public void propertyChange(PropertyChangeEvent event) {
184             partPropertyChanged(event);
185         }
186     };
187     
188     public WorkbenchPartReference() {
189         //no-op
190
}
191     
192     public boolean isDisposed() {
193         return state == STATE_DISPOSED;
194     }
195     
196     protected void checkReference() {
197         if (state == STATE_DISPOSED) {
198             throw new RuntimeException JavaDoc("Error: IWorkbenchPartReference disposed"); //$NON-NLS-1$
199
}
200     }
201     
202     /**
203      * Calling this with deferEvents(true) will queue all property change events until a subsequent
204      * call to deferEvents(false). This should be used at the beginning of a batch of related changes
205      * to prevent duplicate property change events from being sent.
206      *
207      * @param shouldQueue
208      */

209     private void deferEvents(boolean shouldQueue) {
210         queueEvents = shouldQueue;
211
212         if (queueEvents == false) {
213             // do not use nextSetBit, to allow compilation against JCL Foundation (bug 80053)
214
for (int i = 0, n = queuedEvents.size(); i < n; ++i) {
215                 if (queuedEvents.get(i)) {
216                     firePropertyChange(i);
217                     queuedEvents.clear(i);
218                 }
219             }
220         }
221     }
222
223     protected void setTitle(String JavaDoc newTitle) {
224         if (Util.equals(title, newTitle)) {
225             return;
226         }
227
228         title = newTitle;
229         firePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
230     }
231
232     protected void setPartName(String JavaDoc newPartName) {
233         if (Util.equals(partName, newPartName)) {
234             return;
235         }
236
237         partName = newPartName;
238         firePropertyChange(IWorkbenchPartConstants.PROP_PART_NAME);
239     }
240
241     protected void setContentDescription(String JavaDoc newContentDescription) {
242         if (Util.equals(contentDescription, newContentDescription)) {
243             return;
244         }
245
246         contentDescription = newContentDescription;
247         firePropertyChange(IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION);
248     }
249
250     protected void setImageDescriptor(ImageDescriptor descriptor) {
251         if (Util.equals(imageDescriptor, descriptor)) {
252             return;
253         }
254
255         Image oldImage = image;
256         ImageDescriptor oldDescriptor = imageDescriptor;
257         image = null;
258         imageDescriptor = descriptor;
259         
260         // Don't queue events triggered by image changes. We'll dispose the image
261
// immediately after firing the event, so we need to fire it right away.
262
immediateFirePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
263         if (queueEvents) {
264             // If there's a PROP_TITLE event queued, remove it from the queue because
265
// we've just fired it.
266
queuedEvents.clear(IWorkbenchPartConstants.PROP_TITLE);
267         }
268         
269         // If we had allocated the old image, deallocate it now (AFTER we fire the property change
270
// -- listeners may need to clean up references to the old image)
271
if (oldImage != null) {
272             JFaceResources.getResources().destroy(oldDescriptor);
273         }
274     }
275     
276     protected void setToolTip(String JavaDoc newToolTip) {
277         if (Util.equals(tooltip, newToolTip)) {
278             return;
279         }
280
281         tooltip = newToolTip;
282         firePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
283     }
284
285     protected void partPropertyChanged(Object JavaDoc source, int propId) {
286
287         // We handle these properties directly (some of them may be transformed
288
// before firing events to workbench listeners)
289
if (propId == IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION
290                 || propId == IWorkbenchPartConstants.PROP_PART_NAME
291                 || propId == IWorkbenchPartConstants.PROP_TITLE) {
292
293             refreshFromPart();
294         } else {
295             // Any other properties are just reported to listeners verbatim
296
firePropertyChange(propId);
297         }
298         
299         // Let the model manager know as well
300
if (propId == IWorkbenchPartConstants.PROP_DIRTY) {
301             IWorkbenchPart actualPart = getPart(false);
302             if (actualPart != null) {
303                 SaveablesList modelManager = (SaveablesList) actualPart.getSite().getService(ISaveablesLifecycleListener.class);
304                 modelManager.dirtyChanged(actualPart);
305             }
306         }
307     }
308     
309     protected void partPropertyChanged(PropertyChangeEvent event) {
310         firePartPropertyChange(event);
311     }
312
313     /**
314      * Refreshes all cached values with the values from the real part
315      */

316     protected void refreshFromPart() {
317         deferEvents(true);
318
319         setPartName(computePartName());
320         setTitle(computeTitle());
321         setContentDescription(computeContentDescription());
322         setToolTip(getRawToolTip());
323         setImageDescriptor(computeImageDescriptor());
324
325         deferEvents(false);
326     }
327     
328     protected ImageDescriptor computeImageDescriptor() {
329         if (part != null) {
330             return ImageDescriptor.createFromImage(part.getTitleImage(), Display.getCurrent());
331         }
332         return defaultImageDescriptor;
333     }
334
335     public void init(String JavaDoc id, String JavaDoc title, String JavaDoc tooltip,
336             ImageDescriptor desc, String JavaDoc paneName, String JavaDoc contentDescription) {
337         Assert.isNotNull(id);
338         Assert.isNotNull(title);
339         Assert.isNotNull(tooltip);
340         Assert.isNotNull(desc);
341         Assert.isNotNull(paneName);
342         Assert.isNotNull(contentDescription);
343         
344         this.id = id;
345         this.title = title;
346         this.tooltip = tooltip;
347         this.partName = paneName;
348         this.contentDescription = contentDescription;
349         this.defaultImageDescriptor = desc;
350         this.imageDescriptor = computeImageDescriptor();
351     }
352
353     /**
354      * Releases any references maintained by this part reference
355      * when its actual part becomes known (not called when it is disposed).
356      */

357     protected void releaseReferences() {
358
359     }
360
361     /* package */ void addInternalPropertyListener(IPropertyListener listener) {
362         internalPropChangeListeners.add(listener);
363     }
364     
365     /* package */ void removeInternalPropertyListener(IPropertyListener listener) {
366         internalPropChangeListeners.remove(listener);
367     }
368
369     protected void fireInternalPropertyChange(int id) {
370         Object JavaDoc listeners[] = internalPropChangeListeners.getListeners();
371         for (int i = 0; i < listeners.length; i++) {
372             ((IPropertyListener) listeners[i]).propertyChanged(this, id);
373         }
374     }
375     
376     /**
377      * @see IWorkbenchPart
378      */

379     public void addPropertyListener(IPropertyListener listener) {
380         // The properties of a disposed reference will never change, so don't
381
// add listeners
382
if (isDisposed()) {
383             return;
384         }
385         
386         propChangeListeners.add(listener);
387     }
388
389     /**
390      * @see IWorkbenchPart
391      */

392     public void removePropertyListener(IPropertyListener listener) {
393         // Currently I'm not calling checkReference here for fear of breaking things late in 3.1, but it may
394
// make sense to do so later. For now we just turn it into a NOP if the reference is disposed.
395
if (isDisposed()) {
396             return;
397         }
398         propChangeListeners.remove(listener);
399     }
400
401     public final String JavaDoc getId() {
402         if (part != null) {
403             IWorkbenchPartSite site = part.getSite();
404             if (site != null) {
405                 return site.getId();
406             }
407         }
408         return Util.safeString(id);
409     }
410
411     public String JavaDoc getTitleToolTip() {
412         return Util.safeString(tooltip);
413     }
414
415     protected final String JavaDoc getRawToolTip() {
416         return Util.safeString(part.getTitleToolTip());
417     }
418
419     /**
420      * Returns the pane name for the part
421      *
422      * @return the pane name for the part
423      */

424     public String JavaDoc getPartName() {
425         return Util.safeString(partName);
426     }
427     
428     /**
429      * Gets the part name directly from the associated workbench part,
430      * or the empty string if none.
431      *
432      * @return
433      */

434     protected final String JavaDoc getRawPartName() {
435         String JavaDoc result = ""; //$NON-NLS-1$
436

437         if (part instanceof IWorkbenchPart2) {
438             IWorkbenchPart2 part2 = (IWorkbenchPart2) part;
439
440             result = Util.safeString(part2.getPartName());
441         }
442
443         return result;
444     }
445
446     protected String JavaDoc computePartName() {
447         return getRawPartName();
448     }
449
450     /**
451      * Returns the content description for this part.
452      *
453      * @return the pane name for the part
454      */

455     public String JavaDoc getContentDescription() {
456         return Util.safeString(contentDescription);
457     }
458
459     /**
460      * Computes a new content description for the part. Subclasses may override to change the
461      * default behavior
462      *
463      * @return the new content description for the part
464      */

465     protected String JavaDoc computeContentDescription() {
466         return getRawContentDescription();
467     }
468
469     /**
470      * Returns the content description as set directly by the part, or the empty string if none
471      *
472      * @return the unmodified content description from the part (or the empty string if none)
473      */

474     protected final String JavaDoc getRawContentDescription() {
475         if (part instanceof IWorkbenchPart2) {
476             IWorkbenchPart2 part2 = (IWorkbenchPart2) part;
477
478             return part2.getContentDescription();
479         }
480
481         return ""; //$NON-NLS-1$
482
}
483
484     public boolean isDirty() {
485         if (!(part instanceof ISaveablePart)) {
486             return false;
487         }
488         return ((ISaveablePart) part).isDirty();
489     }
490
491     public String JavaDoc getTitle() {
492         return Util.safeString(title);
493     }
494
495     /**
496      * Computes a new title for the part. Subclasses may override to change the default behavior.
497      *
498      * @return the title for the part
499      */

500     protected String JavaDoc computeTitle() {
501         return getRawTitle();
502     }
503
504     /**
505      * Returns the unmodified title for the part, or the empty string if none
506      *
507      * @return the unmodified title, as set by the IWorkbenchPart. Returns the empty string if none.
508      */

509     protected final String JavaDoc getRawTitle() {
510         return Util.safeString(part.getTitle());
511     }
512
513     public final Image getTitleImage() {
514         if (isDisposed()) {
515             return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
516         }
517         
518         if (image == null) {
519             image = JFaceResources.getResources().createImageWithDefault(imageDescriptor);
520         }
521         return image;
522     }
523     
524     public ImageDescriptor getTitleImageDescriptor() {
525         if (isDisposed()) {
526             return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW);
527         }
528         
529         return imageDescriptor;
530     }
531     
532     /* package */ void fireVisibilityChange() {
533         fireInternalPropertyChange(INTERNAL_PROPERTY_VISIBLE);
534     }
535
536     /* package */ void fireZoomChange() {
537         fireInternalPropertyChange(INTERNAL_PROPERTY_ZOOMED);
538     }
539     
540     public boolean getVisible() {
541         if (isDisposed()) {
542             return false;
543         }
544         return getPane().getVisible();
545     }
546     
547     public void setVisible(boolean isVisible) {
548         if (isDisposed()) {
549             return;
550         }
551         getPane().setVisible(isVisible);
552     }
553     
554     protected void firePropertyChange(int id) {
555
556         if (queueEvents) {
557             queuedEvents.set(id);
558             return;
559         }
560         
561         immediateFirePropertyChange(id);
562     }
563     
564     private void immediateFirePropertyChange(int id) {
565         UIListenerLogging.logPartReferencePropertyChange(this, id);
566         Object JavaDoc listeners[] = propChangeListeners.getListeners();
567         for (int i = 0; i < listeners.length; i++) {
568             ((IPropertyListener) listeners[i]).propertyChanged(part, id);
569         }
570         
571         fireInternalPropertyChange(id);
572     }
573
574     public final IWorkbenchPart getPart(boolean restore) {
575         if (isDisposed()) {
576             return null;
577         }
578         
579         if (part == null && restore) {
580             
581             if (state == STATE_CREATION_IN_PROGRESS) {
582                 IStatus result = WorkbenchPlugin.getStatus(
583                         new PartInitException(NLS.bind("Warning: Detected recursive attempt by part {0} to create itself (this is probably, but not necessarily, a bug)", //$NON-NLS-1$
584
getId())));
585                 WorkbenchPlugin.log(result);
586                 return null;
587             }
588             
589             try {
590                 state = STATE_CREATION_IN_PROGRESS;
591                 
592                 IWorkbenchPart newPart = createPart();
593                 if (newPart != null) {
594                     part = newPart;
595                     // Add a dispose listener to the part. This dispose listener does nothing but log an exception
596
// if the part's widgets get disposed unexpectedly. The workbench part reference is the only
597
// object that should dispose this control, and it will remove the listener before it does so.
598
getPane().getControl().addDisposeListener(prematureDisposeListener);
599                     part.addPropertyListener(propertyChangeListener);
600                     if (part instanceof IWorkbenchPart3) {
601                         ((IWorkbenchPart3)part).addPartPropertyListener(partPropertyChangeListener);
602                     }
603
604                     refreshFromPart();
605                     releaseReferences();
606                     
607                     fireInternalPropertyChange(INTERNAL_PROPERTY_OPENED);
608                 }
609             } finally {
610                 state = STATE_CREATED;
611             }
612         }
613         
614         return part;
615     }
616     
617     protected abstract IWorkbenchPart createPart();
618         
619     protected abstract PartPane createPane();
620     
621     /**
622      * Returns the part pane for this part reference. Does not return null. Should not be called
623      * if the reference has been disposed.
624      *
625      * TODO: clean up all code that has any possibility of calling this on a disposed reference
626      * and make this method throw an exception if anyone else attempts to do so.
627      *
628      * @return
629      */

630     public final PartPane getPane() {
631         
632         // Note: we should never call this if the reference has already been disposed, since it
633
// may cause a PartPane to be created and leaked.
634
if (pane == null) {
635             pane = createPane();
636         }
637         return pane;
638     }
639
640     public final void dispose() {
641         
642         if (isDisposed()) {
643             return;
644         }
645         
646         // Store the current title, tooltip, etc. so that anyone that they can be returned to
647
// anyone that held on to the disposed reference.
648
partName = getPartName();
649         contentDescription = getContentDescription();
650         tooltip = getTitleToolTip();
651         title = getTitle();
652         
653         if (state == STATE_CREATION_IN_PROGRESS) {
654             IStatus result = WorkbenchPlugin.getStatus(
655                     new PartInitException(NLS.bind("Warning: Blocked recursive attempt by part {0} to dispose itself during creation", //$NON-NLS-1$
656
getId())));
657             WorkbenchPlugin.log(result);
658             return;
659         }
660         
661         // Disposing the pane disposes the part's widgets. The part's widgets need to be disposed before the part itself.
662
if (pane != null) {
663             // Remove the dispose listener since this is the correct place for the widgets to get disposed
664
Control targetControl = getPane().getControl();
665             if (targetControl != null) {
666                 targetControl.removeDisposeListener(prematureDisposeListener);
667             }
668             pane.dispose();
669         }
670         
671         doDisposePart();
672    
673         if (pane != null) {
674             pane.removeContributions();
675         }
676         
677         clearListenerList(internalPropChangeListeners);
678         clearListenerList(partChangeListeners);
679         Image oldImage = image;
680         ImageDescriptor oldDescriptor = imageDescriptor;
681         image = null;
682         
683         state = STATE_DISPOSED;
684         imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
685         defaultImageDescriptor = ImageDescriptor.getMissingImageDescriptor();
686         immediateFirePropertyChange(IWorkbenchPartConstants.PROP_TITLE);
687         clearListenerList(propChangeListeners);
688         
689         if (oldImage != null) {
690             JFaceResources.getResources().destroy(oldDescriptor);
691         }
692     }
693
694     /**
695      * Clears all of the listeners in a listener list. TODO Bug 117519 Remove
696      * this method when fixed.
697      *
698      * @param list
699      * The list to be clear; must not be <code>null</code>.
700      */

701     private final void clearListenerList(final ListenerList list) {
702         final Object JavaDoc[] listeners = list.getListeners();
703         for (int i = 0; i < listeners.length; i++) {
704             list.remove(listeners[i]);
705         }
706     }
707
708     /**
709      *
710      */

711     protected void doDisposePart() {
712         if (part != null) {
713             fireInternalPropertyChange(INTERNAL_PROPERTY_CLOSED);
714             // Don't let exceptions in client code bring us down. Log them and continue.
715
try {
716                 part.removePropertyListener(propertyChangeListener);
717                 if (part instanceof IWorkbenchPart3) {
718                     ((IWorkbenchPart3)part).removePartPropertyListener(partPropertyChangeListener);
719                 }
720                 part.dispose();
721             } catch (Exception JavaDoc e) {
722                 WorkbenchPlugin.log(e);
723             }
724             part = null;
725         }
726     }
727
728     public void setPinned(boolean newPinned) {
729         if (isDisposed()) {
730             return;
731         }
732
733         if (newPinned == pinned) {
734             return;
735         }
736         
737         pinned = newPinned;
738         
739         setImageDescriptor(computeImageDescriptor());
740         
741         fireInternalPropertyChange(INTERNAL_PROPERTY_PINNED);
742     }
743     
744     public boolean isPinned() {
745         return pinned;
746     }
747
748     /* (non-Javadoc)
749      * @see org.eclipse.ui.IWorkbenchPartReference#getPartProperty(java.lang.String)
750      */

751     public String JavaDoc getPartProperty(String JavaDoc key) {
752         if (part != null) {
753             if (part instanceof IWorkbenchPart3) {
754                 return ((IWorkbenchPart3) part).getPartProperty(key);
755             }
756         } else {
757             return (String JavaDoc)propertyCache.get(key);
758         }
759         return null;
760     }
761     
762     /* (non-Javadoc)
763      * @see org.eclipse.ui.IWorkbenchPartReference#addPartPropertyListener(org.eclipse.jface.util.IPropertyChangeListener)
764      */

765     public void addPartPropertyListener(IPropertyChangeListener listener) {
766         if (isDisposed()) {
767             return;
768         }
769         partChangeListeners.add(listener);
770     }
771     
772     /* (non-Javadoc)
773      * @see org.eclipse.ui.IWorkbenchPartReference#removePartPropertyListener(org.eclipse.jface.util.IPropertyChangeListener)
774      */

775     public void removePartPropertyListener(IPropertyChangeListener listener) {
776         if (isDisposed()) {
777             return;
778         }
779         partChangeListeners.remove(listener);
780     }
781     
782     protected void firePartPropertyChange(PropertyChangeEvent event) {
783         Object JavaDoc[] l = partChangeListeners.getListeners();
784         for (int i = 0; i < l.length; i++) {
785             ((IPropertyChangeListener) l[i]).propertyChange(event);
786         }
787     }
788     
789     protected void createPartProperties(IWorkbenchPart3 workbenchPart) {
790         Iterator JavaDoc i = propertyCache.entrySet().iterator();
791         while (i.hasNext()) {
792             Map.Entry JavaDoc e = (Map.Entry JavaDoc) i.next();
793             workbenchPart.setPartProperty((String JavaDoc) e.getKey(), (String JavaDoc) e.getValue());
794         }
795     }
796 }
797
Popular Tags