01: /*******************************************************************************
02: * Copyright (c) 2004, 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.internal.console;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.ui.PlatformUI;
14: import org.eclipse.ui.console.IConsoleView;
15:
16: /**
17: * Toggles console auto-scroll
18: *
19: * @since 3.1
20: */
21: public class ScrollLockAction extends Action {
22:
23: private IConsoleView fConsoleView;
24:
25: public ScrollLockAction(IConsoleView consoleView) {
26: super (ConsoleMessages.ScrollLockAction_0);
27: fConsoleView = consoleView;
28:
29: setToolTipText(ConsoleMessages.ScrollLockAction_1);
30: setHoverImageDescriptor(ConsolePluginImages
31: .getImageDescriptor(IInternalConsoleConstants.IMG_LCL_LOCK));
32: setDisabledImageDescriptor(ConsolePluginImages
33: .getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_LOCK));
34: setImageDescriptor(ConsolePluginImages
35: .getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_LOCK));
36: PlatformUI.getWorkbench().getHelpSystem().setHelp(this ,
37: IConsoleHelpContextIds.CONSOLE_SCROLL_LOCK_ACTION);
38: boolean checked = fConsoleView.getScrollLock();
39: setChecked(checked);
40: }
41:
42: /**
43: * @see org.eclipse.jface.action.IAction#run()
44: */
45: public void run() {
46: fConsoleView.setScrollLock(isChecked());
47: }
48:
49: public void dispose() {
50: fConsoleView = null;
51: }
52:
53: }
|