KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > actions > ManageBreakpointRulerActionDelegate


1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.ui.actions;
12
13
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.text.source.IVerticalRulerInfo;
16 import org.eclipse.ui.IEditorPart;
17 import org.eclipse.ui.texteditor.AbstractRulerActionDelegate;
18 import org.eclipse.ui.texteditor.ITextEditor;
19
20 public class ManageBreakpointRulerActionDelegate extends AbstractRulerActionDelegate {
21
22     private ManageBreakpointRulerAction targetAction;
23     private IEditorPart activeEditor;
24     
25     /**
26      * @see AbstractRulerActionDelegate#createAction()
27      */

28     protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) {
29         targetAction = new ManageBreakpointRulerAction(rulerInfo, editor);
30         return targetAction;
31     }
32
33     /* (non-Javadoc)
34      * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart)
35      */

36     public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) {
37         if (activeEditor != null) {
38             if (targetAction != null) {
39                 targetAction.dispose();
40                 targetAction = null;
41             }
42         }
43         activeEditor = targetEditor;
44         super.setActiveEditor(callerAction, targetEditor);
45     }
46 }
47
Popular Tags