Skip to content
Snippets Groups Projects
Commit 5e88a09d authored by tj's avatar tj
Browse files

adjusted options 'Reset Markings' and 'Edit Input Signals' to not only be...

adjusted options 'Reset Markings' and 'Edit Input Signals' to not only be disabled, but invisible for elements they are not intended for. Uncertain whether Transitions and Places here (the targets for these Options) includes the Reference Verions too; for now they are allowed
parent cd69b388
Branches
Tags
No related merge requests found
...@@ -55,6 +55,7 @@ hours: ...@@ -55,6 +55,7 @@ hours:
11.01.25 4h - 11.01.25 4h -
12.01.25 12h - 12.01.25 12h -
19.01.25 4h 19.01.25 4h
26.01.25 8h
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------
see https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisite_native_keymap see https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisite_native_keymap
......
...@@ -184,6 +184,16 @@ export function isPlace(element: GModelElement): boolean { ...@@ -184,6 +184,16 @@ export function isPlace(element: GModelElement): boolean {
return element.type === PNMLModelTypes.PLACE; return element.type === PNMLModelTypes.PLACE;
} }
export function isRefTransition(element: GModelElement): boolean {
return element.type === PNMLModelTypes.REF_TRANSITION;
}
export function isRefPlace(element:GModelElement): boolean {
return element.type === PNMLModelTypes.REF_PLACE;
}
export interface HasArgs { export interface HasArgs {
args: any; args: any;
} }
...@@ -18,7 +18,7 @@ import { GLSPCommandHandler, GLSPContextMenu } from '@eclipse-glsp/theia-integra ...@@ -18,7 +18,7 @@ import { GLSPCommandHandler, GLSPContextMenu } from '@eclipse-glsp/theia-integra
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core'; import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core';
import { ApplicationShell } from '@theia/core/lib/browser'; import { ApplicationShell } from '@theia/core/lib/browser';
import { inject, injectable } from 'inversify'; import { inject, injectable } from 'inversify';
import { isTransition, EditInputSignalMenu } from 'tasklist-glsp'; import { isTransition, EditInputSignalMenu, isRefTransition } from 'tasklist-glsp';
export namespace EditInputSignalsMenuCommand { export namespace EditInputSignalsMenuCommand {
export const EDIT_INPUT_SIGNALS_MENU = 'edit-input-signals-menu-command'; export const EDIT_INPUT_SIGNALS_MENU = 'edit-input-signals-menu-command';
...@@ -37,7 +37,14 @@ export class EditInputSignalsMenuCommandContribution implements CommandContribut ...@@ -37,7 +37,14 @@ export class EditInputSignalsMenuCommandContribution implements CommandContribut
visible: true visible: true
}) })
], ],
isEnabled: context => !context.isReadonly && context.selectedElements.filter(isTransition).length === 1 isEnabled: context => !context.isReadonly && (
context.selectedElements.filter(isTransition).length === 1 ||
context.selectedElements.filter(isRefTransition).length === 1
),
isVisible: context => !context.isReadonly && (
context.selectedElements.filter(isTransition).length === 1 ||
context.selectedElements.filter(isRefTransition).length === 1
)
}) })
); );
} }
......
...@@ -17,7 +17,7 @@ import { GLSPCommandHandler, GLSPContextMenu } from '@eclipse-glsp/theia-integra ...@@ -17,7 +17,7 @@ import { GLSPCommandHandler, GLSPContextMenu } from '@eclipse-glsp/theia-integra
import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core'; import { CommandContribution, CommandRegistry, MenuContribution, MenuModelRegistry } from '@theia/core';
import { ApplicationShell } from '@theia/core/lib/browser'; import { ApplicationShell } from '@theia/core/lib/browser';
import { inject, injectable } from 'inversify'; import { inject, injectable } from 'inversify';
import { isPlace, ResetMarkingsOperation } from 'tasklist-glsp'; import { isPlace, ResetMarkingsOperation, isRefPlace } from 'tasklist-glsp';
export namespace ResetMarkingsCommand { export namespace ResetMarkingsCommand {
export const RESET_MARKINGS = 'reset-markings-command'; export const RESET_MARKINGS = 'reset-markings-command';
...@@ -31,7 +31,14 @@ export class ResetMarkingsCommandContribution implements CommandContribution { ...@@ -31,7 +31,14 @@ export class ResetMarkingsCommandContribution implements CommandContribution {
{ id: ResetMarkingsCommand.RESET_MARKINGS, label: 'Reset Markings' }, { id: ResetMarkingsCommand.RESET_MARKINGS, label: 'Reset Markings' },
new GLSPCommandHandler(this.shell, { new GLSPCommandHandler(this.shell, {
actions: context => [ResetMarkingsOperation.create()], actions: context => [ResetMarkingsOperation.create()],
isEnabled: context => !context.isReadonly && context.selectedElements.filter(isPlace).length === 1 isEnabled: context => !context.isReadonly && (
context.selectedElements.filter(isPlace).length === 1 ||
context.selectedElements.filter(isRefPlace).length == 1
),
isVisible: context => !context.isReadonly && (
context.selectedElements.filter(isPlace).length === 1 ||
context.selectedElements.filter(isRefPlace).length == 1
)
}) })
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment