1 /*******************************************************************************
2 * Copyright (c) 2009, 2010 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 * Francois Chouinard - Initial API and implementation
11 * Bernd Hufmann - Updated for LTTng trace control
13 *******************************************************************************/
15 package org
.eclipse
.linuxtools
.lttng
.ui
;
17 import java
.util
.concurrent
.ExecutionException
;
18 import java
.util
.concurrent
.TimeoutException
;
20 import org
.eclipse
.core
.runtime
.IAdapterManager
;
21 import org
.eclipse
.core
.runtime
.Platform
;
22 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.tracecontrol
.model
.ProviderResource
;
23 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.tracecontrol
.model
.TargetResource
;
24 import org
.eclipse
.linuxtools
.internal
.lttng
.core
.tracecontrol
.model
.TraceResource
;
25 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.TraceDebug
;
26 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.tracecontrol
.Messages
;
27 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.tracecontrol
.model
.TraceAdapterFactory
;
28 import org
.eclipse
.rse
.services
.clientserver
.messages
.SimpleSystemMessage
;
29 import org
.eclipse
.rse
.services
.clientserver
.messages
.SystemMessage
;
30 import org
.eclipse
.rse
.ui
.SystemBasePlugin
;
31 import org
.osgi
.framework
.BundleContext
;
34 * The activator class controls the plug-in life cycle
36 public class Activator
extends SystemBasePlugin
{
39 public static final String PLUGIN_ID
= "org.eclipse.linuxtools.lttng.ui"; //$NON-NLS-1$
42 public static final String ICON_ID_PROVIDER
= "ICON_ID_PROVIDER"; //$NON-NLS-1$
43 public static final String ICON_ID_TARGET
= "ICON_ID_TARGET"; //$NON-NLS-1$
44 public static final String ICON_ID_TRACE
= "ICON_ID_TRACE"; //$NON-NLS-1$
45 public static final String ICON_ID_NEW_TRACE
= "ICON_ID_NEW_TRACE"; //$NON-NLS-1$
46 public static final String ICON_ID_CONFIG_MARKERS
= "ICON_ID_CONFIG_MARKERS"; //$NON-NLS-1$
47 public static final String ICON_ID_CONFIG_TRACE
= "ICON_ID_CONFIG_TRACE"; //$NON-NLS-1$
48 public static final String ICON_ID_CHECKED
= "ICON_ID_CHECKED"; //$NON-NLS-1$
49 public static final String ICON_ID_UNCHECKED
= "ICON_ID_UNCHECKED"; //$NON-NLS-1$
50 public static final String ICON_ID_IMPORT_TRACE
= "ICON_ID_IMPORT_TRACE"; //$NON-NLS-1$
51 public static final String ICON_ID_EDIT
= "ICON_ID_EDIT"; //$NON-NLS-1$
53 // The shared instance
54 private static Activator plugin
;
64 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
67 public void start(BundleContext context
) throws Exception
{
71 // Trace control initialization
72 IAdapterManager manager
= Platform
.getAdapterManager();
73 TraceAdapterFactory factory
= new TraceAdapterFactory();
74 manager
.registerAdapters(factory
, ProviderResource
.class);
75 manager
.registerAdapters(factory
, TargetResource
.class);
76 manager
.registerAdapters(factory
, TraceResource
.class);
78 // Assign shared instance
84 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
87 public void stop(BundleContext context
) throws Exception
{
94 * Returns the shared instance
96 * @return the shared instance
98 public static Activator
getDefault() {
103 * Create a System Message for given throwable
105 * @param x - The throwable the message is for
108 public SystemMessage
getMessage(Throwable x
) {
109 String msg
= x
.getMessage();
111 msg
= ""; //$NON-NLS-1$
113 if ((x
instanceof ExecutionException
) && (((ExecutionException
)x
).getCause() != null)) {
114 msg
+= " (" + ((ExecutionException
)x
).getCause().getMessage() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
116 if (x
instanceof TimeoutException
) {
117 msg
+= " (" + Messages
.Ltt_TimeoutMsg
+ ")"; //$NON-NLS-1$ //$NON-NLS-2$
119 return new SimpleSystemMessage(PLUGIN_ID
, SystemMessage
.ERROR
, msg
, x
);
124 * @see org.eclipse.rse.ui.SystemBasePlugin#initializeImageRegistry()
127 protected void initializeImageRegistry() {
128 String path
= getIconPath();
129 putImageInRegistry(ICON_ID_PROVIDER
, path
+ "obj16/providers.gif"); //$NON-NLS-1$
130 putImageInRegistry(ICON_ID_TARGET
, path
+ "obj16/targets.gif"); //$NON-NLS-1$
131 putImageInRegistry(ICON_ID_TRACE
, path
+ "obj16/trace.gif"); //$NON-NLS-1$
132 putImageInRegistry(ICON_ID_NEW_TRACE
, path
+ "elcl16/new_trace.gif"); //$NON-NLS-1$
133 putImageInRegistry(ICON_ID_CONFIG_MARKERS
, path
+ "elcl16/configure_markers.gif"); //$NON-NLS-1$
134 putImageInRegistry(ICON_ID_CONFIG_TRACE
, path
+ "elcl16/configure_trace.gif"); //$NON-NLS-1$
135 putImageInRegistry(ICON_ID_CHECKED
, path
+ "elcl16/checked.gif"); //$NON-NLS-1$
136 putImageInRegistry(ICON_ID_UNCHECKED
, path
+ "elcl16/unchecked.gif"); //$NON-NLS-1$
137 putImageInRegistry(ICON_ID_IMPORT_TRACE
, path
+ "elcl16/import_trace.gif"); //$NON-NLS-1$
138 putImageInRegistry(ICON_ID_EDIT
, path
+ "elcl16/edit.gif"); //$NON-NLS-1$