KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > console > ScrollLockAction


1 /*******************************************************************************
2  * Copyright (c) 2004, 2007 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.console;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.ui.PlatformUI;
15 import org.eclipse.ui.console.IConsoleView;
16
17 /**
18  * Toggles console auto-scroll
19  *
20  * @since 3.1
21  */

22 public class ScrollLockAction extends Action {
23
24     private IConsoleView fConsoleView;
25     
26     public ScrollLockAction(IConsoleView consoleView) {
27         super(ConsoleMessages.ScrollLockAction_0);
28         fConsoleView = consoleView;
29         
30         setToolTipText(ConsoleMessages.ScrollLockAction_1);
31         setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_LOCK));
32         setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_LOCK));
33         setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_LOCK));
34         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_SCROLL_LOCK_ACTION);
35         boolean checked = fConsoleView.getScrollLock();
36         setChecked(checked);
37     }
38
39     /**
40      * @see org.eclipse.jface.action.IAction#run()
41      */

42     public void run() {
43         fConsoleView.setScrollLock(isChecked());
44     }
45     
46     public void dispose() {
47         fConsoleView = null;
48     }
49
50 }
51
52
Popular Tags