Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

diagram snippets #31

Merged
merged 88 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
26982b0
added template panel
May 16, 2022
6f3726b
added rendering of template (WIP)
May 17, 2022
6155cc0
get correct model renderer
May 17, 2022
a1ff403
fixed invisble edges and labels due to rendering templates
May 18, 2022
7e3e282
restructured template code
May 18, 2022
c406608
added workspaceedit when clicking on template
May 19, 2022
46e528e
restructuring
May 19, 2022
a374fcd
fixed wrong sourceUri for files except the first
May 19, 2022
05c6f9d
added linter
May 19, 2022
d3aee7f
Merge branch 'jep/dsl' into jep/templates
May 19, 2022
07dff9b
clicking on a template send ID of it to server + tamplate calculates pos
May 20, 2022
34f0b67
fixed StpaTemplate file
May 20, 2022
4e49922
splitted Template into Language- and WebviewTemplate
May 20, 2022
34d7b1b
modified test template to simple control structure template
May 20, 2022
9f6a41e
correct node sizes for template graphs
May 23, 2022
4da3302
registered css files
May 25, 2022
f9b8c21
adjusted canvasBounds + added parent for each template
May 25, 2022
398b80a
Merge branch 'jep/dsl' into jep/templates
Jun 1, 2022
468ebd5
deleted coordinates of ExecuteTemplate action
Jun 1, 2022
8e0804a
automatic generation of template graph
Jun 3, 2022
8ab54b6
adjusted heights of the rendered templates
Jun 3, 2022
d09d743
adjusted position calculation of CS templates
Jun 3, 2022
d62e892
templates have unique IDs even when used multiple times
Jun 3, 2022
982849d
added shortIDs for templates
Jun 7, 2022
19c7158
added default templates
Jun 7, 2022
54c7b2d
Merge branch 'master' into jep/templates
Jun 9, 2022
16382b6
added visualization of localSource in activityBar
Jun 10, 2022
c0c4c63
own webview for templates (WIP)
Drakae Jun 24, 2022
2d00b29
test template is shown in activitybar
Jun 28, 2022
2f2e8aa
deleted generated file
Jun 28, 2022
3301eb3
restructuring
Jun 28, 2022
88b8155
webview gets templates from the languageserver
Jun 28, 2022
cf695bb
adjusted ids of template svgs
Jun 28, 2022
1c14174
fixed bug: language server not rdy yet
Jun 28, 2022
b849408
fixed classes of templates
Jun 29, 2022
ff7ba5f
mouse click sends execute template action
Jun 29, 2022
84e7260
clean up
Jun 29, 2022
b0e46d8
activated singleton view
Jun 29, 2022
9100c6f
added command to add custom templates (WIP)
Jul 5, 2022
8098e45
catch templates for which no graph could be generated
Jul 5, 2022
2c6b319
improved robustness
Jul 6, 2022
8759fa7
added unique IDs for multiple uses of custom templates
Jul 7, 2022
d8d94b1
custom templates are saved in config file
Jul 8, 2022
6a60a57
restructuring
Jul 8, 2022
bbacd9c
deault temps are saved in config + fixed multiple temps bug
Jul 8, 2022
fe2eba0
added bnt in the temp activitybar to add templates
Jul 11, 2022
033f3df
added warning msg if creation of template failed
Jul 13, 2022
200e68f
add highlighting of focused template
Jul 13, 2022
f5c05a0
clicking on template moves editor to the position the template is added
Jul 13, 2022
5254dd6
dangling edges in custom templates are deleted
Jul 14, 2022
e5951c3
template highlighting for light theme
Jul 19, 2022
c651b5b
Merge branch 'master' into jep/activityBar
Jul 27, 2022
195e684
Merge branch 'master' into jep/activityBar
Aug 3, 2022
ebfb3ed
restructuring
Oct 18, 2022
6fb3bc8
Merge branch 'master' into jep/activityBar
Oct 18, 2022
bb5d495
Merge branch 'master' into jep/activityBar
Nov 4, 2022
273071c
fix merge
Nov 4, 2022
3baafc9
adjusted webpack config
Nov 4, 2022
ea038da
merge master
Drakae Apr 12, 2024
a1c807e
fixed merge (WIP)
Drakae Apr 15, 2024
d76f257
fixed execution of snippets
Drakae Apr 17, 2024
0a53f1f
fixed adding snippet
Drakae Apr 17, 2024
a94224d
fixed linter problems
Drakae Apr 17, 2024
97a6e66
renaming + restructuring (WIP)
Drakae Apr 17, 2024
b5a6af6
renaming + restructuring (WIP)
Drakae Apr 19, 2024
c43cd3b
renaming
Drakae Apr 19, 2024
fa2eb1d
fix insert position of snippet
Drakae Apr 19, 2024
78a050a
renaming
Drakae Apr 22, 2024
d346797
restructuring + comments
Drakae Apr 23, 2024
3c1a8ae
clean up in webview folder
Drakae Apr 24, 2024
65580fe
clean up (WIP)
Drakae May 7, 2024
c7d4a77
clean up
Drakae May 8, 2024
300e1d3
improved getSnippetAST
Drakae May 8, 2024
2597952
separate module for snippet renderer
Drakae May 8, 2024
448f912
scaling for snippets
Drakae May 8, 2024
d6a0487
fixed dangling edges in custom snippets
Drakae May 14, 2024
5926d34
mka review (WIP)
Drakae May 14, 2024
81a9e25
fixed incorrect import
Drakae May 14, 2024
b8cdc67
fix deletion of dangling edges
Drakae May 15, 2024
8dbc82a
fix selection of inserted text of snippet
Drakae May 15, 2024
773ec7e
default snippets are provided in a json file
Drakae May 15, 2024
3b30c73
fix adding of snippets - graph name is correclty added
Drakae May 16, 2024
c5e45c4
formatting
Drakae May 16, 2024
ac42c0f
improved calculation of unique names for nodes in snippets
Drakae May 16, 2024
fd7a781
fixed reveal range when inserting snippet
Drakae May 16, 2024
dd304e7
improve calculation of unique node IDs for snippets
Drakae May 16, 2024
22516d8
added default snippet for CS with children
Drakae May 22, 2024
c84e248
fixed missing newlines
Drakae May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extension/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"dist",
"**/*.d.ts",
"webpack.config.js",
"pack"
"pack",
"**/generated/"
]
}
42 changes: 39 additions & 3 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
"type": "boolean",
"default": true,
"description": "Check whether all UCAs are covered by safety requirements"
},
"pasta.stpa.snippets": {
"type": "string[]",
"default": [],
"description": "Diagram snippets for STPA"
}
}
},
Expand Down Expand Up @@ -186,6 +191,11 @@
"command": "pasta.fta.minimalCutSets",
"title": "Generate the minimal cut sets",
"category": "Cut Sets"
},
{
"command": "pasta.stpa.snippets.add",
"title": "Add STPA Diagram Snippet",
"category": "STPA Snippets"
}
],
"menus": {
Expand Down Expand Up @@ -215,8 +225,7 @@
"when": "pasta-diagram-focused"
},
{
"command": "pasta.diagram.export",
"when": "pasta-diagram-focused"
"command": "pasta.diagram.export"
},
{
"command": "pasta.stpa.checks.setCheckResponsibilitiesForConstraints",
Expand Down Expand Up @@ -246,6 +255,10 @@
"command": "pasta.stpa.ft.generation",
"when": "editorLangId == 'stpa'"
},
{
"command": "pasta.stpa.snippets.add",
"when": "editorLangId == 'stpa'"
},
{
"command": "pasta.fta.cutSets",
"when": "editorLangId == 'fta'"
Expand Down Expand Up @@ -288,6 +301,11 @@
"command": "pasta.stpa.ft.generation",
"when": "editorLangId == 'stpa'",
"group": "stpa"
},
{
"command": "pasta.stpa.snippets.add",
"when": "editorLangId == 'stpa'",
"group": "navigation"
}
],
"pasta.stpa.checks": [
Expand Down Expand Up @@ -396,7 +414,25 @@
"command": "pasta.IDs.redo",
"when": "editorTextFocus"
}
]
],
"viewsContainers": {
"activitybar": [
{
"id": "pasta",
"title": "PASTA",
"icon": "./icon.png"
}
]
},
"views": {
"pasta": [
{
"type": "webview",
"id": "stpa-snippets",
"name": "STPA Snippets"
}
]
}
},
"activationEvents": [
"onLanguage:stpa",
Expand Down
62 changes: 62 additions & 0 deletions extension/src-diagram-snippets/actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2022-2024 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/

interface Action {
kind: string;
}

/** Message to the language server to add definition of a selected snippet in the editor. */
export interface ExecuteSnippetAction extends Action {
kind: typeof ExecuteSnippetAction.KIND;
id: string;
}

export namespace ExecuteSnippetAction {
export const KIND = "executeSnippet";

export function create(id: string): ExecuteSnippetAction {
return {
kind: KIND,
id,
};
}

export function isThisAction(action: Action): action is ExecuteSnippetAction {
return action.kind === ExecuteSnippetAction.KIND;
}
}

/** Message to the language server to add a snippet to the librabry. */
export interface AddSnippetAction extends Action {
kind: typeof AddSnippetAction.KIND;
text: string;
}

export namespace AddSnippetAction {
export const KIND = "addSnippet";

export function create(text: string): AddSnippetAction {
return {
kind: KIND,
text,
};
}

export function isThisAction(action: Action): action is AddSnippetAction {
return action.kind === AddSnippetAction.KIND;
}
}
157 changes: 157 additions & 0 deletions extension/src-diagram-snippets/css/diagram.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/*
* KIELER - Kiel Integrated Environment for Layout Eclipse RichClient
*
* http://rtsys.informatik.uni-kiel.de/kieler
*
* Copyright 2023 by
* + Kiel University
* + Department of Computer Science
* + Real-Time and Embedded Systems Group
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
*/

@import "./options.css";
Drakae marked this conversation as resolved.
Show resolved Hide resolved
@import "./sidebar.css";
@import "./theme.css";
@import "./stpa-diagram.css";

.header {
text-decoration-line: underline;
font-weight: bold;
}

/* sprotty and black/white colors */
.vscode-high-contrast .print-node {
fill: black;
stroke: white;
}

.vscode-high-contrast .sprotty-node {
fill: #0c598d;
stroke: black;
}

.vscode-dark .print-node {
fill: var(--dark-node);
stroke: var(--vscode-editor-foreground);
}

.vscode-dark .sprotty-node {
fill: #0c598d;
stroke: black;
}

.vscode-light .print-node {
fill: var(--light-node);
stroke: black;
}

.vscode-light .sprotty-node {
fill: #50b1f1;
stroke: black;
}

.print-edge {
stroke: var(--vscode-editor-foreground);
}

.print-edge-arrow {
fill: var(--vscode-editor-foreground);
stroke: var(--vscode-editor-foreground);
}

/* Selected node */
.sprotty-node.selected {
stroke-width: 2;
stroke: var(--vscode-button-hover-background);
}

.node-selected {
stroke-width: 5;
stroke: var(--vscode-button-hover-background);
}

/* greyed out element */
.greyed-out {
opacity: 0.2;
}

/* label */
body[class='vscode-light'] .sprotty-label {
fill: black;
stroke-width: 0;
cursor: default;
}

.sprotty-label {
fill: var(--vscode-editorActiveLineNumber-foreground);
stroke-width: 0;
font-family: Arial, sans-serif;
cursor: default;
}

.sprotty-button {
fill: var(--vscode-editorActiveLineNumber-foreground);
}

/* Sprotty edges */
body[class='vscode-light'] .sprotty-edge .sprotty-label {
fill: black
}

.sprotty-edge .sprotty-label {
fill: var(--vscode-editorActiveLineNumber-foreground);
}

body[class='vscode-light'] .sprotty-edge {
fill: none;
stroke: black;
stroke-width: 2px;
}

.sprotty-edge {
fill: none;
stroke: var(--vscode-editorActiveLineNumber-foreground);
stroke-width: 2px;
}

body[class='vscode-light'] .sprotty-edge-arrow {
fill: black
}

.sprotty-edge-arrow {
fill: var(--vscode-editorActiveLineNumber-foreground);
}

.sprotty-edge>.sprotty-routing-handle {
fill: var(--vscode-editor-selectionBackground);
stroke: none;
z-index: 1000;
}

.sprotty-edge>.sprotty-routing-handle[data-kind='line'] {
opacity: 0.35;
}

.sprotty-edge>.sprotty-routing-handle.selected {
fill: var(--vscode-editor-selectionHighlightBackground);
}

.sprotty-edge>.sprotty-routing-handle.mouseover {
stroke: var(--vscode-editor-symbolHighlightBackground);
stroke-width: 1;
}

.sprotty-edge.mouseover:not(.selected) {
stroke-width: 3px;
}

.sprotty-hidden {
width: 0px;
height: 0px;
}
Loading
Loading