analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.ui / src / org / eclipse / tracecompass / tmf / ui / views / uml2sd / handlers / OpenSDFindDialog.java
1 /**********************************************************************
2 * Copyright (c) 2005, 2014 IBM Corporation, Ericsson
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 - Initial API and implementation
10 * Bernd Hufmann - Updated for TMF
11 **********************************************************************/
12
13 package org.eclipse.tracecompass.tmf.ui.views.uml2sd.handlers;
14
15 import org.eclipse.swt.SWT;
16 import org.eclipse.tracecompass.internal.tmf.ui.Activator;
17 import org.eclipse.tracecompass.internal.tmf.ui.ITmfImageConstants;
18 import org.eclipse.tracecompass.tmf.ui.views.uml2sd.SDView;
19 import org.eclipse.tracecompass.tmf.ui.views.uml2sd.dialogs.SearchFilterDialog;
20 import org.eclipse.tracecompass.tmf.ui.views.uml2sd.util.Messages;
21
22 /**
23 * Action class implementation for 'Finding' of messages/lifelines.
24 *
25 * @version 1.0
26 * @author sveyrier
27 *
28 */
29 public class OpenSDFindDialog extends BaseSDAction {
30
31 // ------------------------------------------------------------------------
32 // Constants
33 // ------------------------------------------------------------------------
34 /**
35 * The action ID.
36 */
37 public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFind"; //$NON-NLS-1$
38
39 /**
40 * The action definition ID.
41 */
42 public static final String ACTION_DEFINITION_ID = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
43
44 // ------------------------------------------------------------------------
45 // Constructors
46 // ------------------------------------------------------------------------
47 /**
48 * Default constructor
49 */
50 public OpenSDFindDialog() {
51 this(null);
52 }
53
54 /**
55 * Constructor
56 *
57 * @param view The view reference
58 */
59 public OpenSDFindDialog(SDView view) {
60 super(view);
61 setText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
62 setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
63 setId(ID);
64 setActionDefinitionId(ACTION_DEFINITION_ID);
65 setToolTipText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
66 }
67
68 // ------------------------------------------------------------------------
69 // Methods
70 // ------------------------------------------------------------------------
71
72 @Override
73 public void run() {
74 if (getView() == null) {
75 return;
76 }
77
78 // Disable action while search is ongoing
79 this.setEnabled(false);
80
81 try {
82 if ((getView().getExtendedFindProvider() != null) && (getView().getExtendedFindProvider().getFindAction() != null)) {
83 getView().getExtendedFindProvider().getFindAction().run();
84 } else if (getView().getSDFindProvider() != null) {
85 SearchFilterDialog dialog = new SearchFilterDialog(getView(), getView().getSDFindProvider(), false, SWT.NORMAL);
86 dialog.open();
87 }
88 } finally {
89 // Enable action after finishing the search
90 this.setEnabled(true);
91 }
92 }
93 }
This page took 0.039191 seconds and 5 git commands to generate.