Implementation of the memory view.
|
@ -1,3 +1,20 @@
|
||||||
|
2002-10-18 Mikhail Khodjaiants
|
||||||
|
Implementing the memory view support:
|
||||||
|
Images for the view's actions:
|
||||||
|
autorefresh_mem.gif (clcl, dlcl, elcl),
|
||||||
|
refresh_mem.gif (clcl, dlcl, elcl),
|
||||||
|
memory_save.gif (clcl, dlcl, elcl),
|
||||||
|
memory_clear.gif (clcl, dlcl, elcl).
|
||||||
|
* RefreshMemoryAction.java
|
||||||
|
* MemoryControlArea.java
|
||||||
|
* MemoryPresentation.java
|
||||||
|
* MemoryText.java
|
||||||
|
* MemoryView.java
|
||||||
|
* MemoryViewer.java
|
||||||
|
* CDebugImages.java
|
||||||
|
* ICDebugHelpContextIds.java
|
||||||
|
* ICDebugUIConstants.java
|
||||||
|
|
||||||
2002-10-17 Mikhail Khodjaiants
|
2002-10-17 Mikhail Khodjaiants
|
||||||
Implementing the memory view support:
|
Implementing the memory view support:
|
||||||
* MemoryControlArea.java
|
* MemoryControlArea.java
|
||||||
|
|
After Width: | Height: | Size: 182 B |
After Width: | Height: | Size: 162 B |
After Width: | Height: | Size: 568 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/clcl16/refresh_mem.gif
Normal file
After Width: | Height: | Size: 237 B |
After Width: | Height: | Size: 104 B |
After Width: | Height: | Size: 91 B |
After Width: | Height: | Size: 363 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/refresh_mem.gif
Normal file
After Width: | Height: | Size: 129 B |
After Width: | Height: | Size: 144 B |
After Width: | Height: | Size: 122 B |
After Width: | Height: | Size: 568 B |
BIN
debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/refresh_mem.gif
Normal file
After Width: | Height: | Size: 170 B |
|
@ -64,6 +64,10 @@ public class CDebugImages
|
||||||
|
|
||||||
public static final String IMG_LCL_TYPE_NAMES = NAME_PREFIX + "tnames_co.gif"; //$NON-NLS-1$
|
public static final String IMG_LCL_TYPE_NAMES = NAME_PREFIX + "tnames_co.gif"; //$NON-NLS-1$
|
||||||
public static final String IMG_LCL_CHANGE_REGISTER_VALUE = NAME_PREFIX + "change_reg_value_co.gif"; //$NON-NLS-1$
|
public static final String IMG_LCL_CHANGE_REGISTER_VALUE = NAME_PREFIX + "change_reg_value_co.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_LCL_AUTO_REFRESH_MEMORY = NAME_PREFIX + "autorefresh_mem.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_LCL_REFRESH_MEMORY = NAME_PREFIX + "refresh_mem.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_LCL_MEMORY_SAVE = NAME_PREFIX + "memory_save.gif"; //$NON-NLS-1$
|
||||||
|
public static final String IMG_LCL_MEMORY_CLEAR = NAME_PREFIX + "memory_clear.gif"; //$NON-NLS-1$
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set of predefined Image Descriptors.
|
* Set of predefined Image Descriptors.
|
||||||
|
|
|
@ -25,6 +25,7 @@ public interface ICDebugHelpContextIds
|
||||||
// Actions
|
// Actions
|
||||||
public static final String CHANGE_REGISTER_VALUE_ACTION = PREFIX + "change_register_value_action_context"; //$NON-NLS-1$
|
public static final String CHANGE_REGISTER_VALUE_ACTION = PREFIX + "change_register_value_action_context"; //$NON-NLS-1$
|
||||||
public static final String SHOW_TYPES_ACTION = PREFIX + "show_types_action_context"; //$NON-NLS-1$
|
public static final String SHOW_TYPES_ACTION = PREFIX + "show_types_action_context"; //$NON-NLS-1$
|
||||||
|
public static final String REFRESH_MEMORY_ACTION = PREFIX + "refresh_memory_action_context"; //$NON-NLS-1$
|
||||||
|
|
||||||
// Views
|
// Views
|
||||||
public static final String REGISTERS_VIEW = PREFIX + "registers_view_context"; //$NON-NLS-1$
|
public static final String REGISTERS_VIEW = PREFIX + "registers_view_context"; //$NON-NLS-1$
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
*(c) Copyright QNX Software Systems Ltd. 2002.
|
||||||
|
* All Rights Reserved.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.views.memory.MemoryViewer;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.actions.SelectionProviderAction;
|
||||||
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since: Oct 18, 2002
|
||||||
|
*/
|
||||||
|
public class RefreshMemoryAction extends SelectionProviderAction
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor for RefreshMemoryAction.
|
||||||
|
* @param provider
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public RefreshMemoryAction( MemoryViewer viewer )
|
||||||
|
{
|
||||||
|
super( viewer, "Refresh Memory Block" );
|
||||||
|
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_REFRESH_MEMORY );
|
||||||
|
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.REFRESH_MEMORY_ACTION );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(IStructuredSelection)
|
||||||
|
*/
|
||||||
|
public void selectionChanged( IStructuredSelection selection )
|
||||||
|
{
|
||||||
|
super.selectionChanged( selection );
|
||||||
|
}
|
||||||
|
}
|
|
@ -170,7 +170,7 @@ public class MemoryControlArea extends Composite
|
||||||
{
|
{
|
||||||
setMemoryManager( ( input instanceof ICMemoryManager ) ? (ICMemoryManager)input : null );
|
setMemoryManager( ( input instanceof ICMemoryManager ) ? (ICMemoryManager)input : null );
|
||||||
getPresentation().setMemoryBlock( getMemoryBlock() );
|
getPresentation().setMemoryBlock( getMemoryBlock() );
|
||||||
setAddressTextState();
|
setState();
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,6 +245,7 @@ public class MemoryControlArea extends Composite
|
||||||
getPaddingChar() ) );
|
getPaddingChar() ) );
|
||||||
getPresentation().setMemoryBlock( getMemoryBlock() );
|
getPresentation().setMemoryBlock( getMemoryBlock() );
|
||||||
}
|
}
|
||||||
|
setMemoryTextState();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBlock() throws DebugException
|
private void removeBlock() throws DebugException
|
||||||
|
@ -254,6 +255,7 @@ public class MemoryControlArea extends Composite
|
||||||
getMemoryManager().removeBlock( getIndex() );
|
getMemoryManager().removeBlock( getIndex() );
|
||||||
getPresentation().setMemoryBlock( null );
|
getPresentation().setMemoryBlock( null );
|
||||||
}
|
}
|
||||||
|
setMemoryTextState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFormat()
|
public int getFormat()
|
||||||
|
@ -311,8 +313,19 @@ public class MemoryControlArea extends Composite
|
||||||
fAddressText.setEnabled( enable );
|
fAddressText.setEnabled( enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setAddressTextState()
|
protected void setState()
|
||||||
{
|
{
|
||||||
enableAddressText( getMemoryManager() != null );
|
enableAddressText( getMemoryManager() != null );
|
||||||
|
setMemoryTextState();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setMemoryTextState()
|
||||||
|
{
|
||||||
|
fMemoryText.setEditable( getMemoryManager() != null && getMemoryBlock() != null );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected MemoryText getMemoryText()
|
||||||
|
{
|
||||||
|
return fMemoryText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.views.memory;
|
package org.eclipse.cdt.debug.internal.ui.views.memory;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
import org.eclipse.cdt.debug.core.IFormattedMemoryBlock;
|
||||||
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
|
import org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow;
|
||||||
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
|
||||||
|
@ -64,14 +66,14 @@ public class MemoryPresentation
|
||||||
{
|
{
|
||||||
fAddressZones.clear();
|
fAddressZones.clear();
|
||||||
IFormattedMemoryBlockRow[] rows = ( getMemoryBlock() != null ) ? getMemoryBlock().getRows() : new IFormattedMemoryBlockRow[0];
|
IFormattedMemoryBlockRow[] rows = ( getMemoryBlock() != null ) ? getMemoryBlock().getRows() : new IFormattedMemoryBlockRow[0];
|
||||||
String text = new String();
|
StringBuffer sb = new StringBuffer();
|
||||||
for ( int i = 0; i < rows.length; ++i )
|
for ( int i = 0; i < rows.length; ++i )
|
||||||
{
|
{
|
||||||
int offset = text.length();
|
int offset = sb.length();
|
||||||
text += getRowText( rows[i] );
|
sb.append( getRowText( rows[i] ) );
|
||||||
fAddressZones.add( new Point( offset, offset + getAddressLength() ) );
|
fAddressZones.add( new Point( offset, offset + getAddressLength() ) );
|
||||||
}
|
}
|
||||||
return text;
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemSize( int offset )
|
public int getItemSize( int offset )
|
||||||
|
@ -90,7 +92,11 @@ public class MemoryPresentation
|
||||||
|
|
||||||
public boolean isAcceptable( char ch, int offset )
|
public boolean isAcceptable( char ch, int offset )
|
||||||
{
|
{
|
||||||
|
if ( isInAsciiArea( offset ) )
|
||||||
return true;
|
return true;
|
||||||
|
if ( isInDataArea( offset ) )
|
||||||
|
return isValidValue( ch );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point[] getAddressZones()
|
public Point[] getAddressZones()
|
||||||
|
@ -121,8 +127,7 @@ public class MemoryPresentation
|
||||||
private String getInterval( int length )
|
private String getInterval( int length )
|
||||||
{
|
{
|
||||||
char[] chars = new char[length];
|
char[] chars = new char[length];
|
||||||
for ( int i = 0; i < chars.length; ++i )
|
Arrays.fill( chars, ' ' );
|
||||||
chars[i] = ' ';
|
|
||||||
return new String( chars );
|
return new String( chars );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,13 +138,19 @@ public class MemoryPresentation
|
||||||
|
|
||||||
private String getRowText( IFormattedMemoryBlockRow row )
|
private String getRowText( IFormattedMemoryBlockRow row )
|
||||||
{
|
{
|
||||||
String result = getAddressString( row.getAddress() ) +
|
StringBuffer result = new StringBuffer( getRowLength() );
|
||||||
getInterval( INTERVAL_BETWEEN_ADDRESS_AND_DATA );
|
result.append( getAddressString( row.getAddress() ) );
|
||||||
|
result.append( getInterval( INTERVAL_BETWEEN_ADDRESS_AND_DATA ) );
|
||||||
String[] items = row.getData();
|
String[] items = row.getData();
|
||||||
for ( int i = 0; i < items.length; ++i )
|
for ( int i = 0; i < items.length; ++i )
|
||||||
result += items[i] + getInterval( INTERVAL_BETWEEN_DATA_ITEMS );
|
{
|
||||||
result += getInterval( INTERVAL_BETWEEN_DATA_AND_ASCII ) + row.getASCII() + '\n';
|
result.append( items[i] );
|
||||||
return result;
|
result.append( getInterval( INTERVAL_BETWEEN_DATA_ITEMS ) );
|
||||||
|
}
|
||||||
|
result.append( getInterval( INTERVAL_BETWEEN_DATA_AND_ASCII ) );
|
||||||
|
result.append( row.getASCII() );
|
||||||
|
result.append( '\n' );
|
||||||
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -228,39 +239,126 @@ public class MemoryPresentation
|
||||||
chars[i] = ch;
|
chars[i] = ch;
|
||||||
return String.valueOf( chars ).concat( item );
|
return String.valueOf( chars ).concat( item );
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
private int getRowLength()
|
private int getRowLength()
|
||||||
{
|
{
|
||||||
return getAddressLength() +
|
return getAddressLength() +
|
||||||
INTERVAL_BETWEEN_ADDRESS_AND_DATA +
|
INTERVAL_BETWEEN_ADDRESS_AND_DATA +
|
||||||
(getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) * getNumberOfDataItems() +
|
(getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) * getNumberOfDataItems() +
|
||||||
( ( displayASCII() ) ? INTERVAL_BETWEEN_DATA_AND_ASCII +
|
( ( displayASCII() ) ? INTERVAL_BETWEEN_DATA_AND_ASCII +
|
||||||
getBytesPerRow() : 0 ) + 1;
|
getDataBytesPerRow() : 0 ) + 1;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
private int getAddressLength()
|
private int getAddressLength()
|
||||||
{
|
{
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
|
private boolean isInAddressZone( int offset )
|
||||||
|
{
|
||||||
|
if ( getRowLength() != 0 )
|
||||||
|
{
|
||||||
|
int pos = offset % getRowLength();
|
||||||
|
return ( pos >= 0 && pos < getAddressLength() );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInAsciiArea( int offset )
|
||||||
|
{
|
||||||
|
if ( displayASCII() && getRowLength() != 0 )
|
||||||
|
{
|
||||||
|
int pos = offset % getRowLength();
|
||||||
|
int asciiColumn = getAddressLength() +
|
||||||
|
INTERVAL_BETWEEN_ADDRESS_AND_DATA +
|
||||||
|
(getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS ) * getNumberOfDataItems() +
|
||||||
|
INTERVAL_BETWEEN_DATA_AND_ASCII;
|
||||||
|
return ( pos >= asciiColumn && pos < getRowLength() - 1 );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInDataArea( int offset )
|
||||||
|
{
|
||||||
|
if ( getRowLength() != 0 )
|
||||||
|
{
|
||||||
|
int pos = offset % getRowLength();
|
||||||
|
int dataBegin = getAddressLength() + INTERVAL_BETWEEN_ADDRESS_AND_DATA;
|
||||||
|
int dataEnd = dataBegin + ((getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS ) * getNumberOfDataItems());
|
||||||
|
if ( pos >= dataBegin && pos < dataEnd )
|
||||||
|
return isInDataItem( pos - dataBegin );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInDataItem( int pos )
|
||||||
|
{
|
||||||
|
for ( int i = 0; i < getNumberOfDataItems(); ++i )
|
||||||
|
{
|
||||||
|
if ( pos < i * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) )
|
||||||
|
return false;
|
||||||
|
if ( pos >= i * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) &&
|
||||||
|
pos < (i * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS)) + getDataItemLength() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private int getDataItemLength()
|
private int getDataItemLength()
|
||||||
{
|
{
|
||||||
int result = 0;
|
if ( getMemoryBlock() != null )
|
||||||
switch( getFormat() )
|
return getMemoryBlock().getWordSize() * 2;
|
||||||
{
|
return 0;
|
||||||
case ICDebugUIInternalConstants.MEMORY_FORMAT_HEX:
|
|
||||||
result = 2 * getSize();
|
|
||||||
break;
|
|
||||||
case ICDebugUIInternalConstants.MEMORY_FORMAT_BINARY:
|
|
||||||
result = 8 * getSize();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getNumberOfDataItems()
|
private int getNumberOfDataItems()
|
||||||
{
|
{
|
||||||
return getBytesPerRow() / getSize();
|
if ( getMemoryBlock() != null )
|
||||||
|
return getMemoryBlock().getNumberOfColumns();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean displayASCII()
|
||||||
|
{
|
||||||
|
if ( getMemoryBlock() != null )
|
||||||
|
return getMemoryBlock().displayASCII();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getDataBytesPerRow()
|
||||||
|
{
|
||||||
|
if ( getMemoryBlock() != null )
|
||||||
|
return getMemoryBlock().getNumberOfColumns() * getMemoryBlock().getWordSize();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isValidValue( char ch )
|
||||||
|
{
|
||||||
|
switch( getDataFormat() )
|
||||||
|
{
|
||||||
|
case ICMemoryManager.MEMORY_FORMAT_HEX:
|
||||||
|
return isHexadecimal( ch );
|
||||||
|
case ICMemoryManager.MEMORY_FORMAT_BINARY:
|
||||||
|
case ICMemoryManager.MEMORY_FORMAT_OCTAL:
|
||||||
|
case ICMemoryManager.MEMORY_FORMAT_SIGNED_DECIMAL:
|
||||||
|
case ICMemoryManager.MEMORY_FORMAT_UNSIGNED_DECIMAL:
|
||||||
|
case -1:
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isHexadecimal( char ch )
|
||||||
|
{
|
||||||
|
return ( Character.isDigit( ch ) ||
|
||||||
|
( ch >= 'a' && ch <= 'f' ) ||
|
||||||
|
( ch >= 'A' && ch <= 'F' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getDataFormat()
|
||||||
|
{
|
||||||
|
if ( getMemoryBlock() != null )
|
||||||
|
return getMemoryBlock().getFormat();
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.swt.graphics.FontData;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -142,8 +143,19 @@ public class MemoryText
|
||||||
if ( event.character == SWT.LF ||
|
if ( event.character == SWT.LF ||
|
||||||
event.character == SWT.CR ||
|
event.character == SWT.CR ||
|
||||||
event.character == SWT.BS ||
|
event.character == SWT.BS ||
|
||||||
event.character == SWT.DEL ||
|
event.character == SWT.DEL )
|
||||||
!fPresentation.isAcceptable( event.character, fText.getCaretOffset() ) )
|
{
|
||||||
|
event.doit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( Character.isISOControl( event.character ) )
|
||||||
|
return;
|
||||||
|
if ( getSelectionCount() != 0 )
|
||||||
|
{
|
||||||
|
event.doit = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( !fPresentation.isAcceptable( event.character, fText.getCaretOffset() ) )
|
||||||
event.doit = false;
|
event.doit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,4 +243,19 @@ public class MemoryText
|
||||||
getBackgroundColor() ) );
|
getBackgroundColor() ) );
|
||||||
fText.setStyleRanges( (StyleRange[])list.toArray( new StyleRange[list.size()] ) );
|
fText.setStyleRanges( (StyleRange[])list.toArray( new StyleRange[list.size()] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setEditable( boolean editable )
|
||||||
|
{
|
||||||
|
fText.setEditable( editable );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int getSelectionCount()
|
||||||
|
{
|
||||||
|
return fText.getSelectionCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Control getControl()
|
||||||
|
{
|
||||||
|
return fText;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,17 @@ package org.eclipse.cdt.debug.internal.ui.views.memory;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
import org.eclipse.cdt.debug.core.ICMemoryManager;
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.actions.RefreshMemoryAction;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandlerView;
|
||||||
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
import org.eclipse.cdt.debug.internal.ui.views.IDebugExceptionHandler;
|
||||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
||||||
import org.eclipse.debug.core.DebugException;
|
import org.eclipse.debug.core.DebugException;
|
||||||
import org.eclipse.debug.core.model.IDebugElement;
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
import org.eclipse.debug.ui.IDebugModelPresentation;
|
import org.eclipse.debug.ui.IDebugModelPresentation;
|
||||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
|
@ -25,6 +28,7 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.ui.ISelectionListener;
|
import org.eclipse.ui.ISelectionListener;
|
||||||
import org.eclipse.ui.IWorkbenchActionConstants;
|
import org.eclipse.ui.IWorkbenchActionConstants;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
@ -64,6 +68,10 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
*/
|
*/
|
||||||
protected void createActions()
|
protected void createActions()
|
||||||
{
|
{
|
||||||
|
IAction action = new RefreshMemoryAction( (MemoryViewer)getViewer() );
|
||||||
|
action.setEnabled( false );
|
||||||
|
setAction( "RefreshMemory", action ); //$NON-NLS-1$
|
||||||
|
|
||||||
// set initial content here, as viewer has to be set
|
// set initial content here, as viewer has to be set
|
||||||
setInitialContent();
|
setInitialContent();
|
||||||
}
|
}
|
||||||
|
@ -81,6 +89,10 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
*/
|
*/
|
||||||
protected void fillContextMenu( IMenuManager menu )
|
protected void fillContextMenu( IMenuManager menu )
|
||||||
{
|
{
|
||||||
|
menu.add( new Separator( ICDebugUIConstants.EMPTY_MEMORY_GROUP ) );
|
||||||
|
menu.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
||||||
|
menu.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +101,9 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
*/
|
*/
|
||||||
protected void configureToolBar( IToolBarManager tbm )
|
protected void configureToolBar( IToolBarManager tbm )
|
||||||
{
|
{
|
||||||
|
tbm.add( new Separator( this.getClass().getName() ) );
|
||||||
|
tbm.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
||||||
|
tbm.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -192,4 +207,12 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
setViewerInput( null );
|
setViewerInput( null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.debug.ui.AbstractDebugView#createContextMenu(Control)
|
||||||
|
*/
|
||||||
|
protected void createContextMenu( Control menuControl )
|
||||||
|
{
|
||||||
|
super.createContextMenu( ((MemoryControlArea)((MemoryViewer)getViewer()).getTabFolder().getSelection().getControl()).getMemoryText().getControl() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
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.CTabItem;
|
import org.eclipse.swt.custom.CTabItem;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -63,6 +65,16 @@ public class MemoryViewer extends ContentViewer
|
||||||
fMemoryControlAreas[i] = new MemoryControlArea( fTabFolder, SWT.NONE, i );
|
fMemoryControlAreas[i] = new MemoryControlArea( fTabFolder, SWT.NONE, i );
|
||||||
tabItem.setControl( fMemoryControlAreas[i] );
|
tabItem.setControl( fMemoryControlAreas[i] );
|
||||||
}
|
}
|
||||||
|
fTabFolder.addSelectionListener( new SelectionListener()
|
||||||
|
{
|
||||||
|
public void widgetSelected( SelectionEvent e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void widgetDefaultSelected( SelectionEvent e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
} );
|
||||||
fTabFolder.setSelection( 0 );
|
fTabFolder.setSelection( 0 );
|
||||||
}
|
}
|
||||||
return fControl;
|
return fControl;
|
||||||
|
@ -103,4 +115,9 @@ public class MemoryViewer extends ContentViewer
|
||||||
for ( int i = 0; i < fMemoryControlAreas.length; ++i )
|
for ( int i = 0; i < fMemoryControlAreas.length; ++i )
|
||||||
fMemoryControlAreas[i].setInput( (ICMemoryManager)input );
|
fMemoryControlAreas[i].setInput( (ICMemoryManager)input );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CTabFolder getTabFolder()
|
||||||
|
{
|
||||||
|
return fTabFolder;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,15 @@ public interface ICDebugUIConstants
|
||||||
* Identifier for a register group in a menu (value <code>"registerGroup"</code>).
|
* Identifier for a register group in a menu (value <code>"registerGroup"</code>).
|
||||||
*/
|
*/
|
||||||
public static final String REGISTER_GROUP = "registerGroup"; //$NON-NLS-1$
|
public static final String REGISTER_GROUP = "registerGroup"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for an empty group preceeding a
|
||||||
|
* memory group in a menu (value <code>"emptyMemoryGroup"</code>).
|
||||||
|
*/
|
||||||
|
public static final String EMPTY_MEMORY_GROUP = "emptyMemoryGroup"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Identifier for a memory group in a menu (value <code>"memoryGroup"</code>).
|
||||||
|
*/
|
||||||
|
public static final String MEMORY_GROUP = "memoryGroup"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|