static IMemoryBlockManager getMemoryBlockManager() { return DebugPlugin.getDefault().getMemoryBlockManager(); }
@Override public void run() { ISelection selected = fTreeViewer.getSelection(); if (selected != null && selected instanceof IStructuredSelection) { Object[] selectedMemBlks = ((IStructuredSelection) selected).toArray(); ArrayList<Object> memoryBlocks = new ArrayList<>(); for (int i = 0; i < selectedMemBlks.length; i++) { if (selectedMemBlks[i] instanceof IMemoryBlock) { memoryBlocks.add(selectedMemBlks[i]); } } DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks(memoryBlocks.toArray(new IMemoryBlock[memoryBlocks.size()])); } } }
@Override protected Object[] getChildren(Object parent, IPresentationContext context) throws CoreException { String id = context.getId(); if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) { if (parent instanceof IMemoryBlockRetrieval) { return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent); } } return EMPTY; }
private void addSelectDeltaNode(ModelDelta delta) { IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval); if (memoryBlocks != null && memoryBlocks.length > 0) { delta.addNode(memoryBlocks[0], IModelDelta.SELECT); } }
@Override public void init(IPresentationContext context) { super.init(context); DebugPlugin.getDefault().getMemoryBlockManager().addListener(this); }
@Override protected boolean hasChildren(Object element, IPresentationContext context) throws CoreException { String id = context.getId(); if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) { if (element instanceof IMemoryBlockRetrieval) { if (((IMemoryBlockRetrieval)element).supportsStorageRetrieval()) return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)element).length > 0; } } return false; }
@Override public synchronized void dispose() { super.dispose(); DebugPlugin.getDefault().getMemoryBlockManager().removeListener(this); }
@Override public void run() { IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); if (window == null) { return; } boolean proceed = MessageDialog.openQuestion(window.getShell(), DebugUIMessages.MemoryBlocksTreeViewPane_0, DebugUIMessages.MemoryBlocksTreeViewPane_1); // if (proceed) { IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval); DebugPlugin.getDefault().getMemoryBlockManager().removeMemoryBlocks(memoryBlocks); } } }
private boolean isFirstMemoryBlock() { Object input = getViewer().getInput(); if (input instanceof IMemoryBlockRetrieval) { IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval) input); if (memoryBlocks.length == 1) return true; } return false; } }
public ViewPaneEventHandler() { DebugPlugin.getDefault().getMemoryBlockManager().addListener(this); DebugPlugin.getDefault().addDebugEventListener(this); }
public void dispose() { fDisposed = true; DebugPlugin.getDefault().getMemoryBlockManager().removeListener(this); DebugPlugin.getDefault().removeDebugEventListener(this); }
/** * Returns all children of the given parent in the given context. * * @param parent * @param context * @param monitor * @return all children */ protected Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor) { String id = context.getId(); if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) { if (parent instanceof IMemoryBlockRetrieval) { if (((IMemoryBlockRetrieval)parent).supportsStorageRetrieval()) return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent); } } return EMPTY; }
/** * Returns all children of the given parent object. * * @param parent * @param context * @param monitor * @return all children * @throws CoreException */ protected Object[] getAllChildren(Object parent, IPresentationContext context, IViewerUpdate monitor) throws CoreException { String id = context.getId(); if (id.equals(IDebugUIConstants.ID_DEBUG_VIEW)) { return ((IDebugTarget)parent).getThreads(); } else if (id.equals(IDebugUIConstants.ID_MEMORY_VIEW)) { if (parent instanceof IMemoryBlockRetrieval) { if (((IMemoryBlockRetrieval)parent).supportsStorageRetrieval()) return DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks((IMemoryBlockRetrieval)parent); } } return EMPTY; }
private void switchToNext() { IAdaptable context = getDebugContext(); if (context instanceof IDebugElement) { IDebugElement debugContext = (IDebugElement) context; IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(debugContext); if (retrieval != null) { IMemoryBlock[] memoryBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(retrieval); doSwitchToNext(memoryBlocks); } } }
@Override public void init(IViewPart view) { fView = view; DebugUITools.getDebugContextManager().getContextService(fView.getViewSite().getWorkbenchWindow()).addDebugContextListener(fDebugContextListener); DebugPlugin.getDefault().getMemoryBlockManager().addListener(fListener); fUpdateJob.runInUIThread(new NullProgressMonitor()); }
/** * Set the initial memory block selection when the proxy is installed. This * is done to ensure that when the memory view is opened, there is an * initial selection. Otherwise, the Rendering Pane will show up as blank. * * @since 3.4 */ protected void setInitialSelection() { IMemoryBlock[] allMB = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval); if (allMB.length > 0) { ModelDelta delta = new ModelDelta(fRetrieval, 0, IModelDelta.NO_CHANGE, allMB.length); delta.addNode(allMB[0], 0, IModelDelta.SELECT, 0); fireModelChanged(delta); } }
@Override public void memoryBlocksAdded(IMemoryBlock[] memory) { IMemoryBlock[] allMB = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval); int lastIndex = allMB.length - memory.length; ModelDelta delta = new ModelDelta(fRetrieval, 0, IModelDelta.NO_CHANGE, allMB.length); for (int i = 0; i < memory.length; i++) { IMemoryBlockRetrieval retrieval = MemoryViewUtil.getMemoryBlockRetrieval(memory[i]); if (retrieval != null) { if (retrieval == fRetrieval) { // select the newly added memory block delta.addNode(memory[i], lastIndex + i, IModelDelta.ADDED | IModelDelta.SELECT, 0); } } } fireModelChanged(delta); }
@Override public void dispose() { fAction = null; DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fListener); DebugUITools.getDebugContextManager().getContextService(fView.getViewSite().getWorkbenchWindow()).removeDebugContextListener(fDebugContextListener); if (fMenuCreator != null) { fMenuCreator.dispose(); } }
@Override public boolean close() { fViewer.removeSelectionChangedListener(fSelectionChangedListener); memoryBlock.removeSelectionListener(fSelectionListener); addNew.removeSelectionListener(fAddNewSelectionAdapter); DebugPlugin.getDefault().getMemoryBlockManager().removeListener(fMemoryBlockListener); DebugUITools.getMemoryRenderingManager().removeListener(fBindingListener); return super.close(); }
private void updateActionsEnablement() { if (fRemoveMemoryBlockAction == null) { return; } if (fRemoveAllMemoryBlocksAction == null) { return; } if (fRetrieval != null) { IMemoryBlock[] memBlocks = DebugPlugin.getDefault().getMemoryBlockManager().getMemoryBlocks(fRetrieval); if (memBlocks.length > 0) { fRemoveMemoryBlockAction.setEnabled(true); fRemoveAllMemoryBlocksAction.setEnabled(true); } else { fRemoveMemoryBlockAction.setEnabled(false); fRemoveAllMemoryBlocksAction.setEnabled(false); } } else { fRemoveMemoryBlockAction.setEnabled(false); fRemoveAllMemoryBlocksAction.setEnabled(false); } }