Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Fixes for the 'Add Global Variables' action's bugs

Fixes for the 'Add Global Variables' action's bugs.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision 1.32
diff -u -r1.32 ChangeLog
--- ChangeLog 16 Nov 2002 00:52:09 -0000 1.32
+++ ChangeLog 18 Nov 2002 23:05:07 -0000
@@ -1,3 +1,9 @@
+2002-11-18 Mikhail Khodjaiants
+ Fixes for the 'Add Global Variables' action's bugs.
+ The action disabled after 'Remove All'.
+ Error message after adding a valid _expression_.
+ * AddGlobalsActionDelegate.java
+
 2002-11-15 Mikhail Khodjaiants
  Added presentation for dummy stack frames.
  * CDTDebugModelPresentation.java
Index: src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java,v
retrieving revision 1.1
diff -u -r1.1 AddGlobalsActionDelegate.java
--- src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java 5 Nov 2002 20:26:57 -0000 1.1
+++ src/org/eclipse/cdt/debug/internal/ui/actions/AddGlobalsActionDelegate.java 18 Nov 2002 23:05:07 -0000
@@ -23,7 +23,6 @@
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.custom.BusyIndicator;
 import org.eclipse.swt.widgets.Display;
@@ -113,7 +112,15 @@
  {
   if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) )
   {
-   update( getAction(), selection );
+   if ( selection instanceof IStructuredSelection )
+   {
+    setSelection( (IStructuredSelection)selection );
+   }
+   else
+   {
+    setSelection( null );
+   }
+   update( getAction() );
   }
  }
 
@@ -133,6 +140,7 @@
             try
             {
              doAction( selection.getFirstElement() );
+             setStatus( null );
             }
             catch( DebugException e )
             {
@@ -162,22 +170,19 @@
   setAction( action );
   if ( getView() != null )
   {
-   update( action, selection );
+   update( action );
   }
  }
 
- protected void update( IAction action, ISelection s )
+ protected void update( IAction action )
  {
-  if ( action != null && s instanceof IStructuredSelection )
+  if ( action != null )
   {
-   IStructuredSelection ss = (IStructuredSelection)s;
-   action.setEnabled( getEnableStateForSelection( ss ) );
-   setSelection( ss );
+   action.setEnabled( getEnableStateForSelection( getSelection() ) );
   }
   else
   {
    action.setEnabled( false );
-   setSelection( StructuredSelection.EMPTY );
   }
  }
 
@@ -261,7 +266,7 @@
 
  protected boolean getEnableStateForSelection( IStructuredSelection selection )
  {
-  if ( selection.size() != 1 )
+  if ( selection == null || selection.size() != 1 )
   {
    return false;
   }


Back to the top