KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > search2 > internal > ui > PinSearchViewAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.search2.internal.ui;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.action.IAction;
15
16 import org.eclipse.ui.texteditor.IUpdate;
17
18 import org.eclipse.search.internal.ui.SearchPluginImages;
19
20 /**
21  * Pins the currently visible search view
22  */

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

30     public PinSearchViewAction(SearchView view) {
31         super(SearchMessages.PinSearchViewAction_label, IAction.AS_CHECK_BOX);
32         setToolTipText(SearchMessages.PinSearchViewAction_tooltip);
33         SearchPluginImages.setImageDescriptors(this, SearchPluginImages.T_LCL, SearchPluginImages.IMG_LCL_PIN_VIEW);
34         fView = view;
35         update();
36     }
37     
38     /* (non-Javadoc)
39      * @see org.eclipse.jface.action.IAction#run()
40      */

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

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