KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > CVSHistoryFilterAction


1 /*******************************************************************************
2  * Copyright (c) 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.team.internal.ccvs.ui;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.action.IAction;
15 import org.eclipse.jface.viewers.ISelection;
16 import org.eclipse.jface.viewers.TreeViewer;
17 import org.eclipse.jface.window.Window;
18 import org.eclipse.ui.*;
19
20 public class CVSHistoryFilterAction extends Action {
21     private TreeViewer viewer;
22     private CVSHistoryFilter filter;
23     private CVSHistoryPage page;
24
25     public CVSHistoryFilterAction(CVSHistoryPage page) {
26         this.page = page;
27     }
28
29     /**
30      * @see IViewActionDelegate#init(IViewPart)
31      */

32     public void init(TreeViewer viewer) {
33         this.viewer = viewer;
34     }
35
36     /**
37      * @see IActionDelegate#run(IAction)
38      */

39     public void run() {
40         CVSHistoryFilterDialog historyDialog = new CVSHistoryFilterDialog(viewer.getControl().getShell());
41         if (filter != null) {
42             historyDialog.setFilter(filter);
43         }
44         if (historyDialog.open() == Window.CANCEL) {
45             return;
46         }
47         
48         filter = historyDialog.getFilter();
49         page.showFilter(filter);
50     }
51
52     /**
53      * @see IActionDelegate#selectionChanged(IAction, ISelection)
54      */

55     public void selectionChanged(IAction action, ISelection selection) {
56     }
57 }
58
Popular Tags