trace/traceviewer/com.nokia.traceviewer/src/com/nokia/traceviewer/action/AddVariableTracingRuleAction.java
changeset 11 5b9d4d8641ce
equal deleted inserted replaced
10:ed1c9f64298a 11:5b9d4d8641ce
       
     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 add new 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 add new variable tracing rule command
       
    33  * 
       
    34  */
       
    35 public final class AddVariableTracingRuleAction extends TraceViewerAction {
       
    36 
       
    37 	/**
       
    38 	 * Image for this Action
       
    39 	 */
       
    40 	private static ImageDescriptor image;
       
    41 
       
    42 	static {
       
    43 		URL url = null;
       
    44 		url = TraceViewerPlugin.getDefault().getBundle().getEntry(
       
    45 				"/icons/tracevariable.gif"); //$NON-NLS-1$
       
    46 		image = ImageDescriptor.createFromURL(url);
       
    47 	}
       
    48 
       
    49 	/**
       
    50 	 * Constructor
       
    51 	 */
       
    52 	public AddVariableTracingRuleAction() {
       
    53 		setText(Messages.getString("AddVariableTracingRuleAction.Title")); //$NON-NLS-1$
       
    54 		setToolTipText(Messages
       
    55 				.getString("AddVariableTracingRuleAction.Tooltip")); //$NON-NLS-1$
       
    56 		setImageDescriptor(image);
       
    57 
       
    58 		// Set help
       
    59 		PlatformUI.getWorkbench().getHelpSystem().setHelp(this,
       
    60 				TraceViewerHelpContextIDs.ACTIONS);
       
    61 	}
       
    62 
       
    63 	/*
       
    64 	 * (non-Javadoc)
       
    65 	 * 
       
    66 	 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun()
       
    67 	 */
       
    68 	@Override
       
    69 	protected void doRun() {
       
    70 		VariableTracingDialog dialog = TraceViewerGlobals.getTraceViewer()
       
    71 				.getDataProcessorAccess().getVariableTracingProcessor()
       
    72 				.getVariableTracingDialog();
       
    73 		if (dialog != null) {
       
    74 			dialog.editOrAddItem(-1);
       
    75 		}
       
    76 	}
       
    77 }