1 /**********************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Bernd Hufmann - Initial API and implementation
11 * Matthew Khouzam - Implementation of File->Open
12 **********************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.tracing
.rcp
.ui
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
16 import org
.eclipse
.core
.runtime
.Platform
;
17 import org
.eclipse
.core
.runtime
.Status
;
18 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
19 import org
.eclipse
.linuxtools
.internal
.tracing
.rcp
.ui
.cli
.TracingRCPCliException
;
20 import org
.eclipse
.linuxtools
.internal
.tracing
.rcp
.ui
.cli
.CliParser
;
21 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
22 import org
.osgi
.framework
.BundleContext
;
25 * The activator class controls the plug-in life cycle.
27 * @author Bernd Hufmann
29 public class TracingRcpPlugin
extends AbstractUIPlugin
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
37 public static final String PLUGIN_ID
= "org.eclipse.linuxtools.tracing.rcp.ui"; //$NON-NLS-1$
40 * The default workspace name
42 public static final String WORKSPACE_NAME
= ".traceviewer"; //$NON-NLS-1$
44 // ------------------------------------------------------------------------
46 // ------------------------------------------------------------------------
48 // The shared instance
49 private static TracingRcpPlugin fPlugin
;
50 private static CliParser fCli
;
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
56 * The default constructor
58 public TracingRcpPlugin() {
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
65 * Returns the shared instance
67 * @return the shared instance
69 public static TracingRcpPlugin
getDefault() {
74 * Gets the tracing workspace root directory. By default it uses the user's
75 * home directory. This value can be overwritten by using the global
76 * TRACING_RCP_ROOT environment variable.
78 * @return the tracing workspace root directory
80 public static String
getWorkspaceRoot() {
81 /* Look for the environment variable in the global environment variables */
82 String workspaceRoot
= System
.getenv().get("TRACING_RCP_ROOT"); //$NON-NLS-1$
83 if (workspaceRoot
== null) {
84 /* Use the user's home directory */
85 workspaceRoot
= System
.getProperty("user.home"); //$NON-NLS-1$
90 // ------------------------------------------------------------------------
92 // ------------------------------------------------------------------------
94 public void start(BundleContext context
) throws Exception
{
97 String args
[] = Platform
.getCommandLineArgs();
100 fCli
= new CliParser(args
);
101 } catch (TracingRCPCliException e
) {
102 logError(e
.getMessage());
107 public void stop(BundleContext context
) throws Exception
{
113 * Gets the command line parser
115 * @return the command line parser
117 public CliParser
getCli() {
122 * Returns an image descriptor for the image file at the given plug-in
127 * @return the image descriptor
129 public static ImageDescriptor
getImageDescriptor(String path
) {
130 return imageDescriptorFromPlugin(PLUGIN_ID
, path
);
137 * the error message to log
139 public void logError(String message
) {
140 getDefault().getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
));
147 * the error message to log
149 * the exception to log
151 public void logError(String message
, Exception e
) {
152 getDefault().getLog().log(
153 new Status(IStatus
.ERROR
, PLUGIN_ID
, message
, e
));
160 * the warning message to log
162 public void logWarning(String message
) {
163 getDefault().getLog().log(
164 new Status(IStatus
.WARNING
, PLUGIN_ID
, message
));
This page took 0.035929 seconds and 5 git commands to generate.