|
Lines 241-256
Link Here
|
| 241 |
* TODO: consider making this work per-element and parent |
241 |
* TODO: consider making this work per-element and parent |
| 242 |
* Should we collect all parents before calling refresh? |
242 |
* Should we collect all parents before calling refresh? |
| 243 |
*/ |
243 |
*/ |
| 244 |
ArrayList<IInteractionElement> toRefresh = new ArrayList<IInteractionElement>(); |
244 |
if (ContextCore.getContextManager().getActiveContext() != null |
| 245 |
for (IInteractionElement interactionElement : event.getElements()) { |
245 |
&& event.getElements().size() > ContextCore.getContextManager() |
| 246 |
AbstractContextStructureBridge structureBridge = ContextCore.getStructureBridge(interactionElement.getContentType()); |
246 |
.getActiveContext() |
| 247 |
IInteractionElement parent = ContextCore.getContextManager().getElement( |
247 |
.getInteresting() |
| 248 |
structureBridge.getParentHandle(interactionElement.getHandleIdentifier())); |
248 |
.size()) { |
| 249 |
if (parent != null) { |
249 |
// probably quicker to refresh the entire view if more than half of the elements in the context deleted |
| 250 |
toRefresh.add(parent); |
250 |
refreshViewers((IInteractionElement) null, false); |
|
|
251 |
} else { |
| 252 |
ArrayList<IInteractionElement> toRefresh = new ArrayList<IInteractionElement>(); |
| 253 |
|
| 254 |
for (IInteractionElement interactionElement : event.getElements()) { |
| 255 |
AbstractContextStructureBridge structureBridge = ContextCore.getStructureBridge(interactionElement.getContentType()); |
| 256 |
IInteractionElement parent = ContextCore.getContextManager().getElement( |
| 257 |
structureBridge.getParentHandle(interactionElement.getHandleIdentifier())); |
| 258 |
if (parent != null) { |
| 259 |
toRefresh.add(parent); |
| 260 |
} |
| 261 |
} |
| 262 |
if (toRefresh.size() != 0) { |
| 263 |
refreshViewers(toRefresh, false); |
| 251 |
} |
264 |
} |
| 252 |
} |
265 |
} |
| 253 |
refreshViewers(toRefresh, false); |
|
|
| 254 |
|
266 |
|
| 255 |
break; |
267 |
break; |
| 256 |
} |
268 |
} |
|
Lines 290-296
Link Here
|
| 290 |
refreshViewer(nodesToRefresh, updateLabels, viewer); |
302 |
refreshViewer(nodesToRefresh, updateLabels, viewer); |
| 291 |
} |
303 |
} |
| 292 |
} catch (Throwable t) { |
304 |
} catch (Throwable t) { |
| 293 |
StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Could not refresh viewer", t)); //$NON-NLS-1$ |
305 |
StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, "Could not refresh viewer", t)); |
| 294 |
} |
306 |
} |
| 295 |
} |
307 |
} |
| 296 |
|
308 |
|
|
Lines 305-311
Link Here
|
| 305 |
} |
317 |
} |
| 306 |
FocusedViewerDelayedRefreshJob job = refreshJobs.get(viewer); |
318 |
FocusedViewerDelayedRefreshJob job = refreshJobs.get(viewer); |
| 307 |
if (job == null) { |
319 |
if (job == null) { |
| 308 |
job = new FocusedViewerDelayedRefreshJob(viewer, "refresh viewer", updateLabels); //$NON-NLS-1$ |
320 |
job = new FocusedViewerDelayedRefreshJob(viewer, "refresh viewer", updateLabels); |
| 309 |
refreshJobs.put(viewer, job); |
321 |
refreshJobs.put(viewer, job); |
| 310 |
} |
322 |
} |
| 311 |
job.refreshElements(nodesToRefresh.toArray()); |
323 |
job.refreshElements(nodesToRefresh.toArray()); |
|
Lines 337-343
Link Here
|
| 337 |
if (!internalExpandExceptionLogged) { |
349 |
if (!internalExpandExceptionLogged) { |
| 338 |
internalExpandExceptionLogged = true; |
350 |
internalExpandExceptionLogged = true; |
| 339 |
StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, |
351 |
StatusHandler.log(new Status(IStatus.ERROR, ContextUiPlugin.ID_PLUGIN, |
| 340 |
"Failed to verify expansion state, falling back to expanding all nodes", e)); //$NON-NLS-1$ |
352 |
"Failed to verify expansion state, falling back to expanding all nodes", e)); |
| 341 |
} |
353 |
} |
| 342 |
failed = true; |
354 |
failed = true; |
| 343 |
} |
355 |
} |