]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-before/ui/org/eclipse/jdt/internal/ui/callhierarchy/ShowSearchInDialogAction.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / ui / org / eclipse / jdt / internal / ui / callhierarchy / ShowSearchInDialogAction.java
1 /*******************************************************************************
2  * Copyright (c) 2010, 2011 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.ui.callhierarchy;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.jface.action.Action;
16 import org.eclipse.jface.window.Window;
17
18 /**
19  * Action class to create and open the search in dialog.
20  * 
21  * @since 3.7
22  */
23 public class ShowSearchInDialogAction extends Action {
24         private CallHierarchyViewPart fPart;
25
26         private SearchInDialog fSearchInDialog;
27
28         /**
29          * Action to show the <code>SearchInDialog</code>.
30          * 
31          * @param part the call hierarchy view part
32          * @param viewer the call hierarchy viewer      
33          */
34         public ShowSearchInDialogAction(CallHierarchyViewPart part, CallHierarchyViewer viewer) {
35                 Assert.isNotNull(part);
36                 Assert.isNotNull(viewer);
37                 fPart= part;
38                 fSearchInDialog= new SearchInDialog(fPart.getViewSite().getShell());
39                 setText(CallHierarchyMessages.ShowSearchInDialogAction_text);
40         }
41
42         /**
43          * Returns the <code>SearchInDialog</code>.
44          * 
45          * @return the <code>searchInDialog</code>
46          */
47         public SearchInDialog getSearchInDialog() {
48                 return fSearchInDialog;
49         }
50
51         /* (non-Javadoc)
52          * @see org.eclipse.jface.action.Action#run()
53          */
54         @Override
55         public void run() {
56                 SearchInDialog dialog= getSearchInDialog();
57                 if (dialog.open() == Window.OK && dialog.isIncludeMaskChanged()) {
58                         fPart.setInputElements(fPart.getInputElements());
59                 }
60         }
61 }