Skip to content

Commit 8d452c2

Browse files
committed
small fixes
1 parent c578d0a commit 8d452c2

9 files changed

Lines changed: 72 additions & 93 deletions

File tree

example/workspace/bla.layout.xmi

Lines changed: 0 additions & 7 deletions
This file was deleted.

example/workspace/example.nmeta

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<nmeta:Namespace xmi:version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Uri="about:petriNet" Prefix="pn" Name="petriNets" Summary="Test" xmlns:xmi="http://www.omg.org/XMI" xmlns:nmeta="http://nmf.codeplex.com/nmeta/">
2+
<nmeta:Namespace xmi:version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Uri="about:petriNet" Prefix="pn" Name="petriNets" Summary="" xmlns:xmi="http://www.omg.org/XMI" xmlns:nmeta="http://nmf.codeplex.com/nmeta/">
33
<Types xsi:type="nmeta:Class" Identifier="#//PetriNet/name" Name="PetriNet">
4-
<References IsContainment="true" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="places" />
5-
<References IsContainment="true" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="transitionsss" />
6-
<References Opposite="#//Testerr/NewReference" ReferenceType="nmeta:Class #//Testerr" Name="Opposite" />
7-
<References IsContainment="true" ReferenceType="nmeta:Class #//Transition" Name="NewReference" />
8-
<Attributes DefaultValue="Da" IsOrdered="true" IsUnique="true" LowerBound="1" Type="nmeta:PrimitiveType http://nmf.codeplex.com/nmeta/#//String" Name="name" />
4+
<References IsContainment="true" ReferenceType="nmeta:Class #//Place" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="places" />
5+
<References IsContainment="true" ReferenceType="nmeta:Class #//Transition" UpperBound="-1" Name="transitions" />
6+
<Attributes DefaultValue="" IsOrdered="true" IsUnique="true" LowerBound="1" Type="nmeta:PrimitiveType http://nmf.codeplex.com/nmeta/#//String" Name="name" />
97
</Types>
10-
<Types xsi:type="nmeta:Class" IdentifierScope="Global" BaseTypes="http://nmf.codeplex.com/nmeta/#//Namespace http://nmf.codeplex.com/nmeta/#//StructuredType http://nmf.codeplex.com/nmeta/#//ReferenceType" Identifier="#//Testerr/name" Name="Testerr" Summary="Summary" Remarks="lk">
8+
<Types xsi:type="nmeta:Class" IdentifierScope="Global" Identifier="#//Place/name" Name="Place" Summary="" Remarks="">
119
<References Opposite="#//Transition/from" ReferenceType="nmeta:Class #//Transition" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="outgoing" />
1210
<References Opposite="#//Transition/to" ReferenceType="nmeta:Class #//Transition" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="incoming" />
13-
<References Opposite="#//PetriNet/Opposite" ReferenceType="nmeta:Class #//PetriNet" Name="NewReference" />
1411
<Attributes DefaultValue="" IsOrdered="true" IsUnique="true" LowerBound="1" Type="nmeta:PrimitiveType http://nmf.codeplex.com/nmeta/#//String" Name="name" />
15-
<Attributes DefaultValue="" Type="nmeta:PrimitiveType http://nmf.codeplex.com/nmeta/#//String" Name="NewAttributeee" />
1612
</Types>
1713
<Types xsi:type="nmeta:Class" Name="Transition">
18-
<References Opposite="#//Testerr/outgoing" ReferenceType="nmeta:Class #//Testerr" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="from" />
19-
<References Opposite="#//Testerr/incoming" ReferenceType="nmeta:Class #//Testerr" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="to" />
14+
<References Opposite="#//Place/outgoing" ReferenceType="nmeta:Class #//Place" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="from" />
15+
<References Opposite="#//Place/incoming" ReferenceType="nmeta:Class #//Place" IsOrdered="true" IsUnique="true" UpperBound="-1" Name="to" />
2016
<Attributes IsOrdered="true" IsUnique="true" Type="nmeta:PrimitiveType http://nmf.codeplex.com/nmeta/#//String" Name="input" />
2117
</Types>
22-
<Types xsi:type="nmeta:Class" Name="Test" />
23-
<Types xsi:type="nmeta:Class" Name="NewClass" />
24-
<Types xsi:type="nmeta:Class" Name="NewClass1" />
2518
</nmeta:Namespace>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<notation:Diagram xmi:version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.eclipse.org/glsp/notation">
3+
<elements xsi:type="notation:Shape" id="e0843e3a-11b7-4981-9c19-4decde4f361a" semanticElement="nmeta:Class about:petriNet#//PetriNet">
4+
<position x="-767.1140289306641" y="-187.49999999999994" />
5+
<size width="108.17304992675781" height="55" />
6+
</elements>
7+
<elements xsi:type="notation:Shape" id="b6f66673-acbe-4246-abc4-4a6420e023b5" semanticElement="nmeta:Class about:petriNet#//Place">
8+
<position x="-937.4569702148438" y="-47.49999999999996" />
9+
<size width="108.17304992675781" height="55" />
10+
</elements>
11+
<elements xsi:type="notation:Shape" id="2876812b-93d6-4558-9c83-f9ee5f05cd3f" semanticElement="nmeta:Class about:petriNet#//Transition">
12+
<position x="-596.5517578125" y="-58.499999999999964" />
13+
<size width="106.5517578125" height="55" />
14+
</elements>
15+
<elements xsi:type="notation:Edge" source="notation:Shape #//@elements.0" target="notation:Shape #//@elements.1" id="cae5f3b8-1760-4ae1-bc56-a64c747b28d5" semanticElement="nmeta:Reference about:petriNet#//PetriNet/places" />
16+
<elements xsi:type="notation:Edge" source="notation:Shape #//@elements.0" target="notation:Shape #//@elements.2" id="25f6a27a-d6ff-4700-9c43-62c6918faba8" semanticElement="nmeta:Reference about:petriNet#//PetriNet/transitions" />
17+
<elements xsi:type="notation:Edge" source="notation:Shape #//@elements.1" target="notation:Shape #//@elements.2" id="ae8f806a-8e38-4b6c-89f4-4d0a18b37f69" semanticElement="nmeta:Reference about:petriNet#//Place/outgoing">
18+
<bendPoints x="-750" y="30" />
19+
<bendPoints x="-660" y="30" />
20+
</elements>
21+
<elements xsi:type="notation:Edge" source="notation:Shape #//@elements.1" target="notation:Shape #//@elements.2" id="96b0c313-aaa3-4b17-8b5c-a2fef138e0f6" semanticElement="nmeta:Reference about:petriNet#//Place/incoming">
22+
<bendPoints x="-740" y="-40" />
23+
<bendPoints x="-660" y="-40" />
24+
</elements>
25+
<elements xsi:type="notation:Shape" id="d33a14b2-85ab-4d37-a6fb-d96947370199">
26+
<position x="-420" y="-140" />
27+
<size width="68.65034484863281" height="32" />
28+
</elements>
29+
<elements xsi:type="notation:Shape" id="213cef23-3539-42a6-83a0-076d7aeb329d">
30+
<position x="-180" y="-160" />
31+
<size width="68.65034484863281" height="32" />
32+
</elements>
33+
</notation:Diagram>

