1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
Ted Williams 2007-08-06 20:45:37 +00:00
parent 91a2802384
commit e58cfb9ff8
7 changed files with 51 additions and 1 deletions

View file

@ -414,6 +414,8 @@ public abstract class AbstractPane extends Canvas
fCaretAddress = fRendering.getMemoryBlockEndAddress().add( fCaretAddress = fRendering.getMemoryBlockEndAddress().add(
BigInteger.valueOf(cellOffset / fRendering.getAddressableSize())); BigInteger.valueOf(cellOffset / fRendering.getAddressableSize()));
} }
fRendering.setCaretAddress(fCaretAddress);
} }
protected boolean isOdd(int value) protected boolean isOdd(int value)

View file

@ -181,6 +181,7 @@ public class AddressPane extends AbstractPane
this.fCaretAddress = cellAddress; this.fCaretAddress = cellAddress;
this.fSubCellCaretPosition = x2; this.fSubCellCaretPosition = x2;
setCaretAddress(fCaretAddress);
} }
} }
catch(Exception e) catch(Exception e)

View file

@ -211,6 +211,7 @@ public class DataPane extends AbstractPane
this.fCaretAddress = cellAddress; this.fCaretAddress = cellAddress;
this.fSubCellCaretPosition = subCellCharacterPosition; this.fSubCellCaretPosition = subCellCharacterPosition;
setCaretAddress(fCaretAddress);
} }
} }
catch(Exception e) catch(Exception e)

View file

@ -23,6 +23,9 @@ import org.eclipse.debug.internal.ui.views.memory.renderings.GoToAddressComposit
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyAdapter;
@ -1569,6 +1572,28 @@ public class Rendering extends Composite implements IDebugEventSetListener
fTextPane.settingsChanged(); fTextPane.settingsChanged();
} }
protected void copyAddressToClipboard()
{
Clipboard clip = null;
try
{
clip = new Clipboard(getDisplay());
String addressString = "0x" + getCaretAddress().toString(16);
TextTransfer plainTextTransfer = TextTransfer.getInstance();
clip.setContents(new Object[] { addressString },
new Transfer[] { plainTextTransfer });
}
finally
{
if(clip != null)
{
clip.dispose();
}
}
}
static final char[] hexdigits = { '0', '1', '2', '3', '4', '5', '6', '7', static final char[] hexdigits = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

View file

@ -183,6 +183,7 @@ public class TextPane extends AbstractPane
this.fCaretAddress = cellAddress; this.fCaretAddress = cellAddress;
this.fSubCellCaretPosition = x2; this.fSubCellCaretPosition = x2;
setCaretAddress(fCaretAddress);
} }
} }
catch(Exception e) catch(Exception e)

View file

@ -485,6 +485,24 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
final Action copyAction = new CopyAction(this.fRendering); final Action copyAction = new CopyAction(this.fRendering);
// copy address
final Action copyAddressAction = new Action(
TraditionalRenderingMessages
.getString("TraditionalRendering.COPY_ADDRESS")) //$NON-NLS-1$
{
public void run()
{
Display.getDefault().asyncExec(new Runnable()
{
public void run()
{
TraditionalRendering.this.fRendering.copyAddressToClipboard();
}
});
}
};
// go to address // go to address
final Action gotoAddressAction = new GoToAddressAction(TraditionalRendering.this) final Action gotoAddressAction = new GoToAddressAction(TraditionalRendering.this)
@ -925,6 +943,7 @@ public class TraditionalRendering extends AbstractMemoryRendering implements IRe
manager.add(new Separator()); manager.add(new Separator());
manager.add(copyAction); manager.add(copyAction);
manager.add(copyAddressAction);
manager.add(gotoAddressAction); manager.add(gotoAddressAction);
manager.add(gotoBaseAddressAction); manager.add(gotoBaseAddressAction);

View file

@ -46,3 +46,4 @@ TraditionalRendering.COLUMN_COUNT_6=6
TraditionalRendering.COLUMN_COUNT_7=7 TraditionalRendering.COLUMN_COUNT_7=7
TraditionalRendering.COLUMN_COUNT_8=8 TraditionalRendering.COLUMN_COUNT_8=8
TraditionalRendering.COLUMN_COUNT_CUSTOM=Custom... TraditionalRendering.COLUMN_COUNT_CUSTOM=Custom...
TraditionalRendering.COPY_ADDRESS=Copy Address