Skip to content
Snippets Groups Projects
Commit efbf4f78 authored by David Bühler's avatar David Bühler
Browse files

[Ivette] Studia: adds different labels for the different menu entries.

parent 46495cfd
No related branches found
No related tags found
No related merge requests found
...@@ -73,19 +73,27 @@ interface MenuProps { ...@@ -73,19 +73,27 @@ interface MenuProps {
export function buildMenu(props: MenuProps) : void { export function buildMenu(props: MenuProps) : void {
const { update, marker, attrs, menu } = props; const { update, marker, attrs, menu } = props;
if (!attrs || !marker) return; if (!attrs || !marker) return;
const reads = 'Studia: select reads'; const reads = 'Studia: select reads ';
const writes = 'Studia: select writes'; const writes = 'Studia: select writes ';
if (attrs.isLval && !attrs.isFunction) { if (attrs.isLval && !attrs.isFunction) {
const data = { marker, label: attrs.name }; const data = { marker, label: attrs.name };
const select = (k: access): Selections => compute({ ...data, kind: k }); const select = (k: access): Selections => compute({ ...data, kind: k });
const onClick = (k: access): void => { select(k).then(update); }; const onClick = (k: access): void => { select(k).then(update); };
menu.push({ label: reads, onClick: () => onClick('Reads') }); const suffix = `of ${attrs.name}`;
menu.push({ label: writes, onClick: () => onClick('Writes') }); const createMenuItem = (label: string, kind: access): void => {
menu.push({ label: label + suffix, onClick: () => onClick(kind) });
};
createMenuItem(reads, 'Reads');
createMenuItem(writes, 'Writes');
} else { } else {
const location = { location: { fct: attrs.scope, marker } }; const location = { location: { fct: attrs.scope, marker } };
const onClick = (e: Dome.Event): void => { update(location); e.emit(); }; const onClick = (e: Dome.Event): void => { update(location); e.emit(); };
menu.push({ label: reads, onClick: () => onClick(studiaReadsEvent) }); const suffix = `of…`;
menu.push({ label: writes, onClick: () => onClick(studiaWritesEvent) }); const createMenuItem = (label: string, evt: Dome.Event): void => {
menu.push({ label: label + suffix, onClick: () => onClick(evt) });
};
createMenuItem(reads, studiaReadsEvent);
createMenuItem(writes, studiaWritesEvent);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment