Skip to content

Commit

Permalink
support preselected cast syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
nittka committed Dec 25, 2024
1 parent 928e4ac commit 1d176f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion org.tvtower.db/src/org/tvtower/db/Database.xtext
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ Job:
('gender''='gender=STRING)?&
('country''='country=STRING)?&
('role_guid''='rolId=[ProgrammeRole|STRING] )?&
('random_role''='randomRole=STRING )?
('random_role''='randomRole=STRING )?&
('person''='preselectedCast=[Person|STRING])?
)
'/>'
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import org.eclipse.xtext.diagnostics.DiagnosticMessage;
import org.eclipse.xtext.linking.impl.LinkingDiagnosticMessageProvider;
import org.tvtower.db.database.DatabasePackage;
import org.tvtower.db.database.Effect;

public class DatabaseLinkingDiagnosticMessageProvider extends LinkingDiagnosticMessageProvider {

private static DatabasePackage $ = DatabasePackage.eINSTANCE;

@Override
public DiagnosticMessage getUnresolvedProxyMessage(ILinkingDiagnosticContext context) {
// do not try to resolve variables within effects
if (context.getContext() instanceof Effect) {
// do not try to resolve variables within effects or preselected cast
if (context.getContext() instanceof Effect || context.getReference() == $.getJob_PreselectedCast()) {
if (context.getLinkText() != null && context.getLinkText().matches("\\$\\{\\w+\\}")) {
return null;
}
Expand Down

0 comments on commit 1d176f2

Please sign in to comment.