|
Lines 255-266
Link Here
|
| 255 |
|
255 |
|
| 256 |
@Override |
256 |
@Override |
| 257 |
public boolean equals(Object obj) { |
257 |
public boolean equals(Object obj) { |
| 258 |
return super.baseEquals(obj) && |
258 |
// We treat the UNKNOWN_PROCESS_ID as a wildcard. Any processId (except null) will be considered |
| 259 |
(((MIProcessDMC)obj).fId == null ? fId == null : ((MIProcessDMC)obj).fId.equals(fId)); |
259 |
// equal to the UNKNOWN_PROCESS_ID. This is important because before starting a process, we don't |
|
|
260 |
// have a pid yet, but we still need to create a process context, and we must use UNKNOWN_PROCESS_ID. |
| 261 |
// Bug 336890 |
| 262 |
|
| 263 |
if (!baseEquals(obj)) { |
| 264 |
return false; |
| 265 |
} |
| 266 |
|
| 267 |
MIProcessDMC other = (MIProcessDMC)obj; |
| 268 |
if (fId == null || other.fId == null) { |
| 269 |
return fId == null && other.fId == null; |
| 270 |
} |
| 271 |
|
| 272 |
// Now that we know neither is null, check for UNKNOWN_PROCESS_ID wildcard |
| 273 |
if (fId.equals(UNKNOWN_PROCESS_ID) || other.fId.equals(UNKNOWN_PROCESS_ID)) { |
| 274 |
return true; |
| 275 |
} |
| 276 |
|
| 277 |
return fId.equals(other.fId); |
| 260 |
} |
278 |
} |
| 261 |
|
279 |
|
| 262 |
@Override |
280 |
@Override |
| 263 |
public int hashCode() { return super.baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); } |
281 |
public int hashCode() { |
|
|
282 |
// We cannot use fId in the hashCode. This is because we support |
| 283 |
// the wildCard MIProcesses.UNKNOWN_PROCESS_ID which is equal to any other fId. |
| 284 |
// But we also need the hashCode of the wildCard to be the same |
| 285 |
// as the one of all other fIds, which is why we need a constant hashCode |
| 286 |
// See bug 336890 |
| 287 |
return baseHashCode(); |
| 288 |
} |
| 264 |
} |
289 |
} |
| 265 |
|
290 |
|
| 266 |
/* |
291 |
/* |
|
Lines 315-320
Link Here
|
| 315 |
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$ |
340 |
private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$ |
| 316 |
// The unique id should be an empty string so that the views know not to display the fake id |
341 |
// The unique id should be an empty string so that the views know not to display the fake id |
| 317 |
public static final String UNIQUE_GROUP_ID = ""; //$NON-NLS-1$ |
342 |
public static final String UNIQUE_GROUP_ID = ""; //$NON-NLS-1$ |
|
|
343 |
/** @since 4.0 */ |
| 344 |
public static final String UNKNOWN_PROCESS_ID = UNIQUE_GROUP_ID; |
| 318 |
|
345 |
|
| 319 |
public MIProcesses(DsfSession session) { |
346 |
public MIProcesses(DsfSession session) { |
| 320 |
super(session); |
347 |
super(session); |
|
Lines 420-426
Link Here
|
| 420 |
|
447 |
|
| 421 |
/** @since 4.0 */ |
448 |
/** @since 4.0 */ |
| 422 |
public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) { |
449 |
public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) { |
| 423 |
IProcessDMContext processDmc = createProcessContext(controlDmc, groupId); |
450 |
IProcessDMContext processDmc = createProcessContext(controlDmc, UNKNOWN_PROCESS_ID); |
| 424 |
return createContainerContext(processDmc, groupId); |
451 |
return createContainerContext(processDmc, groupId); |
| 425 |
} |
452 |
} |
| 426 |
|
453 |
|