How to add Checking Rule and Quick Fix programmatically?

I'd like to add checking rule and quick fix behavior programmatically.

The only input is an instance of AbstractConceptDeclaration to set the property applicableNode and the name of the property to highlight in case of an error. The other settings are already given and don't change.

Checking rule (NonTypeSystemRule):

  • applicableNode (set from user input as an instance of a ConceptReference)
  • overrides: should be permanently set to false
  • do: a constant list of statements (StatementList). Some statements refer to the actual node of type node<applicableNode> (statements inserted via quotation?)
  • error: on of the do statements is a ReportErrorStatement connecting the quick fix

error (ReportErrorStatement)

  • error.helginsIntention.quickFix: A reference to an instance of TypesystemQuickFix
  • error.helginsIntention.actualArgument: The actual node of type node<applicableNode>
  • error.nodeToReport: The actual node of type node<applicableNode>
  • error.errorString: a string
  • error.messageTarget: An instance of PropertyNameTarget holding the name of the property to highlight (user input)

Quick Fix (TypesystemQuickFix)

  • arguments: The actual node of type node<applicableNode>
  • descriptionBlock: A constant string
  • executeBlock: a constant list of statements (StatementList). Some statements refer to the argument.

As you see, most of the properties are predefined.

Question:

How could I integrate all this into the system so that it behaves like a common checking rule but using a reduced editor (asking only for applicableNode and property name) and an automatically attached quick fix set up as described above?

Thanks
Kai

 

0

Please sign in to leave a comment.