Contribution for Bug352466: [TMF] Implement UML2 Sequence Diagram
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / tmf / ui / views / uml2sd / handlers / OpenSDFindDialog.java
1 /**********************************************************************
2 * Copyright (c) 2005, 2008, 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 * $Id: OpenSDFindDialog.java,v 1.3 2008/01/24 02:28:52 apnan Exp $
8 *
9 * Contributors:
10 * IBM - Initial API and implementation
11 * Bernd Hufmann - Updated for TMF
12 **********************************************************************/
13 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
14
15 import org.eclipse.jface.action.Action;
16 import org.eclipse.linuxtools.tmf.ui.ITmfImageConstants;
17 import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
18 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
19 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.widgets.SearchFilterDialog;
20 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
21 import org.eclipse.swt.SWT;
22
23 /**
24 * @author sveyrier
25 *
26 */
27 public class OpenSDFindDialog extends Action {
28
29 // ------------------------------------------------------------------------
30 // Attributes
31 // ------------------------------------------------------------------------
32 public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFind"; //$NON-NLS-1$
33 public final static String ACTION_DEFINITION_ID = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
34
35 protected SDView fView = null;
36
37 // ------------------------------------------------------------------------
38 // Constructors
39 // ------------------------------------------------------------------------
40 public OpenSDFindDialog() {
41 this(null);
42 }
43
44 public OpenSDFindDialog(SDView theView) {
45 super(SDMessages._41);
46 setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
47 setId(ID);
48 setActionDefinitionId(ACTION_DEFINITION_ID);
49 setToolTipText(SDMessages._41);
50 fView = theView;
51 }
52
53 // ------------------------------------------------------------------------
54 // Operations
55 // ------------------------------------------------------------------------
56 /*
57 * (non-Javadoc)
58 * @see org.eclipse.jface.action.Action#run()
59 */
60 @Override
61 public void run() {
62 if (fView == null) {
63 return;
64 }
65
66 // Disable action while search is ongoing
67 this.setEnabled(false);
68
69 try {
70 if ((fView.getExtendedFindProvider() != null) && (fView.getExtendedFindProvider().getFindAction() != null)) {
71 fView.getExtendedFindProvider().getFindAction().run();
72 } else if (fView.getSDFindProvider() != null) {
73 SearchFilterDialog dialog = new SearchFilterDialog(fView, fView.getSDFindProvider(), false, SWT.NORMAL);
74 dialog.open();
75 }
76 }
77 finally {
78 // Enable action after finishing the search
79 this.setEnabled(true);
80 }
81 }
82
83 /**
84 * Sets the active SD view.
85 * @param view The SD view.
86 */
87 public void setView(SDView view) {
88 fView = view;
89 }
90 }
This page took 0.031673 seconds and 5 git commands to generate.