1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-22 07:43:56 +02:00

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

This commit is contained in:
Mikhail Khodjaiants 2004-02-10 19:40:26 +00:00
parent 61320a1610
commit 24d0deee30
2 changed files with 1333 additions and 1291 deletions

View file

@ -1,12 +1,18 @@
2004-02-10 Mikhail Khodjaiants
Fix for bug 51519: Enable 'Format' action if multiple variables are selected.
* VariableFormatActionDelegate.java
2004-02-03 Alain Magloire
Derived from a patch by Chris Songer.
Accept multiple selection when doing setting the format variables.
* src/org/eclipse/cdt/debug/internal/ui/actions/VariableFormatActionDelegate.java
2004-01-30 Mikhail Khodjaiants 2004-01-30 Mikhail Khodjaiants
Fix for bug 50967: Linux/SWT blows when double click on the register view. Fix for bug 50967: Linux/SWT blows when double click on the register view.
* ChangeRegisterValueAction.java * ChangeRegisterValueAction.java
2004-01-29 Mikhail Khodjaiants
Added new error status handler.
* plugin.xml
* ErrorStatusHandler.java
2004-01-22 Alain Magloire 2004-01-22 Alain Magloire
Set the sharedLibManager autorefresh to be off by defaul Set the sharedLibManager autorefresh to be off by defaul
@ -30,6 +36,30 @@
Fix for PR 47595: Referenced projects are not checked in the list of generic source locations. Fix for PR 47595: Referenced projects are not checked in the list of generic source locations.
* SourceLookupBlock.java * SourceLookupBlock.java
2003-11-26 Mikhail Khodjaiants
Cleanup.
* CDTDebugModelPresentation.java
* AddExpressionActionDelegate.java
* AddGlobalsActionDelegate.java
* AddWatchpointActionDelegate.java
* AddWatchpointDialog.java
* AutoRefreshAction.java
* CBreakpointPreferencePage.java
* ExpressionDialog.java
* ManageBreakpointRulerAction.java
* MemoryFormatAction.java
* MemoryNumberOfColumnAction.java
* MemorySizeAction.java
* RunToLineRulerAction.java
* ShowRegisterTypesAction.java
* ComboDialogField.java
* DisassemblyMarkerAnnotationModel.java
* MemoryViewer.java
* AddProjectSourceLocationBlock.java
* CDebugUIPlugin.java
* SourceLookupBlock.java
* SourcePropertyPage.java
2003-11-21 Mikhail Khodjaiants 2003-11-21 Mikhail Khodjaiants
Use "symbol not available" for empty function names when generating a stack frame label. Use "symbol not available" for empty function names when generating a stack frame label.
* CDTDebugModelPresentation.java * CDTDebugModelPresentation.java

View file

@ -5,6 +5,10 @@
*/ */
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.cdi.ICDIFormat; import org.eclipse.cdt.debug.core.cdi.ICDIFormat;
import org.eclipse.cdt.debug.core.model.ICVariable; import org.eclipse.cdt.debug.core.model.ICVariable;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
@ -27,8 +31,8 @@ import org.eclipse.ui.IWorkbenchWindow;
*/ */
public class VariableFormatActionDelegate implements IObjectActionDelegate public class VariableFormatActionDelegate implements IObjectActionDelegate
{ {
private int fFormat = ICDIFormat.DECIMAL; private int fFormat = ICDIFormat.NATURAL;
private ICVariable fVariable = null; private ICVariable[] fVariables = null;
/** /**
* Constructor for VariableFormatActionDelegate. * Constructor for VariableFormatActionDelegate.
@ -50,7 +54,8 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
*/ */
public void run( IAction action ) public void run( IAction action )
{ {
if ( getVariable() != null ) 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 );
@ -61,7 +66,7 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
{ {
try try
{ {
doAction( getVariable() ); doAction( getVariables() );
} }
catch( DebugException e ) catch( DebugException e )
{ {
@ -92,41 +97,48 @@ public class VariableFormatActionDelegate implements IObjectActionDelegate
{ {
if ( selection instanceof IStructuredSelection ) if ( selection instanceof IStructuredSelection )
{ {
Object element = ((IStructuredSelection)selection).getFirstElement(); List list = new ArrayList();
if ( element instanceof ICVariable ) IStructuredSelection ssel = (IStructuredSelection)selection;
Iterator i = ssel.iterator();
while ( i.hasNext() )
{ {
boolean enabled = enablesFor( (ICVariable)element ); Object o = i.next();
action.setEnabled( enabled ); if ( o instanceof ICVariable )
if ( enabled )
{ {
action.setChecked( ( ((ICVariable)element).getFormat() == fFormat ) ); ICVariable var = (ICVariable)o;
setVariable( (ICVariable)element ); boolean enabled = var.isEditable();
return; action.setEnabled( enabled );
if ( enabled )
{
action.setChecked( var.getFormat() == fFormat );
list.add(o);
}
} }
} }
setVariables( (ICVariable[])list.toArray( new ICVariable[list.size()] ) );
}
else
{
action.setChecked( false );
action.setEnabled( false );
} }
action.setChecked( false );
action.setEnabled( false );
setVariable( null );
} }
private boolean enablesFor( ICVariable var ) protected void doAction( ICVariable[] vars ) throws DebugException
{ {
return var.isEditable(); for( int i = 0; i < vars.length; i++ )
{
vars[i].setFormat( fFormat );
}
} }
private void setVariable( ICVariable var ) protected ICVariable[] getVariables()
{ {
fVariable = var; return fVariables;
} }
protected ICVariable getVariable() private void setVariables( ICVariable[] variables )
{ {
return fVariable; fVariables = variables;
}
protected void doAction( ICVariable var ) throws DebugException
{
var.setFormat( fFormat );
} }
} }