Commit | Line | Data |
---|---|---|
eb1bab5b | 1 | /********************************************************************** |
533d0bc3 | 2 | * Copyright (c) 2012, 2015 Ericsson |
cfdb727a | 3 | * |
eb1bab5b BH |
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 | |
cfdb727a AM |
8 | * |
9 | * Contributors: | |
eb1bab5b | 10 | * Bernd Hufmann - Initial API and implementation |
ba3a9bd2 | 11 | * Bernd Hufmann - Updated for support of LTTng Tools 2.1 |
b732adaa | 12 | * Markus Schorn - Bug 448058: Use org.eclipse.remote in favor of RSE |
533d0bc3 | 13 | * Bernd Hufmann - Update to org.eclipse.remote API 2.0 |
eb1bab5b | 14 | **********************************************************************/ |
9bc60be7 | 15 | package org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.impl; |
eb1bab5b | 16 | |
b732adaa | 17 | import static java.text.MessageFormat.format; |
d8a4fd60 | 18 | import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull; |
b732adaa | 19 | |
6503ae0f BH |
20 | import java.util.List; |
21 | ||
eb1bab5b BH |
22 | import org.eclipse.core.commands.ExecutionException; |
23 | import org.eclipse.core.runtime.IProgressMonitor; | |
24 | import org.eclipse.core.runtime.IStatus; | |
25 | import org.eclipse.core.runtime.Status; | |
b732adaa | 26 | import org.eclipse.core.runtime.jobs.IJobChangeEvent; |
eb1bab5b | 27 | import org.eclipse.core.runtime.jobs.Job; |
b732adaa | 28 | import org.eclipse.core.runtime.jobs.JobChangeAdapter; |
d8a4fd60 | 29 | import org.eclipse.jdt.annotation.NonNull; |
2f79cfbc | 30 | import org.eclipse.jdt.annotation.Nullable; |
973e19d6 | 31 | import org.eclipse.jface.dialogs.ErrorDialog; |
b732adaa | 32 | import org.eclipse.remote.core.IRemoteConnection; |
b732adaa | 33 | import org.eclipse.remote.core.IRemoteConnectionChangeListener; |
533d0bc3 | 34 | import org.eclipse.remote.core.RemoteConnectionChangeEvent; |
eb1bab5b | 35 | import org.eclipse.swt.graphics.Image; |
973e19d6 | 36 | import org.eclipse.swt.widgets.Display; |
9bc60be7 | 37 | import org.eclipse.tracecompass.internal.lttng2.control.core.model.TargetNodeState; |
f3023b37 | 38 | import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType; |
9bc60be7 AM |
39 | import org.eclipse.tracecompass.internal.lttng2.control.ui.Activator; |
40 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.messages.Messages; | |
41 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.model.ITraceControlComponent; | |
42 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.property.TargetNodePropertySource; | |
9bc60be7 AM |
43 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.ILttngControlService; |
44 | import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.LTTngControlServiceFactory; | |
ec619615 BH |
45 | import org.eclipse.tracecompass.tmf.remote.core.proxy.RemoteSystemProxy; |
46 | import org.eclipse.tracecompass.tmf.remote.core.shell.ICommandShell; | |
973e19d6 | 47 | import org.eclipse.ui.PlatformUI; |
eb1bab5b BH |
48 | import org.eclipse.ui.views.properties.IPropertySource; |
49 | ||
50 | /** | |
eb1bab5b BH |
51 | * <p> |
52 | * Implementation of the trace node component. | |
53 | * </p> | |
cfdb727a | 54 | * |
dbd4432d | 55 | * @author Bernd Hufmann |
eb1bab5b | 56 | */ |
b732adaa | 57 | public class TargetNodeComponent extends TraceControlComponent implements IRemoteConnectionChangeListener { |
eb1bab5b BH |
58 | |
59 | // ------------------------------------------------------------------------ | |
60 | // Constants | |
61 | // ------------------------------------------------------------------------ | |
11252342 | 62 | |
eb1bab5b BH |
63 | /** |
64 | * Path to icon file for this component (state connected). | |
65 | */ | |
66 | public static final String TARGET_NODE_CONNECTED_ICON_FILE = "icons/obj16/target_connected.gif"; //$NON-NLS-1$ | |
67 | /** | |
68 | * Path to icon file for this component (state disconnected). | |
69 | */ | |
70 | public static final String TARGET_NODE_DISCONNECTED_ICON_FILE = "icons/obj16/target_disconnected.gif"; //$NON-NLS-1$ | |
71 | ||
b732adaa MS |
72 | private static final ILttngControlService NULL_CONTROL_SERVICE = new NullControlService(); |
73 | ||
eb1bab5b BH |
74 | // ------------------------------------------------------------------------ |
75 | // Attributes | |
76 | // ------------------------------------------------------------------------ | |
11252342 | 77 | |
eb1bab5b BH |
78 | /** |
79 | * The node connection state. | |
80 | */ | |
81 | private TargetNodeState fState = TargetNodeState.DISCONNECTED; | |
82 | /** | |
83 | * The image to be displayed in state disconnected. | |
84 | */ | |
85 | private Image fDisconnectedImage = null; | |
eb1bab5b BH |
86 | /** |
87 | * The remote proxy implementation. | |
88 | */ | |
d8a4fd60 | 89 | private @NonNull RemoteSystemProxy fRemoteProxy; |
eb1bab5b BH |
90 | /** |
91 | * The control service for LTTng specific commands. | |
92 | */ | |
93 | private ILttngControlService fService = null; | |
94 | /** | |
95 | * The command shell for issuing commands. | |
96 | */ | |
97 | private ICommandShell fShell = null; | |
98 | ||
99 | // ------------------------------------------------------------------------ | |
100 | // Constructors | |
101 | // ------------------------------------------------------------------------ | |
11252342 | 102 | |
eb1bab5b | 103 | /** |
cfdb727a | 104 | * Constructor |
d8a4fd60 BH |
105 | * |
106 | * @param name | |
107 | * the name of the component | |
108 | * @param parent | |
109 | * the parent of the component | |
110 | * @param proxy | |
111 | * the remote proxy implementation | |
eb1bab5b | 112 | */ |
d8a4fd60 | 113 | public TargetNodeComponent(String name, ITraceControlComponent parent, @NonNull RemoteSystemProxy proxy) { |
eb1bab5b BH |
114 | super(name, parent); |
115 | setImage(TARGET_NODE_CONNECTED_ICON_FILE); | |
31a6a4e4 | 116 | fDisconnectedImage = Activator.getDefault().loadIcon(TARGET_NODE_DISCONNECTED_ICON_FILE); |
eb1bab5b | 117 | fRemoteProxy = proxy; |
33d432d5 | 118 | fRemoteProxy.getRemoteConnection().addConnectionChangeListener(this); |
d8a4fd60 | 119 | setToolTip(fRemoteProxy.getRemoteConnection().getName()); |
eb1bab5b BH |
120 | } |
121 | ||
122 | /** | |
cfdb727a | 123 | * Constructor (using default proxy) |
d8a4fd60 BH |
124 | * |
125 | * @param name | |
126 | * the name of the component | |
127 | * @param parent | |
128 | * the parent of the component | |
129 | * @param host | |
130 | * the host connection implementation | |
eb1bab5b | 131 | */ |
d8a4fd60 BH |
132 | public TargetNodeComponent(String name, ITraceControlComponent parent, @NonNull IRemoteConnection host) { |
133 | this(name, parent, new RemoteSystemProxy(host)); | |
eb1bab5b BH |
134 | } |
135 | ||
b732adaa MS |
136 | @Override |
137 | public void dispose() { | |
33d432d5 | 138 | fRemoteProxy.getRemoteConnection().removeConnectionChangeListener(this); |
b732adaa MS |
139 | fRemoteProxy.dispose(); |
140 | disposeControlService(); | |
141 | } | |
142 | ||
143 | private void disposeControlService() { | |
144 | fService = null; | |
145 | final ICommandShell shell = fShell; | |
146 | if (shell != null) { | |
13729cbc | 147 | shell.dispose(); |
b732adaa MS |
148 | fShell = null; |
149 | } | |
150 | } | |
151 | ||
eb1bab5b BH |
152 | // ------------------------------------------------------------------------ |
153 | // Accessors | |
154 | // ------------------------------------------------------------------------ | |
11252342 | 155 | |
eb1bab5b BH |
156 | @Override |
157 | public Image getImage() { | |
158 | if (fState == TargetNodeState.CONNECTED) { | |
159 | return super.getImage(); | |
160 | } | |
161 | return fDisconnectedImage; | |
162 | } | |
cfdb727a | 163 | |
eb1bab5b BH |
164 | @Override |
165 | public TargetNodeState getTargetNodeState() { | |
166 | return fState; | |
167 | } | |
cfdb727a | 168 | |
eb1bab5b BH |
169 | @Override |
170 | public void setTargetNodeState(TargetNodeState state) { | |
171 | fState = state; | |
4775bcbf | 172 | fireComponentChanged(TargetNodeComponent.this); |
eb1bab5b | 173 | } |
cfdb727a | 174 | |
eb1bab5b BH |
175 | @Override |
176 | public ILttngControlService getControlService() { | |
b732adaa | 177 | return fService == null ? NULL_CONTROL_SERVICE : fService; |
eb1bab5b BH |
178 | } |
179 | ||
eb1bab5b BH |
180 | @Override |
181 | public void setControlService(ILttngControlService service) { | |
cfdb727a | 182 | fService = service; |
eb1bab5b BH |
183 | } |
184 | ||
eb1bab5b | 185 | @Override |
2f79cfbc | 186 | public <T> @Nullable T getAdapter(Class<T> adapter) { |
eb1bab5b | 187 | if (adapter == IPropertySource.class) { |
e58fe1d5 | 188 | return adapter.cast(new TargetNodePropertySource(this)); |
eb1bab5b BH |
189 | } |
190 | return null; | |
cfdb727a AM |
191 | } |
192 | ||
bbb3538a BH |
193 | /** |
194 | * @return remote system proxy implementation | |
195 | */ | |
d8a4fd60 | 196 | public @NonNull RemoteSystemProxy getRemoteSystemProxy() { |
bbb3538a BH |
197 | return fRemoteProxy; |
198 | } | |
199 | ||
6503ae0f BH |
200 | /** |
201 | * @return all available sessions. | |
202 | */ | |
367e2932 | 203 | public @NonNull TraceSessionComponent[] getSessions() { |
6503ae0f BH |
204 | List<ITraceControlComponent> compenents = getChildren(TraceSessionGroup.class); |
205 | if (compenents.size() > 0) { | |
cfdb727a | 206 | TraceSessionGroup group = (TraceSessionGroup)compenents.get(0); |
6503ae0f | 207 | List<ITraceControlComponent> sessions = group.getChildren(TraceSessionComponent.class); |
367e2932 | 208 | return sessions.toArray(new @NonNull TraceSessionComponent[sessions.size()]); |
6503ae0f BH |
209 | } |
210 | return new TraceSessionComponent[0]; | |
211 | } | |
cfdb727a | 212 | |
cfe737e4 BH |
213 | /** |
214 | * @return node version | |
215 | */ | |
216 | public String getNodeVersion() { | |
217 | // Control service is null during connection to node | |
b732adaa | 218 | if (getControlService() != NULL_CONTROL_SERVICE) { |
0df4af5f | 219 | return getControlService().getVersionString(); |
cfe737e4 BH |
220 | } |
221 | return ""; //$NON-NLS-1$ | |
222 | } | |
223 | ||
d4514365 BH |
224 | /** |
225 | * Returns if node supports filtering of events | |
1bc37054 | 226 | * @param domain - the domain type ({@link TraceDomainType}) |
d4514365 BH |
227 | * @return <code>true</code> if node supports filtering else <code>false</code> |
228 | */ | |
1bc37054 BR |
229 | public boolean isEventFilteringSupported(TraceDomainType domain) { |
230 | if (domain.equals(TraceDomainType.KERNEL)) { | |
f0584d20 BH |
231 | return getControlService().isVersionSupported("2.7.0"); //$NON-NLS-1$ |
232 | } | |
d4514365 BH |
233 | return getControlService().isVersionSupported("2.1.0"); //$NON-NLS-1$ |
234 | } | |
235 | ||
f3b33d40 BH |
236 | /** |
237 | * Returns if node supports networks streaming or not | |
238 | * @return <code>true</code> if node supports filtering else <code>false</code> | |
ba3a9bd2 | 239 | * |
f3b33d40 BH |
240 | */ |
241 | public boolean isNetworkStreamingSupported() { | |
242 | return getControlService().isVersionSupported("2.1.0"); //$NON-NLS-1$ | |
243 | } | |
244 | ||
e799e5f3 | 245 | /** |
83051fc3 BH |
246 | * Returns if node supports configuring buffer type or not |
247 | * @return <code>true</code> if node supports buffer type configuration else <code>false</code> | |
e799e5f3 | 248 | */ |
83051fc3 | 249 | public boolean isBufferTypeConfigSupported() { |
e799e5f3 SD |
250 | return getControlService().isVersionSupported("2.2.0"); //$NON-NLS-1$ |
251 | } | |
252 | ||
253 | /** | |
254 | * Returns if node supports trace file rotation or not | |
255 | * @return <code>true</code> if node supports trace file rotation else <code>false</code> | |
256 | */ | |
257 | public boolean isTraceFileRotationSupported() { | |
258 | return getControlService().isVersionSupported("2.2.0"); //$NON-NLS-1$ | |
259 | } | |
260 | ||
261 | /** | |
262 | * Returns if node supports periodical flush for metadata or not | |
263 | * @return <code>true</code> if node supports periodical flush for metadata else <code>false</code> | |
264 | */ | |
265 | public boolean isPeriodicalMetadataFlushSupported() { | |
266 | return getControlService().isVersionSupported("2.2.0"); //$NON-NLS-1$ | |
267 | } | |
589d0d33 BH |
268 | /** |
269 | * Returns if node supports snapshots or not | |
270 | * @return <code>true</code> if it supports snapshots else <code>false</code> | |
271 | * | |
272 | */ | |
273 | public boolean isSnapshotSupported() { | |
274 | return getControlService().isVersionSupported("2.3.0"); //$NON-NLS-1$ | |
275 | } | |
81d5dc3a MAL |
276 | /** |
277 | * Returns if node supports live or not | |
278 | * @return <code>true</code> if it supports live else <code>false</code> | |
279 | * | |
280 | */ | |
281 | public boolean isLiveSupported() { | |
ee8d0c40 MAL |
282 | return false; |
283 | // FIXME: Disable Live support until we have a better implementation | |
284 | //return getControlService().isVersionSupported("2.4.0"); //$NON-NLS-1$; | |
81d5dc3a | 285 | } |
bd9f92a8 BH |
286 | /** |
287 | * Returns if node supports adding contexts on event | |
288 | * @return <code>true</code> if it supports adding contexts on events else <code>false</code> | |
289 | * | |
290 | */ | |
291 | public boolean isContextOnEventSupported() { | |
292 | return !getControlService().isVersionSupported("2.2.0"); //$NON-NLS-1$ | |
293 | } | |
294 | ||
207ff523 BR |
295 | /** |
296 | * Checks if enabling of per syscall event is supported | |
297 | * | |
298 | * @return <code>true</code> if enabling of per syscall event is supported else <code>false</code> | |
299 | */ | |
300 | public boolean isPerSyscallEventsSupported() { | |
301 | return getControlService().isVersionSupported("2.6.0"); //$NON-NLS-1$ | |
302 | } | |
21c9f630 BR |
303 | /** |
304 | * Returns if node supports JUL logging or not | |
305 | * @return <code>true</code> if it supports JUL logging else <code>false</code> | |
306 | * | |
307 | */ | |
308 | public boolean isJulLoggingSupported() { | |
309 | return getControlService().isVersionSupported("2.6.0"); //$NON-NLS-1$ | |
310 | } | |
311 | /** | |
312 | * Returns if node supports LOG4J logging or not | |
313 | * @return <code>true</code> if it supports LOG4J logging else <code>false</code> | |
314 | * | |
315 | */ | |
316 | public boolean isLog4jLoggingSupported() { | |
317 | return getControlService().isVersionSupported("2.6.0"); //$NON-NLS-1$ | |
318 | } | |
319 | /** | |
320 | * Returns if node supports Python logging or not | |
321 | * @return <code>true</code> if it supports Python logging else <code>false</code> | |
322 | * | |
323 | */ | |
324 | public boolean isPythonLoggingSupported() { | |
325 | return getControlService().isVersionSupported("2.7.0"); //$NON-NLS-1$ | |
326 | } | |
207ff523 | 327 | |
6f40b641 BH |
328 | /** |
329 | * Checks if given version is supported by this ILTTngControlService implementation. | |
330 | * | |
331 | * @param version The version to check | |
332 | * @return <code>true</code> if version is supported else <code>false</code> | |
333 | */ | |
334 | public boolean isVersionSupported(String version) { | |
335 | return getControlService().isVersionSupported(version); | |
336 | } | |
337 | ||
eb1bab5b BH |
338 | // ------------------------------------------------------------------------ |
339 | // Operations | |
340 | // ------------------------------------------------------------------------ | |
cfdb727a | 341 | |
b732adaa | 342 | @Override |
533d0bc3 | 343 | public void connectionChanged(RemoteConnectionChangeEvent e) { |
b732adaa MS |
344 | if (fState == TargetNodeState.CONNECTING) { |
345 | return; | |
346 | } | |
347 | ||
348 | switch (e.getType()) { | |
533d0bc3 BH |
349 | case RemoteConnectionChangeEvent.CONNECTION_CLOSED: |
350 | case RemoteConnectionChangeEvent.CONNECTION_ABORTED: | |
b732adaa MS |
351 | handleDisconnected(); |
352 | break; | |
533d0bc3 | 353 | case RemoteConnectionChangeEvent.CONNECTION_OPENED: |
b732adaa MS |
354 | handleConnected(); |
355 | break; | |
356 | default: | |
357 | break; | |
358 | } | |
eb1bab5b BH |
359 | } |
360 | ||
b732adaa MS |
361 | /** |
362 | * Method to connect this node component to the remote target node. | |
363 | */ | |
364 | public void connect() { | |
365 | if (fState == TargetNodeState.DISCONNECTED) { | |
366 | try { | |
367 | setTargetNodeState(TargetNodeState.CONNECTING); | |
368 | Job job = new Job(format(Messages.TraceControl_OpenConnectionTo, getName())) { | |
369 | @Override | |
370 | protected IStatus run(IProgressMonitor monitor) { | |
371 | try { | |
d8a4fd60 | 372 | fRemoteProxy.connect(checkNotNull(monitor)); |
b732adaa MS |
373 | return Status.OK_STATUS; |
374 | } catch (Exception e) { | |
375 | return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_ConnectionFailure, e); | |
376 | } | |
377 | } | |
378 | }; | |
379 | job.addJobChangeListener(new JobChangeAdapter() { | |
380 | @Override | |
381 | public void done(IJobChangeEvent event) { | |
382 | IStatus status = event.getResult(); | |
383 | if (status.isOK()) { | |
384 | handleConnected(); | |
385 | } else { | |
386 | handleDisconnected(); | |
387 | if (status.getSeverity() != IStatus.CANCEL) { | |
388 | Activator.getDefault().getLog().log(status); | |
389 | } | |
390 | } | |
391 | } | |
392 | }); | |
393 | job.schedule(); | |
394 | } catch (Exception e) { | |
395 | setTargetNodeState(TargetNodeState.DISCONNECTED); | |
396 | Activator.getDefault().logError(Messages.TraceControl_ConnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$ | |
397 | } | |
398 | } | |
399 | } | |
400 | ||
401 | /** | |
402 | * Method to disconnect this node component to the remote target node. | |
403 | */ | |
eb1bab5b BH |
404 | public void disconnect() { |
405 | if (fState == TargetNodeState.CONNECTED) { | |
406 | try { | |
407 | setTargetNodeState(TargetNodeState.DISCONNECTING); | |
408 | fRemoteProxy.disconnect(); | |
409 | } catch (Exception e) { | |
9fa32496 | 410 | Activator.getDefault().logError(Messages.TraceControl_DisconnectionFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$ |
eb1bab5b | 411 | } finally { |
cfdb727a | 412 | handleDisconnected(); |
eb1bab5b BH |
413 | } |
414 | } | |
415 | } | |
416 | ||
417 | /** | |
cfdb727a AM |
418 | * Retrieves the trace configuration from the target node and populates the |
419 | * information in the tree model. The execution is done in a own job. | |
eb1bab5b | 420 | */ |
d132bcc7 | 421 | public void getConfigurationFromNode() { |
eb1bab5b BH |
422 | Job job = new Job(Messages.TraceControl_RetrieveNodeConfigurationJob) { |
423 | @Override | |
424 | protected IStatus run(IProgressMonitor monitor) { | |
425 | ||
426 | try { | |
427 | // Get provider information from node | |
428 | TraceProviderGroup providerGroup = new TraceProviderGroup(Messages.TraceControl_ProviderDisplayName, TargetNodeComponent.this); | |
429 | addChild(providerGroup); | |
f3023b37 | 430 | providerGroup.getProviderFromNode(monitor); |
cfdb727a | 431 | |
eb1bab5b BH |
432 | // Get session information from node |
433 | TraceSessionGroup sessionGroup = new TraceSessionGroup(Messages.TraceControl_AllSessionsDisplayName, TargetNodeComponent.this); | |
434 | addChild(sessionGroup); | |
435 | sessionGroup.getSessionsFromNode(monitor); | |
436 | } catch (ExecutionException e) { | |
437 | removeAllChildren(); | |
973e19d6 | 438 | return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceControl_RetrieveNodeConfigurationFailure, e); |
f3023b37 PT |
439 | } finally { |
440 | if (getTargetNodeState() == TargetNodeState.CONNECTING) { | |
441 | setTargetNodeState(TargetNodeState.CONNECTED); | |
442 | } | |
cfdb727a | 443 | } |
eb1bab5b BH |
444 | |
445 | return Status.OK_STATUS; | |
446 | } | |
447 | }; | |
448 | job.setUser(true); | |
449 | job.schedule(); | |
d132bcc7 | 450 | } |
eb1bab5b | 451 | |
8577ed1e BH |
452 | /** |
453 | * Refresh the node configuration | |
454 | */ | |
d132bcc7 BH |
455 | public void refresh() { |
456 | removeAllChildren(); | |
457 | getConfigurationFromNode(); | |
eb1bab5b | 458 | } |
cfdb727a | 459 | |
eb1bab5b BH |
460 | // ------------------------------------------------------------------------ |
461 | // Helper function | |
462 | // ------------------------------------------------------------------------ | |
11252342 | 463 | |
eb1bab5b BH |
464 | /** |
465 | * @return returns the control service for LTTng specific commands. | |
466 | * @throws ExecutionException | |
467 | */ | |
468 | private ILttngControlService createControlService() throws ExecutionException { | |
b732adaa MS |
469 | if (fService == null) { |
470 | try { | |
13729cbc BH |
471 | ICommandShell shell = fRemoteProxy.createCommandShell(); |
472 | fShell = shell; | |
473 | fService = LTTngControlServiceFactory.getLttngControlService(shell); | |
b732adaa MS |
474 | } catch (ExecutionException e) { |
475 | disposeControlService(); | |
476 | throw e; | |
477 | } | |
eb1bab5b | 478 | } |
eb1bab5b BH |
479 | return fService; |
480 | } | |
481 | ||
482 | /** | |
cfdb727a | 483 | * Handles the connected event. |
eb1bab5b BH |
484 | */ |
485 | private void handleConnected() { | |
eb1bab5b BH |
486 | try { |
487 | createControlService(); | |
488 | getConfigurationFromNode(); | |
b732adaa | 489 | // Set connected only after the control service has been created and the jobs for creating the |
f3023b37 | 490 | // sub-nodes are completed. |
973e19d6 BH |
491 | } catch (final ExecutionException e) { |
492 | // Disconnect only if no control service, otherwise stay connected. | |
b732adaa MS |
493 | if (getControlService() == NULL_CONTROL_SERVICE) { |
494 | fState = TargetNodeState.CONNECTED; | |
973e19d6 BH |
495 | disconnect(); |
496 | } | |
497 | ||
498 | // Notify user | |
499 | Display.getDefault().asyncExec(new Runnable() { | |
500 | @Override | |
501 | public void run() { | |
502 | ErrorDialog er = new ErrorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), | |
503 | Messages.TraceControl_ErrorTitle, Messages.TraceControl_RetrieveNodeConfigurationFailure, | |
504 | new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e), | |
505 | IStatus.ERROR); | |
506 | er.open(); | |
507 | } | |
508 | }); | |
509 | Activator.getDefault().logError(Messages.TraceControl_RetrieveNodeConfigurationFailure + " (" + getName() + "). \n", e); //$NON-NLS-1$ //$NON-NLS-2$ | |
eb1bab5b BH |
510 | } |
511 | } | |
512 | ||
513 | /** | |
cfdb727a | 514 | * Handles the disconnected event. |
eb1bab5b BH |
515 | */ |
516 | private void handleDisconnected() { | |
b732adaa | 517 | disposeControlService(); |
eb1bab5b | 518 | setTargetNodeState(TargetNodeState.DISCONNECTED); |
b732adaa MS |
519 | removeAllChildren(); |
520 | } | |
521 | ||
522 | @Override | |
523 | public void addChild(ITraceControlComponent component) { | |
524 | if (getTargetNodeState() == TargetNodeState.DISCONNECTED) { | |
525 | return; | |
526 | } | |
527 | super.addChild(component); | |
eb1bab5b BH |
528 | } |
529 | } |