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