01: /*******************************************************************************
02: * Copyright (c) 2005, 2006 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.internal;
11:
12: import org.eclipse.ui.IPartService;
13: import org.eclipse.ui.IWorkbenchPart;
14: import org.eclipse.ui.IWorkbenchPartReference;
15: import org.eclipse.ui.internal.misc.UIListenerLogging;
16:
17: public class WorkbenchPagePartList extends PartList {
18:
19: private PageSelectionService selectionService;
20:
21: private PartService partService = new PartService(
22: 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: // TODO: There is no listener for workbench page additions yet
43: }
44:
45: protected void firePartRemoved(IWorkbenchPartReference part) {
46: // TODO: There is no listener for workbench page removals yet
47: }
48:
49: protected void fireActiveEditorChanged(IWorkbenchPartReference ref) {
50: if (ref != null) {
51: firePartBroughtToTop(ref);
52: }
53: }
54:
55: protected void fireActivePartChanged(
56: IWorkbenchPartReference oldRef,
57: IWorkbenchPartReference newRef) {
58: partService.setActivePart(newRef);
59:
60: IWorkbenchPart realPart = newRef == null ? null : newRef
61: .getPart(false);
62: selectionService.setActivePart(realPart);
63: }
64:
65: protected void firePartHidden(IWorkbenchPartReference ref) {
66: partService.firePartHidden(ref);
67: }
68:
69: protected void firePartVisible(IWorkbenchPartReference ref) {
70: partService.firePartVisible(ref);
71: }
72:
73: protected void firePartInputChanged(IWorkbenchPartReference ref) {
74: partService.firePartInputChanged(ref);
75: }
76:
77: public void firePartBroughtToTop(IWorkbenchPartReference ref) {
78: partService.firePartBroughtToTop(ref);
79: }
80: }
|