/**********************************************************************
- * Copyright (c) 2005, 2008, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2013 IBM Corporation, Ericsson
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- * $Id: OpenSDFindDialog.java,v 1.3 2008/01/24 02:28:52 apnan Exp $
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Bernd Hufmann - Updated for TMF
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ * Bernd Hufmann - Updated for TMF
**********************************************************************/
+
package org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers;
-import org.eclipse.jface.action.Action;
-import org.eclipse.linuxtools.tmf.ui.ITmfImageConstants;
-import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;
+import org.eclipse.linuxtools.internal.tmf.ui.ITmfImageConstants;
import org.eclipse.linuxtools.tmf.ui.views.uml2sd.SDView;
-import org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.widgets.SearchFilterDialog;
-import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.SDMessages;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.dialogs.SearchFilterDialog;
+import org.eclipse.linuxtools.tmf.ui.views.uml2sd.util.Messages;
import org.eclipse.swt.SWT;
/**
+ * Action class implementation for 'Finding' of messages/lifelines.
+ *
+ * @version 1.0
* @author sveyrier
- *
+ *
*/
-public class OpenSDFindDialog extends Action {
+public class OpenSDFindDialog extends BaseSDAction {
// ------------------------------------------------------------------------
- // Attributes
+ // Constants
// ------------------------------------------------------------------------
- public final static String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFind"; //$NON-NLS-1$
- public final static String ACTION_DEFINITION_ID = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
-
- protected SDView fView = null;
+ /**
+ * The action ID.
+ */
+ public static final String ID = "org.eclipse.linuxtools.tmf.ui.views.uml2sd.handlers.sdFind"; //$NON-NLS-1$
+
+ /**
+ * The action definition ID.
+ */
+ public static final String ACTION_DEFINITION_ID = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Constructors
// ------------------------------------------------------------------------
+ /**
+ * Default constructor
+ */
public OpenSDFindDialog() {
this(null);
}
-
- public OpenSDFindDialog(SDView theView) {
- super(SDMessages._41);
- setImageDescriptor(TmfUiPlugin.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
+
+ /**
+ * Constructor
+ *
+ * @param view The view reference
+ */
+ public OpenSDFindDialog(SDView view) {
+ super(view);
+ setText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
+ setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SEARCH_SEQ));
setId(ID);
setActionDefinitionId(ACTION_DEFINITION_ID);
- setToolTipText(SDMessages._41);
- fView = theView;
+ setToolTipText(Messages.SequenceDiagram_Find + "..."); //$NON-NLS-1$
}
// ------------------------------------------------------------------------
- // Operations
+ // Methods
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
+
@Override
public void run() {
- if (fView == null) {
+ if (getView() == null) {
return;
}
-
+
// Disable action while search is ongoing
this.setEnabled(false);
-
+
try {
- if ((fView.getExtendedFindProvider() != null) && (fView.getExtendedFindProvider().getFindAction() != null)) {
- fView.getExtendedFindProvider().getFindAction().run();
- } else if (fView.getSDFindProvider() != null) {
- SearchFilterDialog dialog = new SearchFilterDialog(fView, fView.getSDFindProvider(), false, SWT.NORMAL);
+ if ((getView().getExtendedFindProvider() != null) && (getView().getExtendedFindProvider().getFindAction() != null)) {
+ getView().getExtendedFindProvider().getFindAction().run();
+ } else if (getView().getSDFindProvider() != null) {
+ SearchFilterDialog dialog = new SearchFilterDialog(getView(), getView().getSDFindProvider(), false, SWT.NORMAL);
dialog.open();
}
- }
- finally {
+ } finally {
// Enable action after finishing the search
this.setEnabled(true);
}
}
-
- /**
- * Sets the active SD view.
- * @param view The SD view.
- */
- public void setView(SDView view) {
- fView = view;
- }
}