This repository was archived by the owner on Oct 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Constraint select #171
Merged
Merged
Constraint select #171
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5626595
Feat: Implement Constraint Selection, Incoming/Outgoing Selection
01Parzival10 f91e553
Feat: adjust commands
01Parzival10 4dada2d
Feat: Constraint registry
01Parzival10 8acf1ec
Merge: single constraint input and fix issues
01Parzival10 c861bd1
Merge: single constraint input and fix issues
01Parzival10 b50da70
Fix: linter console
01Parzival10 169acfd
Merge branch 'main' of https://github.com/DataFlowAnalysis/WebEditor …
01Parzival10 6432b8f
Feat: Set standard mode to incoming labels
01Parzival10 5ca543f
Fix : Set correct websocket address
01Parzival10 402ccc6
Merge branch 'main' into constraintSelect
Entenwilli a6c49d4
Clean up nodes.tsx
01Parzival10 4e13533
Fix: Menu Icon, Menu unresponsive bug, checkbox behavior, constraint …
01Parzival10 43ea32c
Fix: webSocket IP, superflous var
01Parzival10 091e5e4
Merge branch 'main' into constraintSelect
01Parzival10 72c709b
fix border color
Kr0nox 3e76258
Merge branch 'constraintSelect' of https://github.com/DataFlowAnalysi…
Kr0nox 4b8eeaa
extract color constants to css
Kr0nox 3eae274
Fix: Completly get rid of constraint keywords
01Parzival10 a513e13
Merge branch 'constraintSelect' of https://github.com/DataFlowAnalysi…
01Parzival10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { Action } from "sprotty-protocol"; | ||
|
|
||
| export interface ChooseConstraintAction extends Action { | ||
| kind: typeof ChooseConstraintAction.KIND; | ||
| names: string[]; | ||
| } | ||
|
|
||
| export namespace ChooseConstraintAction { | ||
| export const KIND = "choose-constraint"; | ||
|
|
||
| export function create(names: string[]): ChooseConstraintAction { | ||
| return { kind: KIND, names }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { inject, injectable } from "inversify"; | ||
| import { Command, CommandExecutionContext, CommandReturn, TYPES } from "sprotty"; | ||
| import { DfdNodeImpl } from "../dfdElements/nodes"; | ||
| import { ChooseConstraintAction } from "./actions"; | ||
| import { getBasicType } from "sprotty-protocol"; | ||
| import { AnnnotationsManager } from "../settingsMenu/annotationManager"; | ||
| import { ConstraintRegistry } from "./constraintRegistry"; | ||
|
|
||
| @injectable() | ||
| export class ChooseConstraintCommand extends Command { | ||
| static readonly KIND = ChooseConstraintAction.KIND; | ||
|
|
||
| constructor( | ||
| @inject(TYPES.Action) private action: ChooseConstraintAction, | ||
| @inject(AnnnotationsManager) private annnotationsManager: AnnnotationsManager, | ||
| @inject(ConstraintRegistry) private constraintRegistry: ConstraintRegistry, | ||
| ) { | ||
| super(); | ||
| } | ||
|
|
||
| execute(context: CommandExecutionContext): CommandReturn { | ||
| this.annnotationsManager.clearTfgs(); | ||
| const names = this.action.names; | ||
| this.constraintRegistry.setSelectedConstraints(names); | ||
|
|
||
| const nodes = context.root.children.filter((node) => getBasicType(node) === "node") as DfdNodeImpl[]; | ||
| if (names.length === 0) { | ||
| nodes.forEach((node) => { | ||
| node.setColor("var(--color-primary)"); | ||
| }); | ||
| return context.root; | ||
| } | ||
|
|
||
| nodes.forEach((node) => { | ||
| const annotations = node.annotations!; | ||
| let wasAdjusted = false; | ||
| if (this.constraintRegistry.selectedContainsAllConstraints()) { | ||
| annotations.forEach((annotation) => { | ||
| if (annotation.message.startsWith("Constraint")) { | ||
| wasAdjusted = true; | ||
| node.setColor(annotation.color!); | ||
| } | ||
| }); | ||
| } | ||
| names.forEach((name) => { | ||
| annotations.forEach((annotation) => { | ||
| if (annotation.message.startsWith("Constraint ") && annotation.message.split(" ")[1] === name) { | ||
| node.setColor(annotation.color!); | ||
| wasAdjusted = true; | ||
| this.annnotationsManager.addTfg(annotation.tfg!); | ||
| } | ||
| }); | ||
| }); | ||
| if (!wasAdjusted) node.setColor("var(--color-primary)"); | ||
| }); | ||
|
|
||
| nodes.forEach((node) => { | ||
| const inTFG = node.annotations!.filter((annotation) => | ||
| this.annnotationsManager.getSelectedTfgs().has(annotation.tfg!), | ||
| ); | ||
| if (inTFG.length > 0) node.setColor("var(--color-highlighted)", false); | ||
| }); | ||
|
|
||
| return context.root; | ||
| } | ||
|
|
||
| undo(context: CommandExecutionContext): CommandReturn { | ||
| return context.root; | ||
| } | ||
| redo(context: CommandExecutionContext): CommandReturn { | ||
| return context.root; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,23 @@ | ||
| import { ContainerModule } from "inversify"; | ||
| import { EDITOR_TYPES } from "../../utils"; | ||
| import { ConstraintMenu } from "./ConstraintMenu"; | ||
| import { TYPES } from "sprotty"; | ||
| import { configureCommand, TYPES } from "sprotty"; | ||
| import { ConstraintRegistry } from "./constraintRegistry"; | ||
| import { SWITCHABLE } from "../settingsMenu/themeManager"; | ||
| import { ChooseConstraintCommand } from "./commands"; | ||
|
|
||
| // This module contains an UI extension that adds a tool palette to the editor. | ||
| // This tool palette allows the user to create new nodes and edges. | ||
| // Additionally it contains the tools that are used to create the nodes and edges. | ||
|
|
||
| export const constraintMenuModule = new ContainerModule((bind) => { | ||
| export const constraintMenuModule = new ContainerModule((bind, unbind, isBound, rebind) => { | ||
| bind(ConstraintRegistry).toSelf().inSingletonScope(); | ||
|
|
||
| bind(ConstraintMenu).toSelf().inSingletonScope(); | ||
| bind(TYPES.IUIExtension).toService(ConstraintMenu); | ||
| bind(EDITOR_TYPES.DefaultUIElement).toService(ConstraintMenu); | ||
| bind(SWITCHABLE).toService(ConstraintMenu); | ||
|
|
||
| const context = { bind, unbind, isBound, rebind }; | ||
| configureCommand(context, ChooseConstraintCommand); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.