Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 252958 - Deleting multiple rows from an equivalence class corrupts the rows of the datapool.
Summary: Deleting multiple rows from an equivalence class corrupts the rows of the dat...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 major (vote)
Target Milestone: ---   Edit
Assignee: Paul Slauenwhite CLA
QA Contact:
URL:
Whiteboard: Milestone3 adopter
Keywords:
Depends on:
Blocks: 263493
  Show dependency tree
 
Reported: 2008-10-31 08:25 EDT by Paul Slauenwhite CLA
Modified: 2016-05-05 10:29 EDT (History)
5 users (show)

See Also:
paulslau: pmc_approved? (oec)
paulslau: pmc_approved? (chris.l.elford)
paulslau: pmc_approved? (sluiman)
paulslau: pmc_approved? (ernest)
kathy: pmc_approved+
paulslau: pmc_approved? (paulslau)
paulslau: pmc_approved? (ewchan)
paulslau: review+


Attachments
Patch (TPTP 4.5.2.1). (2.00 KB, patch)
2009-07-16 09:26 EDT, Paul Slauenwhite CLA
no flags Details | Diff
Patch (TPTP 4.6.1). (1.96 KB, patch)
2009-07-16 09:27 EDT, Paul Slauenwhite CLA
no flags Details | Diff
Patch (TPTP 4.6.1) Part 2. (5.96 KB, patch)
2009-07-16 11:21 EDT, Paul Slauenwhite CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Slauenwhite CLA 2008-10-31 08:25:08 EDT
Deleting multiple rows (records) from the datapool table corrupts the rows.

Whenever two to more rows (records) are deleted from the datapool table, the rows are corrupted (e.g. incorrect row numbers, additional rows, etc.).

Steps to reproduce:

1. Create a new datapool with 4 rows and data in each cell of the column.
2. Multiple selected rows 0 and 1.
3. Delete.
4. The second row is numbered the same as the first row ('0').
5. Create a new datapool with 4 rows and data in each cell of the column.
6. Multiple selected rows 1 and 2.
7. Delete.
8. There is an additional row ('1') appended.

Note, deleting the last rows works as expected.

This defect requires new test cases.
Comment 1 Paul Slauenwhite CLA 2008-11-25 09:35:51 EST
In addition:

1) Create a datapool with 6 rows.
2) Set each cell in the variable to the row number.
3) Multi-select the first 4 rows (0 - 3).
4) Press Delete.
5) There is an extra cell in the first (row number) column with the value of 0, which is selected.
6) Click another cell in the table and the cell in step #5 is removed.

and 

1) Create a datapool with 6 rows.
2) Set each cell in the variable to the row number.
3) Multi-select the first 2 rows (0 - 1).
4) Press Delete.
5) The second cell in the first (row number) column contains the value of 0 (instead of 1), which is selected.
6) Click another cell in the table and the cell in step #5 corrects its value to 1.
Comment 2 Paul Slauenwhite CLA 2008-11-25 10:11:23 EST
In addition:

1) Import a datapool with >100 rows.
2) Select the first cell in the first column.
3) Hold down Ctrl and the down arrow.
4) Note that only the selected cell in the first column changes once the cursor is moved past the bottom of the page, when the table should be scrolling down (cells and scroll bar moving up).
Comment 3 Paul Slauenwhite CLA 2009-02-25 10:58:58 EST
Approved for the TPTP 4.5.3 defect plan (see PMC minutes from 02/25/09).
Comment 4 Paul Slauenwhite CLA 2009-02-25 22:06:12 EST
In addition:

1) Multi-select several rows.
2) Attempt to move the selected rows.
3) Note, only the first row is moved.
Comment 5 Paul Slauenwhite CLA 2009-05-11 10:58:58 EDT
Additionally, rows are multi-selected instead of individual cells.

Finally, the selected cells are not marked as selected (color = blue).
Comment 6 Paul Slauenwhite CLA 2009-05-11 13:25:20 EDT
We should emulate the behavior in http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet96.java?view=co.

