-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ticket5811 table bug fixing #1318
Conversation
…r than using setInput
…nd remove unused imports and remove author
// Add new action if tab is pressed by user in the last cell of the table. | ||
if (nextCell.getNeighbor(ViewerCell.BELOW, false).getElement() == null | ||
&& (viewer.getTable().getColumnCount() - NON_EDITABLE_COLUMNS_ON_RIGHT == currentlyFocusedColumn)) { | ||
Optional<ViewerCell> neighbour = Optional.ofNullable(nextCell.getNeighbor(ViewerCell.BELOW, false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes NullPointerException where the ViewerCell from BELOW was null as it doesn't exist (which also means there is no action below the current one. The || is a cut so the call to get() should be fine.
/** | ||
* Sets focus of cell. | ||
* @param row row number of table | ||
* @param column column number of table | ||
*/ | ||
public void setCellFocus(int row, int column) { | ||
if (row >= 0) { | ||
viewer.editElement(viewer.getElementAt(row), column); | ||
var element = viewer.getElementAt(row); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes NullPointerException where the element is null so editElement cannot handle it.
@@ -86,16 +82,6 @@ | |||
*/ | |||
private static final Color CLEAR_COLOR = DISPLAY.getSystemColor(SWT.COLOR_WHITE); | |||
|
|||
/** | |||
* A light orange to use when validity checks may be incorrect e.g. for when using an unsupported language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used anywhere so removed
@@ -59,9 +58,6 @@ | |||
|
|||
/** | |||
* The ViewModel for the ScriptGeneratorView. | |||
* | |||
* @author James King |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know when this was added, but certainly hasn't been just me so removed
@@ -324,7 +310,6 @@ private void displayThreadingError() { | |||
protected void addEmptyAction() { | |||
scriptGeneratorModel.addEmptyAction(); | |||
// Make sure the table is updated with the new action before selecting it | |||
actionChangeHandler(viewTable, btnGenerateScript, btnSaveParam, btnSaveParamAs, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actionChangeHandler should only be called when the action change is propagated from below.
DISPLAY.asyncExec(() -> { | ||
viewTable.setCellFocus(insertionLocation, 0); | ||
viewTable.setCellFocus(insertionLocation, ActionsViewTable.NON_EDITABLE_COLUMNS_ON_LEFT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the cell focus to the first editable column
@@ -767,25 +746,6 @@ protected String getFirstNLinesOfInvalidityErrors(int i) { | |||
* @param viewTable The table in the view to update. | |||
*/ | |||
protected void updateValidityChecks(ActionsViewTable viewTable) { | |||
List<ScriptGeneratorAction> actions = scriptGeneratorModel.getActions(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into the update calls in the various columns as this seemed more in-keeping with the swt tables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a large number of rows quickly, and then changing the script definition to one with global variables causes the script genderator to crash.
Other than that everything seems to look fine, a couple of comments on the code.
I doubt its just your ticket thats done it, but i was checking various buttons still work when its handling lots of new inputs in the table and it looks like theres a problem with the help button? it seems to link to an empty page.
} | ||
} catch (IllegalArgumentException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not certain whether this should be a try catch or if it would be better as an exception, its my understanding that if this is non-exceptional flow control its preferred to use an if statement for this instead.
} | ||
|
||
@Override | ||
public String getToolTipText(Object element) { | ||
return getScriptGenActionToolTipText(element); | ||
} | ||
|
||
@Override | ||
public void update(ViewerCell cell) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the indentation here is off, a few other places as well.
I couldn't cause the script generator to crash doing this, but it did write nasty things to the log that looked like it could be the symptom of what would have caused a crash for you. I have now rewritten the algorithm to prevent this issue, I hope it also corrects the crashing that you saw, let me know if it doesn't so we can look through together to see what is causing it. |
…umber doesn't update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes made and handling of the edge case found, this is good to go in.
Description of work
Ticket
ISISComputingGroup/IBEX#5811
Acceptance criteria
To test:
Unit tests
Give an overview of unit tests you have added or modified, if applicable. The aim is provide information to help the reviewer
System tests
Mention any automated tests or manual tests that you have added or modified, if applicable. The aim is provide information to help the reviewer
Documentation
Highlight and provide a link to any additions or changes to the documentation, if applicable. The aim is provide information to help the reviewer
Code Review
Final Steps