1 11 package org.eclipse.ui.internal; 12 13 import org.eclipse.ui.IPartService; 14 import org.eclipse.ui.IWorkbenchPart; 15 import org.eclipse.ui.IWorkbenchPartReference; 16 import org.eclipse.ui.internal.misc.UIListenerLogging; 17 18 public class WorkbenchPagePartList extends PartList { 19 20 private PageSelectionService selectionService; 21 22 private PartService partService = new PartService(UIListenerLogging.PAGE_PARTLISTENER_EVENTS, 23 UIListenerLogging.PAGE_PARTLISTENER2_EVENTS); 24 25 public WorkbenchPagePartList(PageSelectionService selectionService) { 26 this.selectionService = selectionService; 27 } 28 29 public IPartService getPartService() { 30 return partService; 31 } 32 33 protected void firePartOpened(IWorkbenchPartReference part) { 34 partService.firePartOpened(part); 35 } 36 37 protected void firePartClosed(IWorkbenchPartReference part) { 38 partService.firePartClosed(part); 39 } 40 41 protected void firePartAdded(IWorkbenchPartReference part) { 42 } 44 45 protected void firePartRemoved(IWorkbenchPartReference part) { 46 } 48 49 protected void fireActiveEditorChanged(IWorkbenchPartReference ref) { 50 if (ref != null) { 51 firePartBroughtToTop(ref); 52 } 53 } 54 55 protected void fireActivePartChanged(IWorkbenchPartReference oldRef, IWorkbenchPartReference newRef) { 56 partService.setActivePart(newRef); 57 58 IWorkbenchPart realPart = newRef == null? null : newRef.getPart(false); 59 selectionService.setActivePart(realPart); 60 } 61 62 protected void firePartHidden(IWorkbenchPartReference ref) { 63 partService.firePartHidden(ref); 64 } 65 66 protected void firePartVisible(IWorkbenchPartReference ref) { 67 partService.firePartVisible(ref); 68 } 69 70 protected void firePartInputChanged(IWorkbenchPartReference ref) { 71 partService.firePartInputChanged(ref); 72 } 73 74 public void firePartBroughtToTop(IWorkbenchPartReference ref) { 75 partService.firePartBroughtToTop(ref); 76 } 77 } 78 | Popular Tags |