1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

The 'Auto-Refresh' and 'Refresh' actions added to the 'Shared Libraries' view.

This commit is contained in:
Mikhail Khodjaiants 2003-02-10 23:40:08 +00:00
parent f5cebfdef5
commit ee9110f2e4
9 changed files with 201 additions and 4 deletions

View file

@ -1,3 +1,13 @@
2003-02-10 Mikhail Khodjaiants
The 'Auto-Refresh' and 'Refresh' actions added to the 'Shared Libraries' view.
* RefreshAction.java: new
* AutoRefreshAction.java: new
* RefreshMemoryAction.java
* AutoRefreshMemoryAction.java
* SharedLibrariesView.java
* CDebugImages.java
* ICDebugHelpContextIds.java
2003-02-09 Alain Magloire
Changing the scope of methods to protected to let inner class

View file

@ -71,8 +71,8 @@ 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_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_AUTO_REFRESH = NAME_PREFIX + "autorefresh_mem.gif"; //$NON-NLS-1$
public static final String IMG_LCL_REFRESH = NAME_PREFIX + "refresh_mem.gif"; //$NON-NLS-1$
public static final String IMG_LCL_MEMORY_SAVE = NAME_PREFIX + "memory_update.gif"; //$NON-NLS-1$
public static final String IMG_LCL_MEMORY_CLEAR = NAME_PREFIX + "memory_clear.gif"; //$NON-NLS-1$
public static final String IMG_LCL_SHOW_ASCII = NAME_PREFIX + "show_ascii.gif"; //$NON-NLS-1$

View file

@ -30,6 +30,8 @@ public interface ICDebugHelpContextIds
public static final String MEMORY_CLEAR_ACTION = PREFIX + "memory_clear_action_context"; //$NON-NLS-1$
public static final String MEMORY_SAVE_ACTION = PREFIX + "memory_save_action_context"; //$NON-NLS-1$
public static final String MEMORY_SHOW_ASCII_ACTION = PREFIX + "memory_show_ascii_action_context"; //$NON-NLS-1$
public static final String REFRESH_SHARED_LIBRARIES_ACTION = PREFIX + "refresh_shared_libraries_action_context"; //$NON-NLS-1$
public static final String AUTO_REFRESH_SHARED_LIBRARIES_ACTION = PREFIX + "auto_refresh_shared_libraries_action_context"; //$NON-NLS-1$
// Views
public static final String REGISTERS_VIEW = PREFIX + "registers_view_context"; //$NON-NLS-1$

View file

@ -0,0 +1,65 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.ICUpdateManager;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.texteditor.IUpdate;
/**
* Enter type comment.
*
* @since: Feb 10, 2003
*/
public class AutoRefreshAction extends Action implements IUpdate
{
private Viewer fViewer = null;
/**
* Constructor for AutoRefreshAction.
*/
public AutoRefreshAction( Viewer viewer, String text )
{
super( text );
fViewer = viewer;
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
{
ICUpdateManager uman = (ICUpdateManager)((IAdaptable)fViewer.getInput()).getAdapter( ICUpdateManager.class );
if ( uman != null )
{
setEnabled( uman.canUpdate() );
setChecked( uman.getAutoModeEnabled() );
return;
}
}
setEnabled( false );
setChecked( false );
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
{
ICUpdateManager uman = (ICUpdateManager)((IAdaptable)fViewer.getInput()).getAdapter( ICUpdateManager.class );
if ( uman != null )
{
uman.setAutoModeEnabled( isChecked() );
}
}
}
}

View file

@ -30,7 +30,7 @@ public class AutoRefreshMemoryAction extends SelectionProviderAction implements
{
super( viewer, "Auto-Refresh" );
fMemoryViewer = viewer;
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_AUTO_REFRESH_MEMORY );
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_AUTO_REFRESH );
setDescription( "Automatically Refresh Memory Block" );
setToolTipText( "Auto-Refresh" );
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.AUTO_REFRESH_MEMORY_ACTION );

View file

