Esempio n. 1
0
 void reportKeywordUsageProblems(final List<RobotCase> cases) {
   for (final RobotCase testCase : cases) {
     reportKeywordUsageProblemsInTestCaseSettings(testCase);
     reportKeywordUsageProblems(
         validationContext,
         reporter,
         testCase.getLinkedElement().getTestExecutionRows(),
         testCase.getTemplateInUse());
   }
 }
Esempio n. 2
0
  @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());
    }
  }
Esempio n. 3
0
  @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;
            }
          });
    }
  }
Esempio n. 4
0
 @Inject
 @Optional
 private void whenCaseNameChanges(
     @UIEventTopic(RobotModelEvents.ROBOT_CASE_NAME_CHANGE) final RobotCase testCase) {
   if (viewer != null) {
     viewer.refresh(testCase.getParent());
   }
 }
Esempio n. 5
0
 @Inject
 @Optional
 private void whenKeywordCallIsMoved(
     @UIEventTopic(RobotModelEvents.ROBOT_KEYWORD_CALL_MOVED) final RobotCase testCase) {
   if (testCase.getSuiteFile() == fileModel) {
     sortModel.clear();
     selectionLayerAccessor.preserveElementSelectionWhen(tableInputIsReplaced());
   }
 }
Esempio n. 6
0
 @Inject
 @Optional
 private void whenCaseDetailIsChanged(
     @UIEventTopic(RobotModelEvents.ROBOT_CASE_DETAIL_CHANGE_ALL) final RobotCase testCase) {
   if (testCase.getSuiteFile() == fileModel) {
     table.update();
     table.refresh();
     setDirty();
   }
 }
Esempio n. 7
0
 @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());
     }
   }
 }
Esempio n. 8
0
 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());
   }
 }
Esempio n. 9
0
 private boolean isTemplateFromTestCasesTable(final RobotCase testCase) {
   return testCase.getLinkedElement().getRobotViewAboutTestTemplate() != null;
 }