diff --git a/ivette/src/frama-c/plugins/studia/studia.ts b/ivette/src/frama-c/plugins/studia/studia.ts index a45a2b06e6e480f207b6e8833dc6bc29316db557..6045af5178af3a34a94d24dbfba64328b8f515b8 100644 --- a/ivette/src/frama-c/plugins/studia/studia.ts +++ b/ivette/src/frama-c/plugins/studia/studia.ts @@ -68,15 +68,21 @@ interface MenuProps { /** Builds the Studia entries in the contextual menu about a given marker. */ export function buildMenu(props: MenuProps) : void { const { update, marker, attrs, menu } = props; - const enabled = attrs?.isLval; - function onClick(kind: access) : void { + function onClick(kind: access): void { if (marker && attrs) compute(marker, attrs.name, kind).then(update); } - const reads = 'Studia: select reads'; - const writes = 'Studia: select writes'; - menu.push({ label: reads, enabled, onClick: () => onClick('Reads') }); - menu.push({ label: writes, enabled, onClick: () => onClick('Writes') }); + if (attrs?.isLval) { + const reads = 'Studia: select reads'; + const writes = 'Studia: select writes'; + menu.push({ label: reads, onClick: () => onClick('Reads') }); + menu.push({ label: writes, onClick: () => onClick('Writes') }); + } else { + const reads = 'Studia: select reads…'; + const writes = 'Studia: select writes…'; + menu.push({ label: reads, onClick: studiaReadsEvent.emit }); + menu.push({ label: writes, onClick: studiaWritesEvent.emit }); + } } export function useStudiaMode(): void {