|
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 clear view 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.swt.custom.BusyIndicator; |
|
25 import org.eclipse.ui.PlatformUI; |
|
26 |
|
27 import com.nokia.traceviewer.TraceViewerHelpContextIDs; |
|
28 import com.nokia.traceviewer.TraceViewerPlugin; |
|
29 import com.nokia.traceviewer.engine.TraceViewerGlobals; |
|
30 |
|
31 /** |
|
32 * Handler for clear view command |
|
33 * |
|
34 */ |
|
35 final class ClearViewAction 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/clear.gif"); //$NON-NLS-1$ |
|
46 image = ImageDescriptor.createFromURL(url); |
|
47 } |
|
48 |
|
49 /** |
|
50 * Constructor |
|
51 */ |
|
52 ClearViewAction() { |
|
53 setText(Messages.getString("ClearViewAction.Title")); //$NON-NLS-1$ |
|
54 setToolTipText(Messages.getString("ClearViewAction.Tooltip")); //$NON-NLS-1$ |
|
55 setImageDescriptor(image); |
|
56 |
|
57 // Set help |
|
58 PlatformUI.getWorkbench().getHelpSystem().setHelp(this, |
|
59 TraceViewerHelpContextIDs.ACTIONS); |
|
60 } |
|
61 |
|
62 /* |
|
63 * (non-Javadoc) |
|
64 * |
|
65 * @see com.nokia.traceviewer.action.TraceViewerAction#doRun() |
|
66 */ |
|
67 @Override |
|
68 protected void doRun() { |
|
69 TraceViewerGlobals.postUiEvent("ClearViewButton", "1"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
70 BusyIndicator.showWhile(PlatformUI.getWorkbench().getDisplay(), |
|
71 new ClearViewRunnable()); |
|
72 TraceViewerGlobals.postUiEvent("ClearViewButton", "0"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
73 } |
|
74 } |