Class tableviewereditingsupport extends editingsupport {
Int column;
Private tableviewer columnviewer;
Private celleditor editor;
Public tableviewereditingsupport (columnviewer viewers, int column ){
Super (viewers );
This. columnviewer = (tableviewer) viewers;
Switch (column ){
Case 0:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
Case 1:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
Case 2:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border | SWT. read_only );
Break;
Case 3:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border | SWT. read_only );
Break;
Case 4:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
Case 5:
Editor = new textcelleditor (columnviewer. gettable (), SWT. Single
| SWT. Border );
Break;
}
This. Column = column;
}
/** This method controls whether celleditor is editable.
@ Override
Protected Boolean canedit (object element ){
/** Convert [element] to the solution object [solution ]*/
// Execute the judgment. If a project is easy to be edited, false is directly returned if it is not editable. If index is set to 1 or 2, No editing is allowed.
/** Call the springutil. getprojectlistdao method to obtain the iprojectlistdao object and call its findbysolution method to pass in the solution. Solutionid: place the obtained result to the list object templist */
/** Determine [templist]. If the part is empty, false is returned */
/** If the index is 1 or 2, false is returned */
Pmsolution solution = (pmsolution) element;
/**
* If the solution ID is blank, you can directly edit the new solution.
*/
If (! Stringutil. isnullorempty (solution. getsolutionid ()))
{
If (column = 2 | column = 3 ){
Return false; // if false is returned, it cannot be edited.
}
}
Return true; // return true to editable
}
Determines whether the celleditor is editable.