Ejemplo n.º 1
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;
            }
          });
    }
  }
Ejemplo n.º 2
0
  @Inject
  @Optional
  private void whenCaseIsRemoved(
      @UIEventTopic(RobotModelEvents.ROBOT_CASE_REMOVED) final RobotSuiteFileSection section) {
    if (section.getSuiteFile() == fileModel) {
      selectionLayerAccessor.preserveSelectionWhen(
          tableInputIsReplaced(),
          new Function<PositionCoordinate, PositionCoordinate>() {

            @Override
            public PositionCoordinate apply(final PositionCoordinate coordinate) {
              if (section.getChildren().isEmpty()) {
                return null;
              } else if (dataProvider.getRowObject(coordinate.getRowPosition())
                  instanceof AddingToken) {
                final RobotFileInternalElement lastCase =
                    section.getChildren().get(section.getChildren().size() - 1);
                return new PositionCoordinate(
                    coordinate.getLayer(),
                    coordinate.getColumnPosition(),
                    dataProvider.indexOfRowObject(lastCase));
              }
              return coordinate;
            }
          });
    }
  }
Ejemplo n.º 3
0
 @Inject
 @Optional
 private void whenKeywordCallIsMoved(
     @UIEventTopic(RobotModelEvents.ROBOT_KEYWORD_CALL_MOVED) final RobotCase testCase) {
   if (testCase.getSuiteFile() == fileModel) {
     sortModel.clear();
     selectionLayerAccessor.preserveElementSelectionWhen(tableInputIsReplaced());
   }
 }
Ejemplo n.º 4
0
 @Inject
 @Optional
 private void whenCaseIsMoved(
     @UIEventTopic(RobotModelEvents.ROBOT_CASE_MOVED) final RobotSuiteFileSection section) {
   if (section.getSuiteFile() == fileModel) {
     sortModel.clear();
     selectionLayerAccessor.preserveElementSelectionWhen(tableInputIsReplaced());
   }
 }
Ejemplo n.º 5
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());
     }
   }
 }
Ejemplo n.º 6
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());
    }
  }
Ejemplo n.º 7
0
  @Inject
  @Optional
  private void whenSectionIsRemoved(
      @UIEventTopic(RobotModelEvents.ROBOT_SUITE_SECTION_REMOVED) final RobotSuiteFile file) {
    if (file == fileModel && dataProvider.getInput() != null) {
      final ICellEditor activeCellEditor = table.getActiveCellEditor();
      if (activeCellEditor != null && !activeCellEditor.isClosed()) {
        activeCellEditor.close();
      }
      dataProvider.setInput(getSection());
      selectionLayerAccessor.clear();
      table.refresh();

      setDirty();
    }
  }
Ejemplo n.º 8
0
  @Inject
  @Optional
  private void whenCaseIsAdded(@UIEventTopic(RobotModelEvents.ROBOT_CASE_ADDED) final Event event) {
    final RobotCasesSection section = Events.get(event, IEventBroker.DATA, RobotCasesSection.class);

    if (section != null && section.getSuiteFile() == fileModel) {
      sortModel.clear();

      RobotCase testCase = Events.get(event, RobotModelEvents.ADDITIONAL_DATA, RobotCase.class);
      if (testCase == null) {
        final List<?> keywords = Events.get(event, RobotModelEvents.ADDITIONAL_DATA, List.class);
        testCase = (RobotCase) keywords.get(keywords.size() - 1);
      }

      selectionLayerAccessor.selectElementInFirstCellAfterOperation(
          testCase, tableInputIsReplaced());
    }
  }