mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
[268625] target Find/Replace & Import/Export actions to Memory Browser
This commit is contained in:
parent
fd7027d65f
commit
12b1558637
9 changed files with 229 additions and 113 deletions
|
@ -13,12 +13,15 @@ package org.eclipse.cdt.debug.ui.memory.memorybrowser;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
|
@ -52,11 +55,14 @@ import org.eclipse.jface.resource.ColorRegistry;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.jface.util.SafeRunnable;
|
||||||
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
import org.eclipse.jface.viewers.IBasicPropertyConstants;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.TreeSelection;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.CTabFolder;
|
import org.eclipse.swt.custom.CTabFolder;
|
||||||
import org.eclipse.swt.custom.CTabFolder2Adapter;
|
import org.eclipse.swt.custom.CTabFolder2Adapter;
|
||||||
|
@ -74,11 +80,12 @@ import org.eclipse.swt.layout.FormLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.IWorkbenchPartSite;
|
|
||||||
import org.eclipse.ui.IWorkbenchPreferenceConstants;
|
import org.eclipse.ui.IWorkbenchPreferenceConstants;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
@ -96,7 +103,7 @@ import org.eclipse.ui.progress.WorkbenchJob;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class MemoryBrowser extends ViewPart implements IDebugContextListener, ILaunchListener
|
public class MemoryBrowser extends ViewPart implements IDebugContextListener, ILaunchListener, IMemoryRenderingSite
|
||||||
{
|
{
|
||||||
public static final String ID = "org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser"; //$NON-NLS-1$
|
public static final String ID = "org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -140,20 +147,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
else if(types.length > 0)
|
else if(types.length > 0)
|
||||||
defaultRenderingTypeId = types[0].getId();
|
defaultRenderingTypeId = types[0].getId();
|
||||||
|
|
||||||
getSite().setSelectionProvider(new ISelectionProvider() {
|
getSite().setSelectionProvider(new SelectionProviderAdapter());
|
||||||
|
|
||||||
public void addSelectionChangedListener(
|
|
||||||
ISelectionChangedListener listener) {}
|
|
||||||
|
|
||||||
public ISelection getSelection() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeSelectionChangedListener(
|
|
||||||
ISelectionChangedListener listener) {}
|
|
||||||
|
|
||||||
public void setSelection(ISelection selection) {}
|
|
||||||
});
|
|
||||||
|
|
||||||
fMainComposite = new Composite(parent, SWT.NONE);
|
fMainComposite = new Composite(parent, SWT.NONE);
|
||||||
|
|
||||||
|
@ -218,6 +212,11 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
.addDebugContextListener(this);
|
.addDebugContextListener(this);
|
||||||
|
|
||||||
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
|
DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
|
||||||
|
|
||||||
|
Object selection = DebugUITools.getDebugContextManager()
|
||||||
|
.getContextService(getSite().getWorkbenchWindow()).getActiveContext();
|
||||||
|
if(selection instanceof StructuredSelection)
|
||||||
|
handleDebugContextChanged(((StructuredSelection) selection).getFirstElement());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -236,6 +235,57 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
releaseTabFolder(retrieval);
|
releaseTabFolder(retrieval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IMemoryRenderingContainer getContainer(String id) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMemoryRenderingContainer[] getMemoryRenderingContainers() {
|
||||||
|
return new IMemoryRenderingContainer[] {
|
||||||
|
new IMemoryRenderingContainer()
|
||||||
|
{
|
||||||
|
|
||||||
|
public void addMemoryRendering(IMemoryRendering rendering) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMemoryRendering getActiveRendering() {
|
||||||
|
if(fStackLayout.topControl instanceof CTabFolder)
|
||||||
|
{
|
||||||
|
CTabFolder activeFolder = (CTabFolder) fStackLayout.topControl;
|
||||||
|
if(activeFolder.getSelection() != null)
|
||||||
|
return (IMemoryRendering) activeFolder.getSelection().getData(KEY_RENDERING);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMemoryRenderingSite getMemoryRenderingSite() {
|
||||||
|
return MemoryBrowser.this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMemoryRendering[] getRenderings() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeMemoryRendering(IMemoryRendering rendering) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public IMemoryRenderingSynchronizationService getSynchronizationService() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void handleUnsupportedSelection()
|
private void handleUnsupportedSelection()
|
||||||
{
|
{
|
||||||
fStackLayout.topControl = fUnsupportedLabel;
|
fStackLayout.topControl = fUnsupportedLabel;
|
||||||
|
@ -256,6 +306,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
populateTabWithRendering(item, retrieval, context);
|
populateTabWithRendering(item, retrieval, context);
|
||||||
setTabFolder(retrieval, activeFolder);
|
setTabFolder(retrieval, activeFolder);
|
||||||
activeFolder.setSelection(item);
|
activeFolder.setSelection(item);
|
||||||
|
getSite().getSelectionProvider().setSelection(new StructuredSelection(item.getData(KEY_RENDERING)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Control c = activeFolder.getSelection().getControl();
|
Control c = activeFolder.getSelection().getControl();
|
||||||
|
@ -350,8 +401,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
private void contributeToActionBars() {
|
private void contributeToActionBars() {
|
||||||
IActionBars bars = getViewSite().getActionBars();
|
IActionBars bars = getViewSite().getActionBars();
|
||||||
fillLocalPullDown(bars.getMenuManager());
|
fillLocalPullDown(bars.getMenuManager());
|
||||||
fillLocalToolBar(bars.getToolBarManager());
|
fillLocalToolBar(bars.getToolBarManager());
|
||||||
bars.getToolBarManager().add(new Action() { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillLocalPullDown(IMenuManager manager) {
|
private void fillLocalPullDown(IMenuManager manager) {
|
||||||
|
@ -426,49 +476,57 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
getControl().setFocus();
|
getControl().setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debugContextChanged(DebugContextEvent event) {
|
public void debugContextChanged(DebugContextEvent event) {
|
||||||
|
handleDebugContextChanged(((StructuredSelection) event.getContext()).getFirstElement());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDebugContextChanged(Object context) {
|
||||||
if(defaultRenderingTypeId == null)
|
if(defaultRenderingTypeId == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getContext() instanceof StructuredSelection)
|
if(context instanceof IAdaptable)
|
||||||
{
|
{
|
||||||
Object context = ((StructuredSelection) event.getContext()).getFirstElement();
|
IMemoryBlockRetrieval retrieval = ((IMemoryBlockRetrieval) ((IAdaptable) context).getAdapter(IMemoryBlockRetrieval.class));
|
||||||
if(context instanceof IAdaptable)
|
if(retrieval != null)
|
||||||
{
|
{
|
||||||
IMemoryBlockRetrieval retrieval = ((IMemoryBlockRetrieval) ((IAdaptable) context).getAdapter(IMemoryBlockRetrieval.class));
|
fGotoAddressBarControl.setVisible(true);
|
||||||
if(retrieval != null)
|
if(getTabFolder(retrieval) != null)
|
||||||
{
|
{
|
||||||
fGotoAddressBarControl.setVisible(true);
|
fStackLayout.topControl = getTabFolder(retrieval);
|
||||||
if(getTabFolder(retrieval) != null)
|
|
||||||
{
|
|
||||||
fStackLayout.topControl = getTabFolder(retrieval);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CTabFolder newFolder = this.createTabFolder(fRenderingsComposite);
|
|
||||||
newFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
|
|
||||||
public void close(CTabFolderEvent event) {
|
|
||||||
event.doit = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
newFolder.setData(KEY_CONTEXT, context);
|
|
||||||
newFolder.setData(KEY_RETRIEVAL, retrieval);
|
|
||||||
|
|
||||||
CTabItem item = createTab(newFolder, 0);
|
|
||||||
populateTabWithRendering(item, retrieval, context);
|
|
||||||
setTabFolder(retrieval, newFolder);
|
|
||||||
|
|
||||||
fStackLayout.topControl = getTabFolder(retrieval);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
handleUnsupportedSelection();
|
CTabFolder newFolder = this.createTabFolder(fRenderingsComposite);
|
||||||
|
newFolder.addCTabFolder2Listener(new CTabFolder2Adapter() {
|
||||||
|
public void close(CTabFolderEvent event) {
|
||||||
|
event.doit = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
newFolder.addSelectionListener(new SelectionListener()
|
||||||
|
{
|
||||||
|
public void widgetDefaultSelected(SelectionEvent e) {}
|
||||||
|
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
getSite().getSelectionProvider().setSelection(new StructuredSelection(((CTabItem) e.item).getData(KEY_RENDERING)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
newFolder.setData(KEY_CONTEXT, context);
|
||||||
|
newFolder.setData(KEY_RETRIEVAL, retrieval);
|
||||||
|
|
||||||
|
CTabItem item = createTab(newFolder, 0);
|
||||||
|
populateTabWithRendering(item, retrieval, context);
|
||||||
|
setTabFolder(retrieval, newFolder);
|
||||||
|
|
||||||
|
fStackLayout.topControl = getTabFolder(retrieval);
|
||||||
}
|
}
|
||||||
fStackLayout.topControl.getParent().layout(true);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
handleUnsupportedSelection();
|
||||||
|
}
|
||||||
|
fStackLayout.topControl.getParent().layout(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,24 +562,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMemoryRenderingSite getMemoryRenderingSite() {
|
public IMemoryRenderingSite getMemoryRenderingSite() {
|
||||||
return new IMemoryRenderingSite() {
|
return MemoryBrowser.this;
|
||||||
public IMemoryRenderingContainer getContainer(String id) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IMemoryRenderingContainer[] getMemoryRenderingContainers() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IWorkbenchPartSite getSite() {
|
|
||||||
return MemoryBrowser.this.getSite();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IMemoryRenderingSynchronizationService getSynchronizationService() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMemoryRendering[] getRenderings() {
|
public IMemoryRendering[] getRenderings() {
|
||||||
|
@ -546,6 +587,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
tab.setControl(rendering.getControl());
|
tab.setControl(rendering.getControl());
|
||||||
tab.getParent().setSelection(0);
|
tab.getParent().setSelection(0);
|
||||||
tab.setData(KEY_RENDERING, rendering);
|
tab.setData(KEY_RENDERING, rendering);
|
||||||
|
getSite().getSelectionProvider().setSelection(new StructuredSelection(tab.getData(KEY_RENDERING)));
|
||||||
updateLabel(tab, rendering);
|
updateLabel(tab, rendering);
|
||||||
|
|
||||||
rendering.addPropertyChangeListener(new IPropertyChangeListener()
|
rendering.addPropertyChangeListener(new IPropertyChangeListener()
|
||||||
|
@ -591,6 +633,42 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IL
|
||||||
}
|
}
|
||||||
fContextFolders.remove(context);
|
fContextFolders.remove(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SelectionProviderAdapter implements ISelectionProvider {
|
||||||
|
|
||||||
|
List listeners = new ArrayList();
|
||||||
|
|
||||||
|
ISelection theSelection = StructuredSelection.EMPTY;
|
||||||
|
|
||||||
|
public void addSelectionChangedListener(ISelectionChangedListener listener) {
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ISelection getSelection() {
|
||||||
|
return theSelection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeSelectionChangedListener(
|
||||||
|
ISelectionChangedListener listener) {
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelection(ISelection selection) {
|
||||||
|
theSelection = selection;
|
||||||
|
final SelectionChangedEvent e = new SelectionChangedEvent(this, selection);
|
||||||
|
Object[] listenersArray = listeners.toArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < listenersArray.length; i++) {
|
||||||
|
final ISelectionChangedListener l = (ISelectionChangedListener) listenersArray[i];
|
||||||
|
Platform.run(new SafeRunnable() {
|
||||||
|
public void run() {
|
||||||
|
l.selectionChanged(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,30 @@
|
||||||
menubarPath="additions">
|
menubarPath="additions">
|
||||||
</action>
|
</action>
|
||||||
</viewContribution>
|
</viewContribution>
|
||||||
|
|
||||||
|
<viewContribution
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser.findNext"
|
||||||
|
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser">
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.search.FindAction"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.search.FindAction"
|
||||||
|
label="Find Next"
|
||||||
|
menubarPath="additions">
|
||||||
|
</action>
|
||||||
|
</viewContribution>
|
||||||
|
<viewContribution
|
||||||
|
id="org.eclipse.debug.ui.MemoryView.findReplace"
|
||||||
|
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser">
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.search.FindAction"
|
||||||
|
enablesFor="1"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.search.FindAction"
|
||||||
|
label="Find/Replace..."
|
||||||
|
menubarPath="additions">
|
||||||
|
</action>
|
||||||
|
</viewContribution>
|
||||||
|
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension point="org.eclipse.search.searchResultViewPages">
|
<extension point="org.eclipse.search.searchResultViewPages">
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -27,13 +28,13 @@ import org.eclipse.ui.IViewPart;
|
||||||
|
|
||||||
public class FindAction implements IViewActionDelegate {
|
public class FindAction implements IViewActionDelegate {
|
||||||
|
|
||||||
private MemoryView fView;
|
private IMemoryRenderingSite fView;
|
||||||
|
|
||||||
private static Properties fSearchDialogProperties = new Properties();
|
private static Properties fSearchDialogProperties = new Properties();
|
||||||
|
|
||||||
public void init(IViewPart view) {
|
public void init(IViewPart view) {
|
||||||
if (view instanceof MemoryView)
|
if (view instanceof IMemoryRenderingSite)
|
||||||
fView = (MemoryView) view;
|
fView = (IMemoryRenderingSite) view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(IAction action) {
|
public void run(IAction action) {
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.search;
|
package org.eclipse.cdt.debug.ui.memory.search;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -26,11 +25,9 @@ import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
import org.eclipse.debug.core.model.IMemoryBlockExtension;
|
||||||
import org.eclipse.debug.core.model.MemoryByte;
|
import org.eclipse.debug.core.model.MemoryByte;
|
||||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
@ -80,7 +77,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
private Button fReplaceAllButton;
|
private Button fReplaceAllButton;
|
||||||
private Button fCloseButton;
|
private Button fCloseButton;
|
||||||
|
|
||||||
private MemoryView fMemoryView;
|
private IMemoryRenderingSite fMemoryView;
|
||||||
|
|
||||||
private Button fFormatAsciiButton;
|
private Button fFormatAsciiButton;
|
||||||
private Button fFormatHexButton;
|
private Button fFormatHexButton;
|
||||||
|
@ -114,7 +111,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
protected final static String SEARCH_FORMAT_WRAP = "SEARCH_FORMAT_WRAP"; //$NON-NLS-1$
|
protected final static String SEARCH_FORMAT_WRAP = "SEARCH_FORMAT_WRAP"; //$NON-NLS-1$
|
||||||
protected final static String SEARCH_ENABLE_FIND_NEXT = "SEARCH_ENABLE_FIND_NEXT"; //$NON-NLS-1$
|
protected final static String SEARCH_ENABLE_FIND_NEXT = "SEARCH_ENABLE_FIND_NEXT"; //$NON-NLS-1$
|
||||||
|
|
||||||
public FindReplaceDialog(Shell parent, IMemoryBlockExtension memoryBlock, MemoryView memoryView, Properties properties)
|
public FindReplaceDialog(Shell parent, IMemoryBlockExtension memoryBlock, IMemoryRenderingSite memoryView, Properties properties)
|
||||||
{
|
{
|
||||||
super(parent);
|
super(parent);
|
||||||
super.setTitle(Messages.getString("FindReplaceDialog.Title")); //$NON-NLS-1$
|
super.setTitle(Messages.getString("FindReplaceDialog.Title")); //$NON-NLS-1$
|
||||||
|
@ -456,7 +453,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
private String getViewportStart()
|
private String getViewportStart()
|
||||||
{
|
{
|
||||||
ISelection selection = fMemoryView.getViewPane(IDebugUIConstants.ID_RENDERING_VIEW_PANE_1).getSelectionProvider().getSelection();
|
ISelection selection = fMemoryView.getMemoryRenderingContainers()[0].getMemoryRenderingSite().getSite().getSelectionProvider().getSelection();
|
||||||
if(selection instanceof StructuredSelection)
|
if(selection instanceof StructuredSelection)
|
||||||
{
|
{
|
||||||
if(((StructuredSelection) selection).getFirstElement() instanceof IRepositionableMemoryRendering)
|
if(((StructuredSelection) selection).getFirstElement() instanceof IRepositionableMemoryRendering)
|
||||||
|
@ -1029,7 +1026,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MemoryView getMemoryView() {
|
public IMemoryRenderingSite getMemoryView() {
|
||||||
return fMemoryView;
|
return fMemoryView;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1190,7 +1187,7 @@ public class FindReplaceDialog extends SelectionDialog
|
||||||
|
|
||||||
interface IMemorySearchQuery extends ISearchQuery
|
interface IMemorySearchQuery extends ISearchQuery
|
||||||
{
|
{
|
||||||
public MemoryView getMemoryView();
|
public IMemoryRenderingSite getMemoryView();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,6 @@
|
||||||
</renderingBindings>
|
</renderingBindings>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
<extension point="org.eclipse.debug.ui.memoryRenderings">
|
|
||||||
<renderingType
|
|
||||||
name="Traditional Go To Address"
|
|
||||||
id="org.eclipse.cdt.debug.ui.memory.traditional.TraditionalGoToAddressRendering"
|
|
||||||
class="org.eclipse.cdt.debug.ui.memory.traditional.TraditionalGoToAddressRenderingTypeDelegate">
|
|
||||||
</renderingType>
|
|
||||||
</extension>
|
|
||||||
|
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.preferencePages">
|
point="org.eclipse.ui.preferencePages">
|
||||||
<page
|
<page
|
||||||
|
|
|
@ -47,16 +47,16 @@
|
||||||
targetID="org.eclipse.debug.ui.MemoryView"
|
targetID="org.eclipse.debug.ui.MemoryView"
|
||||||
id="org.eclipse.debug.ui.memoryView.toolbar">
|
id="org.eclipse.debug.ui.memoryView.toolbar">
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.ui.memory.transport.actions.ExportMemoryAction"
|
class="org.eclipse.cdt.debug.ui.memory.transport.actions.ExportMemoryAction"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
helpContextId="ExportMemoryAction_context"
|
helpContextId="ExportMemoryAction_context"
|
||||||
icon="icons/export.png"
|
icon="icons/export.png"
|
||||||
id="org.eclipse.cdt.debug.ui.memory.transport.actions.ExportMemoryAction"
|
id="org.eclipse.cdt.debug.ui.memory.transport.actions.ExportMemoryAction"
|
||||||
label="%ExportMemoryAction.label"
|
label="%ExportMemoryAction.label"
|
||||||
state="false"
|
state="false"
|
||||||
style="push"
|
style="push"
|
||||||
toolbarPath="additions"
|
toolbarPath="additions"
|
||||||
tooltip="%ExportMemoryAction.label"/>
|
tooltip="%ExportMemoryAction.label"/>
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.ui.memory.transport.actions.ImportMemoryAction"
|
class="org.eclipse.cdt.debug.ui.memory.transport.actions.ImportMemoryAction"
|
||||||
enablesFor="1"
|
enablesFor="1"
|
||||||
|
@ -69,5 +69,32 @@
|
||||||
toolbarPath="additions"
|
toolbarPath="additions"
|
||||||
tooltip="%ImportMemoryAction.label"/>
|
tooltip="%ImportMemoryAction.label"/>
|
||||||
</viewContribution>
|
</viewContribution>
|
||||||
|
<viewContribution
|
||||||
|
targetID="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.memorybrowser.MemoryBrowser.toolbar">
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.transport.actions.ExportMemoryAction"
|
||||||
|
enablesFor="1"
|
||||||
|
helpContextId="ExportMemoryAction_context"
|
||||||
|
icon="icons/export.png"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.transport.actions.ExportMemoryAction"
|
||||||
|
label="%ExportMemoryAction.label"
|
||||||
|
state="false"
|
||||||
|
style="push"
|
||||||
|
toolbarPath="additions"
|
||||||
|
tooltip="%ExportMemoryAction.label"/>
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.debug.ui.memory.transport.actions.ImportMemoryAction"
|
||||||
|
enablesFor="1"
|
||||||
|
helpContextId="ImportMemoryAction_context"
|
||||||
|
icon="icons/import.png"
|
||||||
|
id="org.eclipse.cdt.debug.ui.memory.transport.actions.ImportMemoryAction2"
|
||||||
|
label="%ImportMemoryAction.label"
|
||||||
|
state="false"
|
||||||
|
style="push"
|
||||||
|
toolbarPath="additions"
|
||||||
|
tooltip="%ImportMemoryAction.label"/>
|
||||||
|
</viewContribution>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -25,10 +25,10 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
|
||||||
import org.eclipse.debug.internal.ui.views.memory.RenderingViewPane;
|
import org.eclipse.debug.internal.ui.views.memory.RenderingViewPane;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
import org.eclipse.debug.ui.memory.IMemoryRenderingContainer;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
import org.eclipse.debug.ui.memory.IRepositionableMemoryRendering;
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -61,16 +61,16 @@ public class ImportMemoryDialog extends SelectionDialog
|
||||||
|
|
||||||
private Properties fProperties = new Properties();
|
private Properties fProperties = new Properties();
|
||||||
|
|
||||||
private MemoryView fMemoryView;
|
private IMemoryRenderingSite fMemoryView;
|
||||||
|
|
||||||
public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, MemoryView view)
|
public ImportMemoryDialog(Shell parent, IMemoryBlock memoryBlock, IMemoryRenderingSite renderingSite)
|
||||||
{
|
{
|
||||||
super(parent);
|
super(parent);
|
||||||
super.setTitle("Download to Memory");
|
super.setTitle("Download to Memory");
|
||||||
setShellStyle(getShellStyle() | SWT.RESIZE);
|
setShellStyle(getShellStyle() | SWT.RESIZE);
|
||||||
|
|
||||||
fMemoryBlock = memoryBlock;
|
fMemoryBlock = memoryBlock;
|
||||||
fMemoryView = view;
|
fMemoryView = renderingSite;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void scrollRenderings(final BigInteger address)
|
protected void scrollRenderings(final BigInteger address)
|
||||||
|
|
|
@ -14,8 +14,8 @@ package org.eclipse.cdt.debug.ui.memory.transport.actions;
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.ExportMemoryDialog;
|
import org.eclipse.cdt.debug.ui.memory.transport.ExportMemoryDialog;
|
||||||
import org.eclipse.cdt.debug.ui.memory.transport.MemoryTransportPlugin;
|
import org.eclipse.cdt.debug.ui.memory.transport.MemoryTransportPlugin;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -27,11 +27,11 @@ import org.eclipse.ui.IViewPart;
|
||||||
*/
|
*/
|
||||||
public class ExportMemoryAction implements IViewActionDelegate {
|
public class ExportMemoryAction implements IViewActionDelegate {
|
||||||
|
|
||||||
private MemoryView fView;
|
private IMemoryRenderingSite fView;
|
||||||
|
|
||||||
public void init(IViewPart view) {
|
public void init(IViewPart view) {
|
||||||
if (view instanceof MemoryView)
|
if (view instanceof IMemoryRenderingSite)
|
||||||
fView = (MemoryView) view;
|
fView = (IMemoryRenderingSite) view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMemoryBlock getMemoryBlock(ISelection selection)
|
private IMemoryBlock getMemoryBlock(ISelection selection)
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.ui.memory.transport.MemoryTransportPlugin;
|
||||||
import org.eclipse.debug.core.model.IMemoryBlock;
|
import org.eclipse.debug.core.model.IMemoryBlock;
|
||||||
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
import org.eclipse.debug.internal.ui.views.memory.MemoryView;
|
||||||
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
import org.eclipse.debug.ui.memory.IMemoryRendering;
|
||||||
|
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -28,15 +29,11 @@ import org.eclipse.ui.IViewPart;
|
||||||
public class ImportMemoryAction implements IViewActionDelegate {
|
public class ImportMemoryAction implements IViewActionDelegate {
|
||||||
|
|
||||||
|
|
||||||
private MemoryView fView;
|
private IMemoryRenderingSite fView;
|
||||||
|
|
||||||
public void init(IViewPart view) {
|
public void init(IViewPart view) {
|
||||||
if (view instanceof MemoryView)
|
if (view instanceof IMemoryRenderingSite)
|
||||||
fView = (MemoryView) view;
|
fView = (IMemoryRenderingSite) view;
|
||||||
|
|
||||||
// IDebugContextService debugContextService = DebugUITools.getDebugContextManager().getContextService(view.getSite().getWorkbenchWindow());
|
|
||||||
// this.
|
|
||||||
// debugContextService.getActiveContext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IMemoryBlock getMemoryBlock(ISelection selection)
|
private IMemoryBlock getMemoryBlock(ISelection selection)
|
||||||
|
|
Loading…
Add table
Reference in a new issue