KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > views > bookmarkexplorer > SelectAllAction


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
12 package org.eclipse.ui.views.bookmarkexplorer;
13
14 import org.eclipse.jface.viewers.Viewer;
15 import org.eclipse.swt.widgets.Control;
16 import org.eclipse.swt.widgets.Table;
17 import org.eclipse.ui.PlatformUI;
18 import org.eclipse.ui.internal.views.bookmarkexplorer.BookmarkMessages;
19
20 /**
21  * Action to select all bookmarks.
22  */

23 class SelectAllAction extends BookmarkAction {
24
25     /**
26      * Create a new instance of this class.
27      *
28      * @param view the view
29      */

30     public SelectAllAction(BookmarkNavigator view) {
31         super(view, BookmarkMessages.SelectAll_text);
32         setToolTipText(BookmarkMessages.SelectAll_toolTip);
33         PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
34                 IBookmarkHelpContextIds.SELECT_ALL_BOOKMARK_ACTION);
35         setEnabled(true);
36     }
37
38     public void run() {
39         Viewer viewer = getView().getViewer();
40         Control control = viewer.getControl();
41         if (control instanceof Table) {
42             ((Table) control).selectAll();
43             viewer.setSelection(viewer.getSelection(), false);
44         }
45     }
46 }
47
Popular Tags