KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > junit > ui > ScrollLockAction


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.junit.ui;
12
13
14 import org.eclipse.jface.action.Action;
15 import org.eclipse.ui.PlatformUI;
16
17 /**
18  * Toggles console auto-scroll
19  */

20 public class ScrollLockAction extends Action {
21
22     private TestRunnerViewPart fRunnerViewPart;
23
24     public ScrollLockAction(TestRunnerViewPart viewer) {
25         super(JUnitMessages.ScrollLockAction_action_label);
26         fRunnerViewPart= viewer;
27         setToolTipText(JUnitMessages.ScrollLockAction_action_tooltip);
28         setDisabledImageDescriptor(JUnitPlugin.getImageDescriptor("dlcl16/lock.gif")); //$NON-NLS-1$
29
setHoverImageDescriptor(JUnitPlugin.getImageDescriptor("elcl16/lock.gif")); //$NON-NLS-1$
30
setImageDescriptor(JUnitPlugin.getImageDescriptor("elcl16/lock.gif")); //$NON-NLS-1$
31
PlatformUI.getWorkbench().getHelpSystem().setHelp(
32             this,
33             IJUnitHelpContextIds.OUTPUT_SCROLL_LOCK_ACTION);
34         setChecked(false);
35     }
36
37     /**
38      * @see org.eclipse.jface.action.IAction#run()
39      */

40     public void run() {
41         fRunnerViewPart.setAutoScroll(!isChecked());
42     }
43 }
44
45
Popular Tags