KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ca > mcgill > sable > soot > resources > EditorActivationListener


1 /* Soot - a J*va Optimization Framework
2  * Copyright (C) 2004 Jennifer Lhotak
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */

19
20 package ca.mcgill.sable.soot.resources;
21
22 import org.eclipse.core.resources.IResource;
23 import org.eclipse.core.runtime.IAdaptable;
24 import org.eclipse.jdt.core.IJavaElement;
25 import org.eclipse.jface.text.ITextOperationTarget;
26 import org.eclipse.jface.text.source.SourceViewer;
27 import org.eclipse.ui.IEditorInput;
28 import org.eclipse.ui.IEditorPart;
29 import org.eclipse.ui.IPartListener;
30 import org.eclipse.ui.IWorkbenchPart;
31 import org.eclipse.ui.texteditor.AbstractTextEditor;
32
33 import ca.mcgill.sable.soot.SootPlugin;
34 import ca.mcgill.sable.soot.attributes.*;
35 import org.eclipse.ui.texteditor.*;
36
37 public class EditorActivationListener implements IPartListener {
38
39     /* (non-Javadoc)
40      * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
41      */

42     public void partActivated(IWorkbenchPart part) {
43         if (!(part instanceof ITextEditor)) return;
44         IEditorPart activeEdPart = (IEditorPart)part;
45         SootPlugin.getDefault().getPartManager().updatePart(activeEdPart);
46     }
47
48     /* (non-Javadoc)
49      * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
50      */

51     public void partBroughtToTop(IWorkbenchPart part) {
52         
53     }
54
55     /* (non-Javadoc)
56      * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
57      */

58     public void partClosed(IWorkbenchPart part) {
59     }
60
61     /* (non-Javadoc)
62      * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
63      */

64     public void partDeactivated(IWorkbenchPart part) {
65         // here not sure
66
}
67
68     /* (non-Javadoc)
69      * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
70      */

71     public void partOpened(IWorkbenchPart part) {
72         // maybe need to handle this as well
73
SootPlugin.getDefault().getPartManager().setUpdateForOpen(true);
74     }
75
76 }
77
Popular Tags