1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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

This commit is contained in:
Mikhail Khodjaiants 2002-11-18 23:05:58 +00:00
parent 95f0a1bc97
commit f0c0e2418a
2 changed files with 21 additions and 10 deletions

View file

@ -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 2002-11-15 Mikhail Khodjaiants
Added presentation for dummy stack frames. Added presentation for dummy stack frames.
* CDTDebugModelPresentation.java * CDTDebugModelPresentation.java

View file

@ -23,7 +23,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.custom.BusyIndicator; import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -113,7 +112,15 @@ public class AddGlobalsActionDelegate implements IViewActionDelegate,
{ {
if ( part.getSite().getId().equals( IDebugUIConstants.ID_DEBUG_VIEW ) ) 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 @@ public class AddGlobalsActionDelegate implements IViewActionDelegate,
try try
{ {
doAction( selection.getFirstElement() ); doAction( selection.getFirstElement() );
setStatus( null );
} }
catch( DebugException e ) catch( DebugException e )
{ {
@ -162,22 +170,19 @@ public class AddGlobalsActionDelegate implements IViewActionDelegate,
setAction( action ); setAction( action );
if ( getView() != null ) 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( getSelection() ) );
action.setEnabled( getEnableStateForSelection( ss ) );
setSelection( ss );
} }
else else
{ {
action.setEnabled( false ); action.setEnabled( false );
setSelection( StructuredSelection.EMPTY );
} }
} }
@ -261,7 +266,7 @@ public class AddGlobalsActionDelegate implements IViewActionDelegate,
protected boolean getEnableStateForSelection( IStructuredSelection selection ) protected boolean getEnableStateForSelection( IStructuredSelection selection )
{ {
if ( selection.size() != 1 ) if ( selection == null || selection.size() != 1 )
{ {
return false; return false;
} }