return null;
}
}
-
+
if (host != null) {
- // successful creation of host
- TargetNodeComponent node = null;
- if (!fRoot.containsChild(hostName)) {
- node = new TargetNodeComponent(hostName, fRoot, host);
- fRoot.addChild(node);
- }
- else {
- node = (TargetNodeComponent)fRoot.getChild(hostName);
+ fLock.lock();
+ try {
+ // successful creation of host
+ TargetNodeComponent node = null;
+ if (!fRoot.containsChild(hostName)) {
+ node = new TargetNodeComponent(hostName, fRoot, host);
+ fRoot.addChild(node);
+ }
+ else {
+ node = (TargetNodeComponent)fRoot.getChild(hostName);
+ }
+
+ node.connect();
+ } finally {
+ fLock.unlock();
}
-
- node.connect();
}
return null;
}
return false;
}
- fRoot = null;
+ ITraceControlComponent root = null;
// no need to verify part because it has been already done in getWorkbenchPage()
IWorkbenchPart part = page.getActivePart();
- fRoot = ((ControlView) part).getTraceControlRoot();
+ root = ((ControlView) part).getTraceControlRoot();
+
+ boolean isEnabled = root != null;
+
+ fLock.lock();
+ try {
+ fRoot = null;
+ if (isEnabled) {
+ fRoot = root;
+ }
+ } finally {
+ fLock.unlock();
+ }
- return (fRoot != null);
+ return isEnabled;
}
}