|
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 edit variable tracing rule command |
|
17 * |
|
18 */ |
|
19 package com.nokia.traceviewer.action; |
|
20 |
|
21 import java.net.URL; |
|
22 |
|
23 import org.eclipse.jface.resource.ImageDescriptor; |
|
24 import org.eclipse.ui.PlatformUI; |
|
25 |
|
26 import com.nokia.traceviewer.TraceViewerHelpContextIDs; |
|
27 import com.nokia.traceviewer.TraceViewerPlugin; |
|
28 import com.nokia.traceviewer.dialog.VariableTracingDialog; |
|
29 import com.nokia.traceviewer.engine.TraceViewerGlobals; |
|
30 |
|
31 /** |
|
32 * Handler for edit variable tracing rule command |
|
33 */ |
|
34 public final class EditVariableTracingRuleAction extends TraceViewerAction { |
|
35 |
|
36 /** |
|
37 * Image for this Action |
|
38 */ |
|
39 private static ImageDescriptor image; |
|
40 |
|
41 /** |
|
42 * Item index in TracePropertyView to be edited |
|
43 */ |
|
44 private final int itemIndex; |
|
45 |
|
46 static { |
|
47 URL url = null; |
|
48 url = TraceViewerPlugin.getDefault().getBundle().getEntry( |
|
49 "/icons/tracevariable.gif"); //$NON-NLS-1$ |
|
50 image = ImageDescriptor.createFromURL(url); |
|
51 } |
|
52 |
|
53 /** |
|
54 * Constructor |
|
55 * |
|
56 * @param itemIndex |
|
57 * item index to be edited |
|
58 */ |
|
59 public EditVariableTracingRuleAction(int itemIndex) { |
|
60 setText(Messages.getString("EditVariableTracingRuleAction.Title")); //$NON-NLS-1$ |
|
61 setToolTipText(Messages |
|
62 .getString("EditVariableTracingRuleAction.Tooltip")); //$NON-NLS-1$ |
|
63 setImageDescriptor(image); |
|
64 |
|
65 this.itemIndex = itemIndex; |
|
66 |
|
67 // Set help |
|
68 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, |
|
69 TraceViewerHelpContextIDs.ACTIONS); |
|
70 } |
|
71 |
|
72 /* |
|
73 * (non-Javadoc) |
|
74 * |
|
75 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun() |
|
76 */ |
|
77 @Override |
|
78 protected void doRun() { |
|
79 VariableTracingDialog dialog = TraceViewerGlobals.getTraceViewer() |
|
80 .getDataProcessorAccess().getVariableTracingProcessor() |
|
81 .getVariableTracingDialog(); |
|
82 if (dialog != null) { |
|
83 dialog.editOrAddItem(itemIndex); |
|
84 } |
|
85 } |
|
86 } |