KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > workingsets > EditorTracker


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.jdt.internal.ui.workingsets;
12
13 import org.eclipse.ui.IEditorPart;
14 import org.eclipse.ui.IPageListener;
15 import org.eclipse.ui.IPartListener;
16 import org.eclipse.ui.IWindowListener;
17 import org.eclipse.ui.IWorkbenchPage;
18 import org.eclipse.ui.IWorkbenchPart;
19 import org.eclipse.ui.IWorkbenchWindow;
20
21
22 public abstract class EditorTracker implements IWindowListener, IPageListener, IPartListener {
23     
24     //--- Window listener
25

26     public void windowActivated(IWorkbenchWindow window) {
27     }
28     public void windowDeactivated(IWorkbenchWindow window) {
29     }
30     public void windowClosed(IWorkbenchWindow window) {
31         window.removePageListener(this);
32     }
33     public void windowOpened(IWorkbenchWindow window) {
34         window.addPageListener(this);
35     }
36     
37     //---- IPageListener
38

39     public void pageActivated(IWorkbenchPage page) {
40     }
41     public void pageClosed(IWorkbenchPage page) {
42         page.removePartListener(this);
43     }
44     public void pageOpened(IWorkbenchPage page) {
45         page.addPartListener(this);
46     }
47     
48     //---- Part Listener
49

50     public void partActivated(IWorkbenchPart part) {
51     }
52     public void partBroughtToTop(IWorkbenchPart part) {
53     }
54     public void partClosed(IWorkbenchPart part) {
55         if (part instanceof IEditorPart) {
56             editorClosed((IEditorPart)part);
57         }
58     }
59     public void partDeactivated(IWorkbenchPart part) {
60     }
61     public void partOpened(IWorkbenchPart part) {
62         if (part instanceof IEditorPart) {
63             editorOpened((IEditorPart)part);
64         }
65     }
66     
67     public abstract void editorOpened(IEditorPart part);
68     
69     public abstract void editorClosed(IEditorPart part);
70     
71 }
72
Popular Tags