@ -0,0 +1,72 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.debug.core.ICUpdateManager;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.texteditor.IUpdate;
/**
* Enter type comment.
*
* @since: Feb 10, 2003
*/
public class RefreshAction extends Action implements IUpdate
{
private Viewer fViewer = null;
/**
* Constructor for RefreshAction.
*/
public RefreshAction( Viewer viewer, String text )
{
super( text );
fViewer = viewer;
}
/* (non-Javadoc)
* @see org.eclipse.ui.texteditor.IUpdate#update()
*/
public void update()
{
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
{
ICUpdateManager uman = (ICUpdateManager)((IAdaptable)fViewer.getInput()).getAdapter( ICUpdateManager.class );
if ( uman != null )
{
setEnabled( uman.canUpdate() );
return;
}
}
setEnabled( false );
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.IAction#run()
*/
public void run()
{
if ( fViewer != null && fViewer.getInput() instanceof IAdaptable )
{
ICUpdateManager uman = (ICUpdateManager)((IAdaptable)fViewer.getInput()).getAdapter( ICUpdateManager.class );
if ( uman != null )
{
try
{
uman.update();
}
catch( DebugException e )
{
CDebugUIPlugin.errorDialog( "Unable to refresh shared libraries.", e.getStatus() );
}
}
}
}
}

View file

@ -30,7 +30,7 @@ public class RefreshMemoryAction extends SelectionProviderAction implements IUpd
{
super( viewer, "Refresh" );
fMemoryViewer = viewer;
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_REFRESH_MEMORY );
CDebugImages.setLocalImageDescriptors( this, CDebugImages.IMG_LCL_REFRESH );
setDescription( "Refresh Memory Block" );
setToolTipText( "Refresh" );
WorkbenchHelp.setHelp( this, ICDebugHelpContextIds.REFRESH_MEMORY_ACTION );

View file

@ -9,14 +9,21 @@ import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
import org.eclipse.cdt.debug.internal.ui.CDTDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebugImages;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.internal.ui.PixelConverter;
import org.eclipse.cdt.debug.internal.ui.actions.AutoRefreshAction;
import org.eclipse.cdt.debug.internal.ui.actions.RefreshAction;
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
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.IDebugExceptionHandler;
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.model.IDebugElement;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator;
@ -35,6 +42,7 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.help.WorkbenchHelp;
/**
* Enter type comment.
@ -132,6 +140,25 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
*/
protected void createActions()
{
IAction action = new AutoRefreshAction( getViewer(), "Auto-Refresh" );
CDebugImages.setLocalImageDescriptors( action, CDebugImages.IMG_LCL_AUTO_REFRESH );
action.setDescription( "Automatically Refresh Shared Libraries View" );
action.setToolTipText( "Auto-Refresh" );
WorkbenchHelp.setHelp( action, ICDebugHelpContextIds.AUTO_REFRESH_SHARED_LIBRARIES_ACTION );
action.setEnabled( false );
action.setChecked( CDebugUIPlugin.getDefault().getPreferenceStore().getBoolean( ICDebugPreferenceConstants.PREF_SHARED_LIBRARIES_AUTO_REFRESH ) );
setAction( "AutoRefresh", action ); //$NON-NLS-1$
add( (AutoRefreshAction)action );
action = new RefreshAction( getViewer(), "Refresh" );
CDebugImages.setLocalImageDescriptors( action, CDebugImages.IMG_LCL_REFRESH );
action.setDescription( "Refresh Shared Libraries View" );
action.setToolTipText( "Refresh" );
WorkbenchHelp.setHelp( action, ICDebugHelpContextIds.REFRESH_SHARED_LIBRARIES_ACTION );
action.setEnabled( false );
setAction( "Refresh", action ); //$NON-NLS-1$
add( (RefreshAction)action );
// set initial content here, as viewer has to be set
setInitialContent();
}
@ -149,7 +176,13 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
*/
protected void fillContextMenu( IMenuManager menu )
{
menu.add( new Separator( ICDebugUIConstants.EMPTY_REFRESH_GROUP ) );
menu.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
menu.add( new Separator( IWorkbenchActionConstants.MB_ADDITIONS ) );
menu.appendToGroup( ICDebugUIConstants.REFRESH_GROUP, getAction( "AutoRefresh" ) ); //$NON-NLS-1$
menu.appendToGroup( ICDebugUIConstants.REFRESH_GROUP, getAction( "Refresh" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)
@ -158,6 +191,9 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
protected void configureToolBar( IToolBarManager tbm )
{
tbm.add( new Separator( this.getClass().getName() ) );
tbm.add( new Separator( ICDebugUIConstants.REFRESH_GROUP ) );
tbm.add( getAction( "AutoRefresh" ) ); //$NON-NLS-1$
tbm.add( getAction( "Refresh" ) ); //$NON-NLS-1$
}
/* (non-Javadoc)

View file

@ -70,4 +70,16 @@ public interface ICDebugUIConstants
* Identifier for a format group in a menu (value <code>"formatGroup"</code>).
*/
public static final String FORMAT_GROUP = "formatGroup"; //$NON-NLS-1$
/**
* Identifier for an empty group preceeding a
* refresh group in a menu (value <code>"emptyRefreshGroup"</code>).
*/
public static final String EMPTY_REFRESH_GROUP = "emptyRefreshGroup"; //$NON-NLS-1$
/**
* Identifier for a refresh group in a menu (value <code>"refreshGroup"
* </code>).
*/
public static final String REFRESH_GROUP = "refreshGroup"; //$NON-NLS-1$
}