|
1 /* |
|
2 * Copyright (c) 2008 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 * Opens Trace Builder main view |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracebuilder.action; |
|
20 |
|
21 import org.eclipse.jface.action.IAction; |
|
22 import org.eclipse.jface.viewers.ISelection; |
|
23 import org.eclipse.ui.IWorkbenchWindow; |
|
24 import org.eclipse.ui.IWorkbenchWindowActionDelegate; |
|
25 import org.eclipse.ui.PartInitException; |
|
26 import org.eclipse.ui.PlatformUI; |
|
27 |
|
28 /** |
|
29 * Opens Trace Builder main view |
|
30 * |
|
31 */ |
|
32 public class ToolbarShortcutAction implements IWorkbenchWindowActionDelegate { |
|
33 |
|
34 /** |
|
35 * Trace Builder main view ID |
|
36 */ |
|
37 private final String TB_VIEW_ID = "com.nokia.tracebuilder.view.TraceView"; //$NON-NLS-1$ |
|
38 |
|
39 /* |
|
40 * (non-Javadoc) |
|
41 * |
|
42 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() |
|
43 */ |
|
44 public void dispose() { |
|
45 } |
|
46 |
|
47 /* |
|
48 * (non-Javadoc) |
|
49 * |
|
50 * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) |
|
51 */ |
|
52 public void init(IWorkbenchWindow window) { |
|
53 } |
|
54 |
|
55 /* |
|
56 * (non-Javadoc) |
|
57 * |
|
58 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) |
|
59 */ |
|
60 public void run(IAction action) { |
|
61 try { |
|
62 PlatformUI.getWorkbench().getActiveWorkbenchWindow() |
|
63 .getActivePage().showView(TB_VIEW_ID); |
|
64 } catch (PartInitException e) { |
|
65 } |
|
66 } |
|
67 |
|
68 /* |
|
69 * (non-Javadoc) |
|
70 * |
|
71 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, |
|
72 * org.eclipse.jface.viewers.ISelection) |
|
73 */ |
|
74 public void selectionChanged(IAction action, ISelection selection) { |
|
75 } |
|
76 |
|
77 } |