|
1 /* |
|
2 * Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Handler for open variable tracing history command |
|
17 * |
|
18 */ |
|
19 package com.nokia.traceviewer.action; |
|
20 |
|
21 import org.eclipse.jface.resource.ImageDescriptor; |
|
22 import org.eclipse.ui.ISharedImages; |
|
23 import org.eclipse.ui.PlatformUI; |
|
24 |
|
25 import com.nokia.traceviewer.TraceViewerHelpContextIDs; |
|
26 import com.nokia.traceviewer.dialog.VariableTracingHistoryDialog; |
|
27 import com.nokia.traceviewer.engine.TraceViewerGlobals; |
|
28 import com.nokia.traceviewer.engine.TraceViewerDialogInterface.Dialog; |
|
29 |
|
30 /** |
|
31 * Handler for open variable tracing history command |
|
32 * |
|
33 */ |
|
34 final class OpenVariableTracingHistoryAction extends TraceViewerAction { |
|
35 |
|
36 /** |
|
37 * Image for this Action |
|
38 */ |
|
39 private static ImageDescriptor image; |
|
40 |
|
41 /** |
|
42 * Variable Tracing History dialog |
|
43 */ |
|
44 private VariableTracingHistoryDialog dialog; |
|
45 |
|
46 static { |
|
47 image = PlatformUI.getWorkbench().getSharedImages().getImageDescriptor( |
|
48 ISharedImages.IMG_OBJS_INFO_TSK); |
|
49 } |
|
50 |
|
51 /** |
|
52 * Constructor |
|
53 */ |
|
54 OpenVariableTracingHistoryAction() { |
|
55 setText(Messages.getString("OpenVariableTracingHistoryAction.Title")); //$NON-NLS-1$ |
|
56 setToolTipText(Messages |
|
57 .getString("OpenVariableTracingHistoryAction.Tooltip")); //$NON-NLS-1$ |
|
58 setImageDescriptor(image); |
|
59 |
|
60 // Set help |
|
61 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, |
|
62 TraceViewerHelpContextIDs.VARIABLE_TRACING_HISTORY); |
|
63 } |
|
64 |
|
65 /* |
|
66 * (non-Javadoc) |
|
67 * |
|
68 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun() |
|
69 */ |
|
70 @Override |
|
71 protected void doRun() { |
|
72 // Create the dialog |
|
73 if (dialog == null) { |
|
74 dialog = (VariableTracingHistoryDialog) TraceViewerGlobals |
|
75 .getTraceViewer().getDialogs().createDialog( |
|
76 Dialog.VARIBLETRACINGHISTORY); |
|
77 if (dialog != null) { |
|
78 dialog.openDialog(); |
|
79 } |
|
80 // Open the dialog |
|
81 } else if (!dialog.isOpen()) { |
|
82 dialog.openDialog(); |
|
83 // Set focus to the dialog |
|
84 } else { |
|
85 dialog.setFocus(); |
|
86 } |
|
87 } |
|
88 } |