In addition, we need to implement the 'Selected Lines' option in the Find/Replace dialog (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=173653).
Comment 7 Paul Slauenwhite CLA 2009-05-11 13:26:23 EDT
Note, we need only support multiple selection of rows and not indivdual records.
Comment 8 Alex Bernstein CLA 2009-05-11 14:32:36 EDT
I have implemented similar behavior using JFace classes in RPT's performance requirements UI. The behavior is similar to that of spreadsheets -- you have active cell which can be switched into edit mode, and the current line is also selected. If table was created with SWT.MULTI style, multiple rows can be selected as well. 
Please note that there is a bug in Eclipse UI which I had to work around (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=268135)
Comment 9 Paul Slauenwhite CLA 2009-05-12 13:25:27 EDT
Requires correcting the implementation of org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable.getSelectedCells() (currently only a single cell is returned).
Comment 10 Paul Slauenwhite CLA 2009-05-20 14:52:37 EDT
Approved by the PMC to defer to future.
Comment 11 Paul Slauenwhite CLA 2009-05-20 15:47:55 EDT
(In reply to comment #10)
> Approved by the PMC to defer to future.
> 

Correction, deferring to TPTP 4.6.1.
Comment 12 Paul Slauenwhite CLA 2009-05-28 07:33:36 EDT
*** Bug 257623 has been marked as a duplicate of this bug. ***
Comment 13 Paul Slauenwhite CLA 2009-05-28 07:36:49 EDT
[From 155428]:

If you select several cells and "copy" them, you cannot paste multiple
selection. It does not matter if you select one cell or seveal cells, what gets
pasted is only one source cell value.

In addition, selecting a cell will outline the cell with a dotted box but the
entire row is grayed (excepted the selected cell).  As well, selecting a cell
with CTRL is pressed, all of the selected cells are grayed.  This should be
removed unless the row number is selected (first column).  We should be able to
select or added to an existing selection (using CTRL) individual cells.

[From 231820]:

The user can select multiple cells (shaded) in the datapool editor, however one
cell is the active cell (unshaded with no border).  As a result, the context
menu is isolated to the active cell and the user cannot multi-select copy/cut
and paste.
Comment 14 Paul Slauenwhite CLA 2009-05-28 07:36:54 EDT
*** Bug 155428 has been marked as a duplicate of this bug. ***
Comment 15 Paul Slauenwhite CLA 2009-07-07 07:01:02 EDT
Also:

1) A single cell is selected (blue shading with dotted border) when selecting multiple rows.

2) When selecting and copying multiple rows, only the first row is copied.

3) When selecting multiple rows, the record context menus appear when right-clicking any of the selected cells.
Comment 16 Paul Slauenwhite CLA 2009-07-09 06:24:52 EDT
Requested for TPTP 4.5.2.1 M4 by consuming product.
Comment 17 Paul Slauenwhite CLA 2009-07-14 07:13:44 EDT
When selecting and deleting multiple (two or more) rows from an equivalence class in the Datapool editor, the rows of the datapool are corrupted. For example, additional rows with empty cells are appended to the equivalence class or the row numbers in the first column of the equivalence class are incorrect.
Comment 18 Paul Slauenwhite CLA 2009-07-15 13:46:35 EDT
When deleting multiple rows (records) in a datapool, the rows are actually successfully deleted in the underlying datapool.  However, the datapool table in the Datapool editor is not displayed correctly.  That is, the table cursor continues to be displayed in the last selected cell (dotted outline around cell) but with the new row number.  For example, selecting the first two rows (first column) of a single variable datapool, the cell in the second row (first column) or 1 is selected (dotted outline around cell) by the table cursor.  When the cells are deleted, the cells are deleted in reverse order (see org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable.deleteRow()).  That is, the second row is deleted first and then the first row.  When the second row is deleted, the table cursor is pointing now pointing to a non-existent row so it is updated to point to the new second row (first column) or 2.  When the first row is deleted, the table cursor continues to point to the new second row (first column) or 2.  When the row numbers in the first column are renumbered (see org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable.refreshRows()), the row referenced by the table cursor is updated to the new first row (first column) or 0 but the table cursor is still referencing and selecting (dotted outline around cell) the old the second row (first column).

The fix is to delete the cells in order (see org.eclipse.hyades.test.ui.datapool.internal.control.DatapoolTable.deleteRow()).
Comment 19 Paul Slauenwhite CLA 2009-07-15 13:49:16 EDT
In addition, page up/down, home/end, enter with the shift or ctrl keys pressed do not multi-select properly.
Comment 20 Paul Slauenwhite CLA 2009-07-15 13:55:07 EDT
Also, muli-selected rows cannot be copied/cut/pasted.
Comment 21 Paul Slauenwhite CLA 2009-07-16 08:18:58 EDT
Also, after selecting multiple (e.g. 3) rows, holding the Ctrl key and clicking  one of the previously selected rows (e.g. middle) with the mouse, the cell in the first row/column is selected.  Also, after selecting multiple (e.g. 3) rows, the last row cannot be deselected by holding the Ctrl key and clicking the first column in the last row with the mouse.
Comment 22 Paul Slauenwhite CLA 2009-07-16 09:26:49 EDT
Created attachment 141773 [details]
Patch (TPTP 4.5.2.1).
Comment 23 Paul Slauenwhite CLA 2009-07-16 09:27:05 EDT
Created attachment 141774 [details]
Patch (TPTP 4.6.1).
Comment 24 Paul Slauenwhite CLA 2009-07-16 09:28:46 EDT
Jerome/Joel, note the new patches for review.

