1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 17:55:39 +02:00

Fix for bug 51519: Enable 'Format' action if multiple variables are selected.

This commit is contained in:
Mikhail Khodjaiants 2004-02-10 20:15:00 +00:00
parent a69ae2ccf2
commit 7fb590779b
2 changed files with 24 additions and 8 deletions

View file

@ -1,3 +1,7 @@
2004-02-10 Mikhail Khodjaiants
Fix for bug 51519: Enable 'Format' action if multiple variables are selected.
* VariableFormatActionDelegate.java
2004-02-03 Alain Magloire 2004-02-03 Alain Magloire
Derived from a patch by Chris Songer. Derived from a patch by Chris Songer.

View file

@ -54,7 +54,8 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
*/ */
public void run( IAction action ) public void run( IAction action )
{ {
if ( fVariables != null && fVariables.length > 0 ) ICVariable[] vars = getVariables();
if ( vars != null && vars.length > 0 )
{ {
final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(), final MultiStatus ms = new MultiStatus( CDebugUIPlugin.getUniqueIdentifier(),
DebugException.REQUEST_FAILED, "", null ); DebugException.REQUEST_FAILED, "", null );
@ -65,7 +66,7 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
{ {
try try
{ {
doAction( fVariables ); doAction( getVariables() );
} }
catch( DebugException e ) catch( DebugException e )
{ {
@ -109,14 +110,15 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
action.setEnabled( enabled ); action.setEnabled( enabled );
if ( enabled ) if ( enabled )
{ {
action.setChecked( var.getFormat() == fFormat ); action.setChecked( var.getFormat() == fFormat );
list.add(o); list.add(o);
} }
} }
} }
fVariables = new ICVariable[list.size()]; setVariables( (ICVariable[])list.toArray( new ICVariable[list.size()] ) );
list.toArray(fVariables); }
} else { else
{
action.setChecked( false ); action.setChecked( false );
action.setEnabled( false ); action.setEnabled( false );
} }
@ -124,9 +126,19 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
protected void doAction( ICVariable[] vars ) throws DebugException protected void doAction( ICVariable[] vars ) throws DebugException
{ {
for (int i = 0; i < vars.length; i++ ) for( int i = 0; i < vars.length; i++ )
{ {
vars[i].setFormat(fFormat); vars[i].setFormat( fFormat );
} }
} }
protected ICVariable[] getVariables()
{
return fVariables;
}
private void setVariables( ICVariable[] variables )
{
fVariables = variables;
}
} }