Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] The 'Auto-Refresh' and 'Refresh' actions added to the 'Shared Libraries' view

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.96
diff -u -r1.96 ChangeLog
--- ChangeLog 9 Feb 2003 21:22:25 -0000 1.96
+++ ChangeLog 10 Feb 2003 23:39:11 -0000
@@ -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
Index: src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java,v
retrieving revision 1.15
diff -u -r1.15 CDebugImages.java
--- src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java 31 Jan 2003 22:38:15 -0000 1.15
+++ src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java 10 Feb 2003 23:39:11 -0000
@@ -71,8 +71,8 @@
 
  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$
Index: src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java,v
retrieving revision 1.11
diff -u -r1.11 ICDebugHelpContextIds.java
--- src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java 7 Feb 2003 23:38:25 -0000 1.11
+++ src/org/eclipse/cdt/debug/internal/ui/ICDebugHelpContextIds.java 10 Feb 2003 23:39:11 -0000
@@ -30,6 +30,8 @@
  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$
Index: src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshAction.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshAction.java
diff -N src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshAction.java 10 Feb 2003 23:39:12 -0000
@@ -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() );
+   }
+  }
+ }
+}
Index: src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshMemoryAction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshMemoryAction.java,v
retrieving revision 1.1
diff -u -r1.1 AutoRefreshMemoryAction.java
--- src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshMemoryAction.java 21 Oct 2002 20:59:13 -0000 1.1
+++ src/org/eclipse/cdt/debug/internal/ui/actions/AutoRefreshMemoryAction.java 10 Feb 2003 23:39:12 -0000
@@ -30,7 +30,7 @@
  {
   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 );
Index: src/org/eclipse/cdt/debug/internal/ui/actions/RefreshAction.java
===================================================================
RCS file: src/org/eclipse/cdt/debug/internal/ui/actions/RefreshAction.java
diff -N src/org/eclipse/cdt/debug/internal/ui/actions/RefreshAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ src/org/eclipse/cdt/debug/internal/ui/actions/RefreshAction.java 10 Feb 2003 23:39:12 -0000
@@ -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() );
+    }
+   }
+  }
+ }
+}
Index: src/org/eclipse/cdt/debug/internal/ui/actions/RefreshMemoryAction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/RefreshMemoryAction.java,v
retrieving revision 1.3
diff -u -r1.3 RefreshMemoryAction.java
--- src/org/eclipse/cdt/debug/internal/ui/actions/RefreshMemoryAction.java 30 Oct 2002 23:39:31 -0000 1.3
+++ src/org/eclipse/cdt/debug/internal/ui/actions/RefreshMemoryAction.java 10 Feb 2003 23:39:12 -0000
@@ -30,7 +30,7 @@
  {
   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 );
Index: src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java,v
retrieving revision 1.5
diff -u -r1.5 SharedLibrariesView.java
--- src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java 7 Feb 2003 22:03:51 -0000 1.5
+++ src/org/eclipse/cdt/debug/internal/ui/views/sharedlibs/SharedLibrariesView.java 10 Feb 2003 23:39:12 -0000
@@ -9,14 +9,21 @@
 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.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 @@
   */
  protected void createActions()
  {
+  IAction action = "" 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 = "" 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 @@
   */
  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 @@
  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)
Index: src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java,v
retrieving revision 1.6
diff -u -r1.6 ICDebugUIConstants.java
--- src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java 24 Oct 2002 23:16:01 -0000 1.6
+++ src/org/eclipse/cdt/debug/ui/ICDebugUIConstants.java 10 Feb 2003 23:39:12 -0000
@@ -70,4 +70,16 @@
   * 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$
 }

Back to the top