KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.jface.action.IAction;
15 import org.eclipse.ui.PlatformUI;
16 import org.eclipse.ui.console.IConsoleView;
17 import org.eclipse.ui.texteditor.IUpdate;
18
19 /**
20  * Pins the currently visible console in a console view.
21  */

22 public class PinConsoleAction extends Action implements IUpdate {
23     
24     private IConsoleView fView = null;
25
26     /**
27      * Constructs a 'pin console' action
28      */

29     public PinConsoleAction(IConsoleView view) {
30         super(ConsoleMessages.PinConsoleAction_0, IAction.AS_CHECK_BOX);
31         setToolTipText(ConsoleMessages.PinConsoleAction_1);
32         setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_PIN));
33         setDisabledImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_DLCL_PIN));
34         setHoverImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_LCL_PIN));
35         PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_PIN_CONSOLE_ACITON);
36         fView = view;
37         update();
38     }
39     
40     /* (non-Javadoc)
41      * @see org.eclipse.jface.action.IAction#run()
42      */

43     public void run() {
44         fView.setPinned(isChecked());
45     }
46         
47     /* (non-Javadoc)
48      * @see org.eclipse.ui.texteditor.IUpdate#update()
49      */

50     public void update() {
51         setEnabled(fView.getConsole() != null);
52         setChecked(fView.isPinned());
53     }
54 }
55
Popular Tags