Jerome, since you are on vacation until July 19, we will commit these patches
to CVS once Joel reviews the patches so we can build/test but please review once you return.
Comment 25 Paul Slauenwhite CLA 2009-07-16 10:14:26 EDT
(In reply to comment #7)
> Note, we need only support multiple selection of rows and not indivdual
> records.
> 

Disregard.
Comment 26 Paul Slauenwhite CLA 2009-07-16 10:31:18 EDT
This defect will be used to resolve the issue with deleting multiple rows from an equivalence class corrupts the rows of the datapool.

Patches to resolve and test cases (16) added to /org.eclipse.hyades.test.ui.datapool.tests/manual/datapool/Test.UI.DatapoolEditor_editing.testsuite to test the scenarios in the following:

Description
Comment  #1
Comment  #17
Delelting multi-selected nonadjacent cells using the Ctrl key.

Defect #155428 will cover the scenarios in the following:

Comment  #13
Comment  #14
Comment  #15 (#2)
Comment  #20

Defect #283713 will cover the scenarios in the following:

Comment  #2
Comment  #4 
Comment  #5 (disregard Comment  #7) 
Comment  #6
Comment  #9
Comment  #12
Comment  #15 (#1 and #3)
Comment  #19 (also using the mouse)
Comment  #21
Comment 27 Paul Slauenwhite CLA 2009-07-16 11:21:05 EDT
Created attachment 141792 [details]
Patch (TPTP 4.6.1) Part 2.
Comment 28 Paul Slauenwhite CLA 2009-07-16 11:21:54 EDT
(In reply to comment #27)
> Created an attachment (id=141792) [details]
> Patch (TPTP 4.6.1) Part 2.
> 

Documentation updates for TPTP 4.6.1.
Comment 29 Joel Cayne CLA 2009-07-16 12:59:21 EDT
Patch looks good.
Comment 30 Paul Slauenwhite CLA 2009-07-16 13:37:01 EDT
PMC request for approval for TPTP 4.5.2.1 M3:

1.   Explain why you believe this is a stop-ship defect. How does the defect
manifest itself, and how will users of TPTP / consuming products be affected if
the defect is not fixed?

Deleting multiple rows from an equivalence
class in the Datapool editor corrupts the rows of the datapool.

2. Is there a work-around? If so, why do you believe the work-around is
insufficient?

No.

3. Is this a regression or API breakage? Explain.

No.

4. Does this require new API?

No.

5. Who performed the code review?

Joel Cayne

6. Is there a test case attached to the bugzilla record?

16 new test cases added to /org.eclipse.hyades.test.ui.datapool.tests/manual/datapool/Test.UI.DatapoolEditor_editing.testsuite.

7. What is the nature of the fix? What is the scope of the fix? What is the
risk associated with this fix?

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=252958#c18.

Low - medium risk.

8. Is this fix related to any standards that TPTP adheres to? If so, who has
validated that the fix continues to adhere to the standard?

No.
Comment 31 Paul Slauenwhite CLA 2009-07-16 14:30:37 EDT
The 'Patch (TPTP 4.5.2.1).' patch checked in to the TPTP-4_5_2_1 branch and the
'Patch (TPTP 4.6.1).' and 'Patch (TPTP 4.6.1) Part 2.' patches checked in to HEAD. 

The org.eclipse.hyades.test.ui plug-in version number was increased for TPTP
4.5.2.1 M3 under defect 262829.

New test cases added to
/org.eclipse.hyades.test.ui.datapool.tests/manual/datapool/Test.UI.DatapoolEditor_editing.testsuite in both HEAD and
the TPTP-4_5_2_1 branch.
Comment 32 Paul Slauenwhite CLA 2009-08-10 07:39:53 EDT
(In reply to comment #29)
> Patch looks good.
> 

Patch reviewed and approved by Joel.  

Patch NOT reviewed by Jerome.  
Comment 33 Paul Slauenwhite CLA 2009-09-21 11:03:30 EDT
Verified in TPTP-4.5.2.1-200908191232 and TPTP-4.6.1-200909160100.

Closing.