Skip to content

Commit 001e9b9

Browse files
committed
Merge branch 'main' of https://github.com/DataFlowAnalysis/OnlineEditor into rename
2 parents b3465a1 + aae023e commit 001e9b9

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed

backend/analysisBackendServer/releng/org.dataflowanalysis.standalone.targetplatform/org.dataflowanalysis.standalone.targetplatform.targetplatform.target

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
<repository location="https://updatesite.palladio-simulator.com/palladio-supporting-workflowengine/nightly/"/>
2121
</location>
2222
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="false" type="InstallableUnit">
23-
<unit id="tools.mdsd.library.emfeditutils" version="0.0.0"/>
2423
<repository location="https://updatesite.mdsd.tools/library-emfeditutils/nightly/"/>
24+
<unit id="tools.mdsd.library.emfeditutils.feature.feature.group" version="0.2.0.202510010711"/>
2525
</location>
2626
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="false" type="InstallableUnit">
2727
<unit id="tools.mdsd.library.standalone.initialization.log4j" version="0.0.0"/>

frontend/webEditor/src/features/autoLayout/command.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export namespace LayoutModelAction {
1414

1515
export function create(): LayoutModelAction {
1616
return {
17-
kind: KIND
17+
kind: KIND,
1818
};
1919
}
2020
}
@@ -35,7 +35,7 @@ export class LayoutModelCommand extends Command {
3535

3636
private oldModelSchema?: SModelRoot;
3737
private newModel?: SModelRootImpl;
38-
private usedMethod?: LayoutMethod
38+
private usedMethod?: LayoutMethod;
3939

4040
constructor() {
4141
super();
@@ -48,7 +48,10 @@ export class LayoutModelCommand extends Command {
4848
if (!this.layoutEngine) throw new Error("Missing injects");
4949

5050
this.usedMethod = this.settingsManager?.layoutMethod ?? LayoutMethod.LINES;
51-
if (this.settingsManager && (this.usedMethod === LayoutMethod.WRAPPING || this.usedMethod === LayoutMethod.CIRCLES)) {
51+
if (
52+
this.settingsManager &&
53+
(this.usedMethod === LayoutMethod.WRAPPING || this.usedMethod === LayoutMethod.CIRCLES)
54+
) {
5255
this.oldHideLabels = this.settingsManager.hideEdgeLabels;
5356
this.settingsManager.hideEdgeLabels = true;
5457
}
@@ -88,7 +91,10 @@ export class LayoutModelCommand extends Command {
8891
// No new model saved because the layout was not executed due to read-only mode.
8992
return context.root;
9093
}
91-
if (this.settingsManager && (this.usedMethod === LayoutMethod.WRAPPING || this.usedMethod === LayoutMethod.CIRCLES)) {
94+
if (
95+
this.settingsManager &&
96+
(this.usedMethod === LayoutMethod.WRAPPING || this.usedMethod === LayoutMethod.CIRCLES)
97+
) {
9298
this.settingsManager.hideEdgeLabels = true;
9399
}
94100

frontend/webEditor/src/features/dfdElements/behaviorRefactorer.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ export class DFDBehaviorRefactorer {
9595
}
9696

9797
private renameLabelsForPort(port: DfdOutputPortImpl, labelChanges: LabelChange[], tree: ReplaceAutoCompleteTree) {
98-
let lines = port.behavior.split(/\n/);
98+
let lines = port.getBehavior().split(/\n/);
9999
for (const change of labelChanges) {
100100
lines = tree.replace(lines, { old: change.oldLabel, replacement: change.newLabel, type: "Label" });
101101
}
102-
port.behavior = lines.join("\n");
102+
port.setBehavior(lines.join("\n"));
103103
}
104104

105105
private traverseDfdOutputPorts(element: SModelElementImpl, cb: (port: DfdOutputPortImpl) => void) {
@@ -148,7 +148,7 @@ export class DFDBehaviorRefactorer {
148148
newInputName: string,
149149
tree: ReplaceAutoCompleteTree,
150150
): string {
151-
const lines = port.behavior.split("\n");
151+
const lines = port.getBehavior().split("\n");
152152
const newLines = tree.replace(lines, { old: oldInputName, replacement: newInputName, type: "Input" });
153153
return newLines.join("\n");
154154
}
@@ -211,9 +211,9 @@ export class RefactorInputNameInDFDBehaviorCommand extends Command {
211211
behaviorChanges.forEach((updatedBehavior, id) => {
212212
const port = context.root.index.getById(id);
213213
if (port instanceof DfdOutputPortImpl) {
214-
this.oldBehaviors.set(id, port.behavior);
214+
this.oldBehaviors.set(id, port.getBehavior());
215215
this.newBehaviors.set(id, updatedBehavior);
216-
port.behavior = updatedBehavior;
216+
port.setBehavior(updatedBehavior);
217217
}
218218
});
219219

@@ -224,7 +224,7 @@ export class RefactorInputNameInDFDBehaviorCommand extends Command {
224224
this.oldBehaviors.forEach((oldBehavior, id) => {
225225
const port = context.root.index.getById(id);
226226
if (port instanceof DfdOutputPortImpl) {
227-
port.behavior = oldBehavior;
227+
port.setBehavior(oldBehavior);
228228
}
229229
});
230230

@@ -235,7 +235,7 @@ export class RefactorInputNameInDFDBehaviorCommand extends Command {
235235
this.newBehaviors.forEach((newBehavior, id) => {
236236
const port = context.root.index.getById(id);
237237
if (port instanceof DfdOutputPortImpl) {
238-
port.behavior = newBehavior;
238+
port.setBehavior(newBehavior);
239239
}
240240
});
241241

frontend/webEditor/src/features/dfdElements/outputPortEditUi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export class OutputPortEditUI extends AbstractUIExtension implements Switchable
242242
// Delay update to the next event loop tick to ensure the refactoring is done.
243243
setTimeout(() => {
244244
if (this.editor && this.port) {
245-
this.editor?.setValue(this.port?.behavior);
245+
this.editor?.setValue(this.port?.getBehavior());
246246
}
247247
}, 0);
248248
});
@@ -309,7 +309,7 @@ export class OutputPortEditUI extends AbstractUIExtension implements Switchable
309309
}
310310

311311
// Load the current behavior text of the port into the text editor.
312-
this.editor?.setValue(this.port.behavior);
312+
this.editor?.setValue(this.port.getBehavior());
313313
this.editor?.getModel()?.setEOL(monaco.editor.EndOfLineSequence.LF);
314314
this.resizeEditor();
315315

@@ -463,15 +463,15 @@ export class SetDfdOutputPortBehaviorCommand extends Command {
463463

464464
execute(context: CommandExecutionContext): CommandReturn {
465465
const port = context.root.index.getById(this.action.portId) as DfdOutputPortImpl;
466-
this.oldBehavior = port.behavior;
467-
port.behavior = this.action.behavior;
466+
this.oldBehavior = port.getBehavior();
467+
port.setBehavior(this.action.behavior);
468468
return context.root;
469469
}
470470

471471
undo(context: CommandExecutionContext): CommandReturn {
472472
const port = context.root.index.getById(this.action.portId) as DfdOutputPortImpl;
473473
if (this.oldBehavior) {
474-
port.behavior = this.oldBehavior;
474+
port.setBehavior(this.oldBehavior);
475475
}
476476

477477
return context.root;

frontend/webEditor/src/features/dfdElements/ports.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,9 @@ export interface DfdOutputPort extends SPort {
9696
export class DfdOutputPortImpl extends SPortImpl {
9797
static readonly DEFAULT_FEATURES = [...defaultPortFeatures, withEditLabelFeature];
9898

99-
private _behavior: string = "";
100-
private tree: AutoCompleteTree;
99+
private behavior: string = "";
101100
private validBehavior: boolean = true;
102101

103-
constructor() {
104-
super();
105-
this.tree = new AutoCompleteTree(TreeBuilder.buildTree(labelTypeRegistry, this));
106-
}
107-
108102
override get bounds(): Bounds {
109103
return {
110104
x: this.position.x,
@@ -145,19 +139,21 @@ export class DfdOutputPortImpl extends SPortImpl {
145139
return style;
146140
}
147141

148-
get behavior(): string {
149-
return this._behavior;
150-
}
151-
152-
set behavior(value: string) {
153-
this._behavior = value;
142+
public setBehavior(value: string) {
143+
this.behavior = value;
154144
if (value === "") {
155145
this.validBehavior = true;
156146
return;
157147
}
158-
const errors = this.tree.verify(this.behavior.split("\n"));
148+
const errors = new AutoCompleteTree(TreeBuilder.buildTree(labelTypeRegistry, this)).verify(
149+
this.behavior.split("\n"),
150+
);
159151
this.validBehavior = errors.length === 0;
160152
}
153+
154+
public getBehavior() {
155+
return this.behavior;
156+
}
161157
}
162158

163159
@injectable()

0 commit comments

Comments
 (0)