Example #1
0
 @Override
 public void doSave(final IProgressMonitor monitor) {
   for (final IEditorPart dirtyEditor : getDirtyEditors()) {
     dirtyEditor.doSave(monitor);
   }
   final RobotProject project = editorInput.getRobotProject();
   project.clearAll();
   new RedEclipseProjectConfigWriter()
       .writeConfiguration(editorInput.getProjectConfiguration(), project);
 }
  @Test
  public void variablesDefinedInGlobalVariablesFilesLinkedInRedXmlAreLocated()
      throws IOException, CoreException {
    final IFile sourceFile = projectProvider.createFile("importingFile.robot", "");

    final RobotModel model = new RobotModel();
    final RobotProject robotProject = model.createRobotProject(sourceFile.getProject());

    final ReferencedVariableFile varsImportRef = new ReferencedVariableFile();
    varsImportRef.setVariables(ImmutableMap.<String, Object>of("var_a", 42, "var_b", 1729));

    robotProject.setReferencedVariablesFiles(newArrayList(varsImportRef));

    final Set<String> visitedVars = new HashSet<>();
    final VariableDefinitionLocator locator = new VariableDefinitionLocator(sourceFile, model);
    locator.locateVariableDefinition(varFileVariableDetector(visitedVars));
    assertThat(visitedVars).containsOnly("${var_a}", "${var_b}");
  }