@Override
 public void execute() {
   MainWindow.getInstance().setStatus("Begin validation");
   Main.log("Begin validation");
   for (IDiagramValidator validator : validators) {
     validator.execute();
   }
   if (validationList.getValidationItems().isEmpty()) {
     MainWindow.getInstance().setStatus("Validation success");
     Main.log("Validation success");
   } else {
     MainWindow.getInstance().setStatus("Validation fail");
     Main.log("Validation fail");
   }
 }
  public ValidateDiagramCommand() {
    validationList = MainWindow.getInstance().getValidationList();
    validationList.reset();

    validators.add(new TerminatorValidator());
    validators.add(new ElementsConnectionValidator());
    validators.add(new JudgmentValidator());
    validators.add(new FlowValidator());
    validators.add(new SyntaxValidator());
  }
 @Override
 public void execute() {
   ISubEditor subEditor;
   subEditor = MainWindow.getInstance().getEditor().getActiveSubEditor();
   List<IElement> elements = subEditor.getSelectedElements();
   if (elements.size() == 1) {
     IDiagramElement element = (IDiagramElement) elements.get(0);
     element.action();
   } else {
     throw new ElementNotFoundException("No element selected.");
   }
 }
 public boolean isError() {
   return !MainWindow.getInstance().getValidationList().getValidationItems().isEmpty();
 }