mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Implementation of the "Clear" action for the memory view.
This commit is contained in:
parent
64c34799f5
commit
80238aadc8
6 changed files with 83 additions and 0 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2002-10-21 Mikhail Khodjaiants
|
||||||
|
Implementation of the "Clear" action for the memory view.
|
||||||
|
* ClearMemoryAction.java
|
||||||
|
* ICDebugHelpContextIds.java
|
||||||
|
* MemoryControlArea.java
|
||||||
|
* MemoryView.java
|
||||||
|
* MemoryViewer.java
|
||||||
|
|
||||||
2002-10-21 Mikhail Khodjaiants
|
2002-10-21 Mikhail Khodjaiants
|
||||||
Implementation of the "Auto-Refresh" and "Refresh" actions for the memory view.
|
Implementation of the "Auto-Refresh" and "Refresh" actions for the memory view.
|
||||||
* AutoRefreshMemoryAction.java
|
* AutoRefreshMemoryAction.java
|
||||||
|
|
|
@ -27,6 +27,7 @@ public interface ICDebugHelpContextIds
|
||||||
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$
|
public static final String REFRESH_MEMORY_ACTION = PREFIX + "refresh_memory_action_context"; //$NON-NLS-1$
|
||||||
public static final String AUTO_REFRESH_MEMORY_ACTION = PREFIX + "auto_refresh_memory_action_context"; //$NON-NLS-1$
|
public static final String AUTO_REFRESH_MEMORY_ACTION = PREFIX + "auto_refresh_memory_action_context"; //$NON-NLS-1$
|
||||||
|
public static final String MEMORY_CLEAR_ACTION = PREFIX + "memory_clear_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,54 @@
|
||||||
|
/*
|
||||||
|
*(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.ui.actions.SelectionProviderAction;
|
||||||
|
import org.eclipse.ui.help.WorkbenchHelp;
|
||||||
|
import org.eclipse.ui.texteditor.IUpdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter type comment.
|
||||||
|
*
|
||||||
|
* @since: Oct 21, 2002
|
||||||
|
*/
|
||||||
|
public class ClearMemoryAction extends SelectionProviderAction implements IUpdate
|
||||||
|
{
|
||||||
|
private MemoryViewer fMemoryViewer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor for ClearMemoryAction.
|
||||||
|
* @param provider
|
||||||
|
* @param text
|
||||||
|
*/
|
||||||
|
public ClearMemoryAction( MemoryViewer viewer )
|
||||||
|
{
|
||||||
|
super( viewer, "Clear" );
|
||||||
|
fMemoryViewer = viewer;
|
||||||
|
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_MEMORY_CLEAR );
|
||||||
|
setDescription( "Clear Memory Block" );
|
||||||
|
setToolTipText( "Clear" );
|
||||||
|
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.MEMORY_CLEAR_ACTION );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.ui.texteditor.IUpdate#update()
|
||||||
|
*/
|
||||||
|
public void update()
|
||||||
|
{
|
||||||
|
setEnabled( fMemoryViewer.canUpdate() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.jface.action.IAction#run()
|
||||||
|
*/
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
fMemoryViewer.clear();
|
||||||
|
}
|
||||||
|
}
|
|
@ -331,4 +331,10 @@ public class MemoryControlArea extends Composite
|
||||||
{
|
{
|
||||||
return fMemoryText;
|
return fMemoryText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void clear()
|
||||||
|
{
|
||||||
|
fAddressText.setText( "" );
|
||||||
|
handleAddressEnter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ 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.AutoRefreshMemoryAction;
|
import org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshMemoryAction;
|
||||||
|
import org.eclipse.cdt.debug.internal.ui.actions.ClearMemoryAction;
|
||||||
import org.eclipse.cdt.debug.internal.ui.actions.RefreshMemoryAction;
|
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;
|
||||||
|
@ -80,6 +81,11 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
setAction( "AutoRefreshMemory", action ); //$NON-NLS-1$
|
setAction( "AutoRefreshMemory", action ); //$NON-NLS-1$
|
||||||
add( (AutoRefreshMemoryAction)action );
|
add( (AutoRefreshMemoryAction)action );
|
||||||
|
|
||||||
|
action = new ClearMemoryAction( (MemoryViewer)getViewer() );
|
||||||
|
action.setEnabled( false );
|
||||||
|
setAction( "ClearMemory", action ); //$NON-NLS-1$
|
||||||
|
add( (ClearMemoryAction)action );
|
||||||
|
|
||||||
// set initial content here, as viewer has to be set
|
// set initial content here, as viewer has to be set
|
||||||
setInitialContent();
|
setInitialContent();
|
||||||
}
|
}
|
||||||
|
@ -101,6 +107,7 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
menu.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
menu.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
||||||
menu.add( getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
menu.add( getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
||||||
menu.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
menu.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||||
|
menu.add( getAction( "ClearMemory" ) ); //$NON-NLS-1$
|
||||||
|
|
||||||
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
|
||||||
}
|
}
|
||||||
|
@ -114,6 +121,7 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
tbm.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
tbm.add( new Separator( ICDebugUIConstants.MEMORY_GROUP ) );
|
||||||
tbm.add( getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
tbm.add( getAction( "AutoRefreshMemory" ) ); //$NON-NLS-1$
|
||||||
tbm.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
tbm.add( getAction( "RefreshMemory" ) ); //$NON-NLS-1$
|
||||||
|
tbm.add( getAction( "ClearMemory" ) ); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -150,6 +158,7 @@ public class MemoryView extends AbstractDebugEventHandlerView
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
|
remove( (ClearMemoryAction)getAction( "ClearMemory" ) );
|
||||||
remove( (RefreshMemoryAction)getAction( "RefreshMemory" ) );
|
remove( (RefreshMemoryAction)getAction( "RefreshMemory" ) );
|
||||||
remove( (AutoRefreshMemoryAction)getAction( "AutoRefreshMemory" ) );
|
remove( (AutoRefreshMemoryAction)getAction( "AutoRefreshMemory" ) );
|
||||||
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
getSite().getPage().removeSelectionListener( IDebugUIConstants.ID_DEBUG_VIEW, this );
|
||||||
|
|
|
@ -182,4 +182,9 @@ public class MemoryViewer extends ContentViewer
|
||||||
block.setFrozen( frozen );
|
block.setFrozen( frozen );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
((MemoryControlArea)fTabFolder.getSelection().getControl()).clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue