Index:
ChangeLog =================================================================== RCS
file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v retrieving revision
1.112 diff -u -r1.112 ChangeLog --- ChangeLog 14 Mar 2003 23:15:12
-0000 1.112 +++ ChangeLog 17 Mar 2003 21:24:17 -0000 @@ -1,3
+1,7 @@ +2003-03-17 Mikhail Khodjaiants + Replace range by start
index and length in 'Display As Array' action. + *
CastToArrayActionDelegate.java + 2003-03-14 Mikhail
Khodjaiants Fix for the 'Restore Default Type'
action. * RestoreDefaultTypeActionDelegate.java Index:
src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java =================================================================== RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java,v retrieving
revision 1.2 diff -u -r1.2 CastToArrayActionDelegate.java ---
src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java 11
Mar 2003 23:46:55 -0000 1.2 +++
src/org/eclipse/cdt/debug/internal/ui/actions/CastToArrayActionDelegate.java 17
Mar 2003 21:24:18 -0000 @@ -46,21 +46,21
@@ { private String fType =
""; private int fFirstIndex = 0; - private
int fLastIndex = 0; + private int fLength =
0; private Button
fOkButton; private Label
fErrorMessageLabel; private Text
fTypeText; private Text
fFirstIndexText; - private Text
fLastIndexText; + private Text
fLengthText; - public CastToArrayDialog( Shell
parentShell, String initialType, int initialStart, int initialEnd
) + public CastToArrayDialog( Shell parentShell, String
initialType, int initialStart, int initialLength
) { super( parentShell
); fType = ( initialType == null ) ? "" :
initialType; fFirstIndex =
initialStart; - fLastIndex =
initialEnd; + fLength =
initialLength; } protected
String getType() @@ -73,9 +73,9 @@ return
fFirstIndex; } - protected int
getLastIndex() + protected int
getLength() { - return
fLastIndex; + return
fLength; } /*
(non-Javadoc) @@ -103,7 +103,7
@@ fTypeText.setText( fType
); fTypeText.selectAll(); fFirstIndexText.setText(
String.valueOf( fFirstIndex )
); - fLastIndexText.setText( String.valueOf(
fLastIndex ) ); + fLengthText.setText( String.valueOf(
fLength ) ); } } @@
-150,7 +150,7
@@ } }
); - Label label = ControlFactory.createLabel(
composite, "First index:" ); + Label label =
ControlFactory.createLabel( composite, "Start index:"
); ((GridData)label.getLayoutData()).horizontalSpan =
3; fFirstIndexText = ControlFactory.createTextField(
composite ); fFirstIndexText.addModifyListener( @@
-162,10 +162,10
@@ } }
); - label = ControlFactory.createLabel(
composite, "Last index:" ); + label =
ControlFactory.createLabel( composite, "Length:"
); ((GridData)label.getLayoutData()).horizontalSpan =
3; - fLastIndexText = ControlFactory.createTextField(
composite
); - fLastIndexText.addModifyListener( + fLengthText
= ControlFactory.createTextField( composite
); + fLengthText.addModifyListener( new
ModifyListener() { public
void modifyText( ModifyEvent e ) @@ -194,45 +194,38
@@ } else { - int
first =
-1; try { - first
= Integer.parseInt( firstIndex
); + Integer.parseInt( firstIndex
); } catch(
NumberFormatException e
) { - } - if
( first < 0
) - { message
= "Invalid first index."; enabled =
false; } - else + if
( enabled
) { - String
lastIndex =
fLastIndexText.getText().trim(); - if (
lastIndex.length() == 0 ) + String
lengthText =
fLengthText.getText().trim(); + if (
lengthText.length() == 0
) { message
= "The 'Last index' field must not be
empty."; enabled =
false; } else { - int
last = -1; + int length =
-1; try { - last
= Integer.parseInt( lastIndex
); + length =
Integer.parseInt( lengthText
); } catch(
NumberFormatException e
) { - } - if
( last < 0
) - { message
= "Invalid last
index."; enabled =
false; } - else
if ( last < first ) + if (
enabled && length < 1
) { - message
= "The first index must not be greater than the last
index."; + message = "The
length must be greater than
0."; enabled =
false; } } @@
-252,16 +245,16
@@ { fType =
fTypeText.getText().trim(); String firstIndex =
fFirstIndexText.getText().trim(); - String lastIndex =
fLastIndexText.getText().trim(); + String lengthText =
fLengthText.getText().trim(); try { fFirstIndex
= Integer.parseInt( firstIndex ); - fLastIndex =
Integer.parseInt( lastIndex ); + fLength =
Integer.parseInt( lengthText
); } catch(
NumberFormatException e
) { fFirstIndex
= 0; - fLastIndex =
0; + fLength =
0; } } else @@
-370,12 +363,12 @@ protected void doAction( ICastToArray
castToArray ) throws DebugException { String
currentType =
castToArray.getCurrentType().trim(); - CastToArrayDialog dialog =
new CastToArrayDialog( CDebugUIPlugin.getActiveWorkbenchShell(), currentType, 0,
0 ); + CastToArrayDialog dialog = new CastToArrayDialog(
CDebugUIPlugin.getActiveWorkbenchShell(), currentType, 0, 1
); if ( dialog.open() == Window.OK
) { String newType =
dialog.getType().trim(); int firstIndex =
dialog.getFirstIndex(); - int lastIndex =
dialog.getLastIndex(); + int lastIndex =
dialog.getLength(); castToArray.castToArray( newType,
firstIndex, lastIndex
); } }
|