Source:
<code>protected void editCell(GridWidget gridWidget) { <START> super.editCell(gridWidget); <END> final GridData model = gridWidget.getModel(); if (model.getSelectedHeaderCells().size() > 0) { final GridData.SelectedCell selectedCell = model.getSelectedHeaderCells().get(0); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final int uiHeaderRowIndex = selectedCell.getRowIndex(); final int uiColumnIndex = findUiColumnIndex(model.getColumns(), selectedCell.getColumnIndex()); final GridColumn<?> column = model.getColumns().get(uiColumnIndex); final double columnXCoordinate = rendererHelper.getColumnOffset(column) + column.getWidth() / 2; final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate); if (column instanceof ScenarioGridColumn) { if (!isEditableHeader(column, uiHeaderRowIndex)) { return; } final GridBodyCellEditContext cellEditContext = makeRenderContext(gridWidget, rendererHelper.getRenderingInformation(), ci, null, uiHeaderRowIndex); final double yCoordinate = uiHeaderRowIndex * rendererHelper.getRenderingInformation().getHeaderRowHeight() + 1; final ScenarioHeaderMetaData metaData = ScenarioSimulationGridHeaderUtilities.getColumnScenarioHeaderMetaData(gridWidget, column, yCoordinate); if (metaData != null) { metaData.edit(cellEditContext); } } } }</code><technical_language>This class/method completely ignore logic implemented for behavior click handler. adding code existing project is a good rule of thumb in place, add/modify consequently. In this case, creating scratch new method correct approach 1) identify common path (i.e. logic required decide start editing - implemented in click handler) 2) put in a common class/method (for ex, create "abstract" handler - based a cell, manage click 3) call method implementations, actual behavior firing event is a real click a "keyboard" enter Wording differently: 1) need utility class some methods based some logic, modify status of grid/model 2) "left click" managed ClickHandler "enter" managed KeyboardHandler call methods, is absolutely difference in final behavior duplicated code</technical_language>

Target:
protected void editCell(GridWidget gridWidget) { super.editCell(gridWidget); final GridData model = gridWidget.getModel(); if (model.getSelectedHeaderCells().size() > 0) { final GridData.SelectedCell selectedCell = model.getSelectedHeaderCells().get(0); final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper(); final int uiHeaderRowIndex = selectedCell.getRowIndex(); final int uiColumnIndex = findUiColumnIndex(model.getColumns(), selectedCell.getColumnIndex()); final GridColumn<?> column = model.getColumns().get(uiColumnIndex); final double columnXCoordinate = rendererHelper.getColumnOffset(column) + column.getWidth() / 2; final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate); if (column instanceof ScenarioGridColumn) { if (!isEditableHeader(column, uiHeaderRowIndex)) { return; } final GridBodyCellEditContext cellEditContext = makeRenderContext(gridWidget, rendererHelper.getRenderingInformation(), ci, null, uiHeaderRowIndex); final ScenarioHeaderMetaData metaData = ScenarioSimulationGridHeaderUtilities.getColumnScenarioHeaderMetaData((ScenarioGridColumn) column, uiHeaderRowIndex); if (metaData != null) { metaData.edit(cellEditContext); } } } }