Java Doc and API clean up of TMF UML Sequence diagram framework
[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 IBM Corporation and others.
3 * Copyright (c) 2011, 2012 Ericsson.
4 *
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Eclipse Public License v1.0
7 * which accompanies this distribution, and is available at
8 * http://www.eclipse.org/legal/epl-v10.html
9 *
10 * Contributors:
11 * IBM - Initial API and implementation
12 * Bernd Hufmann - Updated for TMF
13 **********************************************************************/
14 package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
15
16 import org.eclipse.jface.action.Action;
17 import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
18 import org.eclipse.linuxtools.internal.tmf.ui.TmfUiPlugin;
19 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
20 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.SearchFilterDialog;
21 import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
22 import org.eclipse.swt.SWT;
23
24 /**
25 * Action class implementation for 'Finding' of messages/lifelines.
26 *
27 * @version 1.0
28 * @author sveyrier
29 *
30 */
31 public class OpenSDFindDialog extends Action {
32
33 // ------------------------------------------------------------------------
34 // Constants
35 // ------------------------------------------------------------------------
36 /**
37 * The action ID.
38 */
39 public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFind"; //$NON-NLS-1$
40 /**
41 * The action definition ID.
42 */
43 public final static String ACTION_DEFINITION_ID = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
44
45 // ------------------------------------------------------------------------
46 // Attributes
47 // ------------------------------------------------------------------------
48 /**
49 * The sequence diagram view reference
50 */
51 protected SDView fView;
52
53 // ------------------------------------------------------------------------
54 // Constructors
55 // ------------------------------------------------------------------------
56 /**
57 * Default constructor
58 */
59 public OpenSDFindDialog() {
60 this(null);
61 }
62
63 /**
64 * Constructor
65 *
66 * @param theView The view reference
67 */
68 public OpenSDFindDialog(SDView theView) {
69 super(SDMessages._41);
70 setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
71 setId(ID);
72 setActionDefinitionId(ACTION_DEFINITION_ID);
73 setToolTipText(SDMessages._41);
74 fView = theView;
75 }
76
77 // ------------------------------------------------------------------------
78 // Methods
79 // ------------------------------------------------------------------------
80 /*
81 * (non-Javadoc)
82 * @see org.eclipse.jface.action.Action#run()
83 */
84 @Override
85 public void run() {
86 if (fView == null) {
87 return;
88 }
89
90 // Disable action while search is ongoing
91 this.setEnabled(false);
92
93 try {
94 if ((fView.getExtendedFindProvider() != null) && (fView.getExtendedFindProvider().getFindAction() != null)) {
95 fView.getExtendedFindProvider().getFindAction().run();
96 } else if (fView.getSDFindProvider() != null) {
97 SearchFilterDialog dialog = new SearchFilterDialog(fView, fView.getSDFindProvider(), false, SWT.NORMAL);
98 dialog.open();
99 }
100 } finally {
101 // Enable action after finishing the search
102 this.setEnabled(true);
103 }
104 }
105
106 /**
107 * Sets the active SD view.
108 *
109 * @param view The SD view.
110 */
111 public void setView(SDView view) {
112 fView = view;
113 }
114 }
This page took 0.033594 seconds and 5 git commands to generate.