void reportKeywordUsageProblems(final List<RobotCase> cases) { for (final RobotCase testCase : cases) { reportKeywordUsageProblemsInTestCaseSettings(testCase); reportKeywordUsageProblems( validationContext, reporter, testCase.getLinkedElement().getTestExecutionRows(), testCase.getTemplateInUse()); } }
@Inject @Optional private void whenKeywordCallIsConverted( @UIEventTopic(RobotModelEvents.ROBOT_KEYWORD_CALL_CONVERTED) final Event event) { final RobotCase testCase = Events.get(event, IEventBroker.DATA, RobotCase.class); final RobotKeywordCall call = Events.get(event, RobotModelEvents.ADDITIONAL_DATA, RobotKeywordCall.class); if (testCase != null && testCase.getSuiteFile() == fileModel) { sortModel.clear(); selectionLayerAccessor.selectElementPreservingSelectedColumnsAfterOperation( call, tableInputIsReplaced()); } }
@Inject @Optional private void whenKeywordCallIsRemoved( @UIEventTopic(RobotModelEvents.ROBOT_KEYWORD_CALL_REMOVED) final RobotCase testCase) { if (testCase.getSuiteFile() == fileModel) { selectionLayerAccessor.preserveSelectionWhen( tableInputIsReplaced(), new Function<PositionCoordinate, PositionCoordinate>() { @Override public PositionCoordinate apply(final PositionCoordinate coordinate) { if (testCase.getChildren().isEmpty()) { return new PositionCoordinate( coordinate.getLayer(), coordinate.getColumnPosition(), dataProvider.indexOfRowObject(testCase)); } else if (dataProvider.getRowObject(coordinate.getRowPosition()) instanceof AddingToken) { return new PositionCoordinate( coordinate.getLayer(), coordinate.getColumnPosition(), coordinate.getRowPosition() - 1); } return coordinate; } }); } }
@Inject @Optional private void whenCaseNameChanges( @UIEventTopic(RobotModelEvents.ROBOT_CASE_NAME_CHANGE) final RobotCase testCase) { if (viewer != null) { viewer.refresh(testCase.getParent()); } }
@Inject @Optional private void whenKeywordCallIsMoved( @UIEventTopic(RobotModelEvents.ROBOT_KEYWORD_CALL_MOVED) final RobotCase testCase) { if (testCase.getSuiteFile() == fileModel) { sortModel.clear(); selectionLayerAccessor.preserveElementSelectionWhen(tableInputIsReplaced()); } }
@Inject @Optional private void whenCaseDetailIsChanged( @UIEventTopic(RobotModelEvents.ROBOT_CASE_DETAIL_CHANGE_ALL) final RobotCase testCase) { if (testCase.getSuiteFile() == fileModel) { table.update(); table.refresh(); setDirty(); } }
@Inject @Optional private void whenKeywordCallIsAdded( @UIEventTopic(RobotModelEvents.ROBOT_KEYWORD_CALL_ADDED) final Event event) { final RobotCase testCase = Events.get(event, IEventBroker.DATA, RobotCase.class); final RobotKeywordCall keywordCall = Events.get(event, RobotModelEvents.ADDITIONAL_DATA, RobotKeywordCall.class); if (testCase != null && testCase.getSuiteFile() == fileModel) { sortModel.clear(); if (keywordCall != null) { selectionLayerAccessor.selectElementInFirstCellAfterOperation( keywordCall, tableInputIsReplaced()); } else { final List<?> calls = Events.get(event, RobotModelEvents.ADDITIONAL_DATA, List.class); final RobotKeywordCall lastCall = (RobotKeywordCall) calls.get(calls.size() - 1); selectionLayerAccessor.selectElementInFirstCellAfterOperation( lastCall, tableInputIsReplaced()); } } }
private void reportKeywordUsageProblemsInTestCaseSettings(final RobotCase testCase) { final RobotToken templateKeywordToken = testCase.getLinkedElement().getTemplateKeywordLocation(); if (templateKeywordToken != null && !templateKeywordToken.getFilePosition().isNotSet() && isTemplateFromTestCasesTable(testCase) && !templateKeywordToken.getText().toLowerCase().equals("none")) { validateExistingKeywordCall( validationContext, reporter, templateKeywordToken, Optional.<List<RobotToken>>absent()); } }
private boolean isTemplateFromTestCasesTable(final RobotCase testCase) { return testCase.getLinkedElement().getRobotViewAboutTestTemplate() != null; }