mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 18:26:01 +02:00
Cleanup. Use generics (to fix warnings) and other misc improvements. No functional change.
This commit is contained in:
parent
253c339287
commit
402016a6f0
1 changed files with 12 additions and 14 deletions
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
|
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemorySpaceManagement;
|
||||||
import org.eclipse.debug.ui.DebugUITools;
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
|
@ -45,7 +46,7 @@ public class AddWatchpointDialog extends Dialog implements ModifyListener, Selec
|
||||||
|
|
||||||
private Combo fExpressionInput;
|
private Combo fExpressionInput;
|
||||||
private String fExpression;
|
private String fExpression;
|
||||||
private static ArrayList sExpressionHistory = new ArrayList();
|
private static List<String> sExpressionHistory = new ArrayList<String>();
|
||||||
|
|
||||||
private boolean fHasMemorySpaceControls;
|
private boolean fHasMemorySpaceControls;
|
||||||
private Button fMemorySpaceEnableButton;
|
private Button fMemorySpaceEnableButton;
|
||||||
|
@ -131,9 +132,9 @@ public class AddWatchpointDialog extends Dialog implements ModifyListener, Selec
|
||||||
gridData.horizontalSpan = 2;
|
gridData.horizontalSpan = 2;
|
||||||
fExpressionInput.setLayoutData( gridData );
|
fExpressionInput.setLayoutData( gridData );
|
||||||
fExpressionInput.addModifyListener( this );
|
fExpressionInput.addModifyListener( this );
|
||||||
String[] history = getHistory( sExpressionHistory );
|
for (String expression : sExpressionHistory) {
|
||||||
for ( int i = 0; i < history.length; i++ )
|
fExpressionInput.add( expression );
|
||||||
fExpressionInput.add( history[i] );
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createMemorySpaceControl( Composite parent, boolean hasMemorySpaces ) {
|
private void createMemorySpaceControl( Composite parent, boolean hasMemorySpaces ) {
|
||||||
|
@ -285,7 +286,7 @@ public class AddWatchpointDialog extends Dialog implements ModifyListener, Selec
|
||||||
protected void okPressed() {
|
protected void okPressed() {
|
||||||
fExpression = fExpressionInput.getText().trim();
|
fExpression = fExpressionInput.getText().trim();
|
||||||
if ( fExpression.length() > 0 ) {
|
if ( fExpression.length() > 0 ) {
|
||||||
addHistory( sExpressionHistory, fExpression );
|
addHistory( fExpression );
|
||||||
}
|
}
|
||||||
if ( fHasMemorySpaceControls ) {
|
if ( fHasMemorySpaceControls ) {
|
||||||
fMemorySpace = fMemorySpaceEnableButton.getSelection() ? fMemorySpaceInput.getText().trim() : "";
|
fMemorySpace = fMemorySpaceEnableButton.getSelection() ? fMemorySpaceInput.getText().trim() : "";
|
||||||
|
@ -318,16 +319,13 @@ public class AddWatchpointDialog extends Dialog implements ModifyListener, Selec
|
||||||
return fMemorySpace;
|
return fMemorySpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addHistory( ArrayList list, String item ) {
|
private static void addHistory( String item ) {
|
||||||
if ( !list.contains( item ) )
|
if ( !sExpressionHistory.contains( item ) ) {
|
||||||
list.add( 0, item );
|
sExpressionHistory.add( 0, item );
|
||||||
|
|
||||||
if ( list.size() > 5 )
|
if ( sExpressionHistory.size() > 5 )
|
||||||
list.remove( list.size() - 1 );
|
sExpressionHistory.remove( sExpressionHistory.size() - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String[] getHistory( ArrayList list ) {
|
|
||||||
return (String[])list.toArray( new String[list.size()] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
Loading…
Add table
Reference in a new issue