KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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 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         // 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(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