example/workspace/test.layout.xmi

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/nmeta-glsp-client/src/model.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ export class DefaultNode extends RectangularNode implements Nameable, WithEditab
6565
height: size.height
6666
};
6767
}
68+
69+
70+
71+
override set bounds(newBounds: Bounds) {
72+
this.position = {
73+
x: newBounds.x,
74+
y: newBounds.y
75+
};
76+
this.size = {
77+
width: newBounds.width,
78+
height: newBounds.height
79+
};
80+
}
6881
}
6982

7083
export class ElementLabel extends GLabel {

packages/nmeta-vscode/package.json

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@
4949
"category": "nmeta Diagram",
5050
"enablement": "activeCustomEditorId == 'nmeta.glspDiagram'"
5151
},
52-
{
53-
"command": "nmeta.goToNextNode",
54-
"title": "Go to next Node",
55-
"category": "nmeta Navigation",
56-
"enablement": "activeCustomEditorId == 'nmeta.glspDiagram' && nmeta.editorSelectedElementsAmount == 1"
57-
},
58-
{
59-
"command": "nmeta.goToPreviousNode",
60-
"title": "Go to previous Node",
61-
"category": "nmeta Navigation",
62-
"enablement": "activeCustomEditorId == 'nmeta.glspDiagram' && nmeta.editorSelectedElementsAmount == 1"
63-
},
6452
{
6553
"command": "nmeta.showDocumentation",
6654
"title": "Show documentation...",
@@ -115,18 +103,6 @@
115103
"mac": "alt+e",
116104
"command": "nmeta.exportAsSVG",
117105
"when": "activeCustomEditorId == 'nmeta.glspDiagram'"
118-
},
119-
{
120-
"key": "Ctrl+4",
121-
"mac": "cmd+4",
122-
"command": "nmeta.goToNextNode",
123-
"when": "activeCustomEditorId == 'nmeta.glspDiagram' && nmeta.editorSelectedElementsAmount == 1"
124-
},
125-
{
126-
"key": "Ctrl+3",
127-
"mac": "cmd+3",
128-
"command": "nmeta.goToPreviousNode",
129-
"when": "activeCustomEditorId == 'nmeta.glspDiagram' && nmeta.editorSelectedElementsAmount == 1"
130106
}
131107
],
132108
"menus": {
@@ -135,16 +111,6 @@
135111
"submenu": "nmeta.editor.title",
136112
"group": "bookmarks"
137113
},
138-
{
139-
"command": "nmeta.goToNextNode",
140-
"group": "navigation",
141-
"when": "activeCustomEditorId == 'nmeta.glspDiagram' && nmeta.editorSelectedElementsAmount == 1"
142-
},
143-
{
144-
"command": "nmeta.goToPreviousNode",
145-
"group": "navigation",
146-
"when": "activeCustomEditorId == 'nmeta.glspDiagram' && nmeta.editorSelectedElementsAmount == 1"
147-
},
148114
{
149115
"command": "nmeta.showDocumentation",
150116
"group": "navigation",
@@ -191,6 +157,7 @@
191157
"views": {
192158
"propertyPanel": [
193159
{
160+
"icon": "",
194161
"type": "webview",
195162
"id": "nmeta.propertyView",
196163
"name": "Properties",

packages/property-view/src/App.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,15 @@ const webSocketUrl = `ws://localhost:${port}/${id}`;
2929

3030
const classes = {
3131
container: {
32+
margin: '1rem',
3233
width: '100%',
3334
height: '100%',
3435
backgroundColor: 'var(--vscode-editor-background)',
3536
color: 'var(--vscode-editor-foreground)',
3637
},
3738
dataContent: {
38-
width: '100%',
39-
height: '100%',
4039
display: 'flex',
4140
justifyContent: 'center',
42-
marginBottom: '1rem',
4341
backgroundColor: 'var(--vscode-editor-background)',
4442
color: 'var(--vscode-editor-foreground)',
4543
}

packages/property-view/src/renderer/baseTypeControl.tsx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,16 @@ import { FormControl, Grid, IconButton, InputLabel, MenuItem, Select, Typography
44
import AddIcon from "@mui/icons-material/Add";
55
import DeleteIcon from '@mui/icons-material/Delete';
66
import { useState } from "react";
7-
import { BorderAllOutlined } from "@mui/icons-material";
87

9-
10-
interface BaseTypeControlProps{
8+
interface MultiSelectionControlProps{
119
data: any;
1210
handleChange(path: string, value: any): void;
1311
path: string;
1412
schema: JsonSchema
1513
}
1614

17-
const BaseTypeControl = ({data, handleChange, path, schema}: BaseTypeControlProps)=>{
18-
const [selectedBaseTypes, setSelectedBaseTypes] = useState(data ?? []);
15+
const MultiSelectionControl = ({data, handleChange, path, schema}: MultiSelectionControlProps)=>{
16+
const [items, setItems] = useState(data ?? []);
1917
const [filled, setFilled] = useState(true);
2018
const itemsSchema = schema?.items as any;
2119
const baseTypes = itemsSchema.oneOf;
@@ -26,24 +24,25 @@ const BaseTypeControl = ({data, handleChange, path, schema}: BaseTypeControlProp
2624
</Grid>
2725
<Grid item>
2826
<IconButton onClick={()=>{if(filled){
29-
setSelectedBaseTypes([...selectedBaseTypes, {const:'', title:''}])
27+
setItems([...items, {const:'', title:''}])
3028
setFilled(!filled);
3129
}}}><AddIcon sx={{color: 'var(--vscode-statusBarItem-remoteBackground)'}}/></IconButton>
3230
</Grid>
3331
</Grid>
34-
{selectedBaseTypes.length === 0? <Typography>Keine BaseTypes vorhanden</Typography> :
35-
selectedBaseTypes.map((value: any, index: number)=>(
36-
<FormControl size='small' sx={{width: '60%'}}>
32+
{items.length === 0
33+
? <Typography>No Items</Typography>
34+
: items.map((value: any, index: number)=>(
35+
<FormControl size='small' sx={{width: '80%'}}>
3736
<Grid container >
3837
<Grid item xs={11}>
3938
<Select fullWidth= {true}
4039
value={value}
4140
onChange={
4241
(e)=>{
43-
const changedValue = [...selectedBaseTypes];
42+
const changedValue = [...items];
4443
changedValue[index] = e.target.value;
4544
setFilled(true);
46-
setSelectedBaseTypes(changedValue);
45+
setItems(changedValue);
4746
handleChange(path, changedValue);
4847
}
4948
}
@@ -56,14 +55,14 @@ const BaseTypeControl = ({data, handleChange, path, schema}: BaseTypeControlProp
5655
<Grid item xs={1}>
5756
<IconButton onClick={
5857
(e)=>{
59-
const changedValue = [...selectedBaseTypes];
58+
const changedValue = [...items];
6059
if(changedValue[index].const===''){
6160
setFilled(true);
6261
}
6362
if (index > -1) {
6463
changedValue.splice(index, 1);
6564
}
66-
setSelectedBaseTypes(changedValue);
65+
setItems(changedValue);
6766
handleChange(path, changedValue);
6867
}
6968
}><DeleteIcon sx={{color: 'var(--vscode-statusBarItem-remoteBackground)'}}/></IconButton>
@@ -73,6 +72,6 @@ const BaseTypeControl = ({data, handleChange, path, schema}: BaseTypeControlProp
7372
))}
7473
</div>}
7574

76-
export default withJsonFormsControlProps(BaseTypeControl);
75+
export default withJsonFormsControlProps(MultiSelectionControl);
7776

7877

packages/property-view/src/renderer/counterControl.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,19 @@ const INT32_MIN = -2147483648;
1616
const INT32_MAX = 2147483647;
1717

1818
const clampToInt32 = (value: number) => {
19-
return Math.max(INT32_MIN, Math.min(INT32_MAX, Math.floor(value)));
19+
return Math.max(INT32_MIN, Math.min(INT32_MAX, Math.floor(value))) || 0;
2020
};
2121

2222
const CounterControl = ({ data, handleChange, path, schema}: CounterControlProps)=>{
2323

24-
const value = schema?.default|| 0;
25-
26-
24+
const value = data || schema?.default || 0;
2725

2826
const increment = () => {
29-
const newValue = value+1;
27+
const newValue = (+value)+1;
3028
handleChange(path, clampToInt32(newValue));
3129
}
3230
const decrement = () => {
33-
const newValue = value-1;
31+
const newValue = (+value)-1;
3432
handleChange(path, clampToInt32(newValue));
3533
}
3634

0 commit comments

Comments
 (0)