Skip to content

Commit

Permalink
mka feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakae committed Dec 22, 2023
1 parent a1b2800 commit 3e15ad8
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class FtaDiagramGenerator extends LangiumDiagramGenerator {

/** Saves the Ids of the generated SNodes */
protected idToSNode: Map<string, SNode> = new Map();

/** Saves the parent node of a gate */
protected parentOfGate: Map<string, SNode> = new Map();
/** Saves the description node of a gate */
Expand Down Expand Up @@ -117,7 +116,7 @@ export class FtaDiagramGenerator extends LangiumDiagramGenerator {
sourceNode?.children?.push(this.createFTAPort(sourcePortId, PortSide.SOUTH));

// create port for source parent and edge to this port
let sourceParentPortId: string | undefined = undefined;
let sourceParentPortId: string | undefined;
if (this.parentOfGate.has(sourceId)) {
const parent = this.parentOfGate.get(sourceId);
sourceParentPortId = idCache.uniqueId(edgeId + "_port");
Expand Down
17 changes: 3 additions & 14 deletions extension/src-language-server/fta/diagram/fta-layout-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,11 @@ export class FtaLayoutConfigurator extends DefaultLayoutConfigurator {
return options;
}

protected portOptions(sport: FTAPort, index: SModelIndex): LayoutOptions | undefined {
protected portOptions(sport: FTAPort, _index: SModelIndex): LayoutOptions | undefined {
if (sport.type === FTA_PORT_TYPE) {
let side = "";
switch ((sport as FTAPort).side) {
case PortSide.WEST:
side = "WEST";
break;
case PortSide.EAST:
side = "EAST";
break;
case PortSide.NORTH:
side = "NORTH";
break;
case PortSide.SOUTH:
side = "SOUTH";
break;
if ((sport as FTAPort).side) {
side = PortSide[(sport as FTAPort).side!].toUpperCase();
}
return {
"org.eclipse.elk.port.side": side,
Expand Down
2 changes: 1 addition & 1 deletion extension/src-language-server/fta/diagram/fta-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ export enum PortSide {
EAST,
NORTH,
SOUTH
}
}
12 changes: 6 additions & 6 deletions extension/src-language-server/layout-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export class LayoutEngine extends ElkLayoutEngine {
}
if (elkEdge.sections && elkEdge.sections.length > 0) {
const section = elkEdge.sections[0];
if (section.startPoint) points.push(section.startPoint);
if (section.bendPoints) points.push(...section.bendPoints);
if (section.endPoint) points.push(section.endPoint);
if (section.startPoint) { points.push(section.startPoint); }
if (section.bendPoints) { points.push(...section.bendPoints); }
if (section.endPoint) { points.push(section.endPoint); }
} else if (isPrimitiveEdge(elkEdge)) {
if (elkEdge.sourcePoint) points.push(elkEdge.sourcePoint);
if (elkEdge.bendPoints) points.push(...elkEdge.bendPoints);
if (elkEdge.targetPoint) points.push(elkEdge.targetPoint);
if (elkEdge.sourcePoint) { points.push(elkEdge.sourcePoint); }
if (elkEdge.bendPoints) { points.push(...elkEdge.bendPoints); }
if (elkEdge.targetPoint) { points.push(elkEdge.targetPoint); }
}
sedge.routingPoints = points;

Expand Down
5 changes: 2 additions & 3 deletions extension/src-language-server/stpa/stpa-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ import {
import {
DefaultElementFilter,
ElkFactory,
ElkLayoutEngine,
IElementFilter,
ILayoutConfigurator,
ILayoutConfigurator
} from "sprotty-elk/lib/elk-layout";
import { LayoutEngine } from "../layout-engine";
import { IDEnforcer } from "./ID-enforcer";
import { ContextTableProvider } from "./contextTable/context-dataProvider";
import { StpaDiagramGenerator } from "./diagram/diagram-generator";
import { StpaLayoutConfigurator } from "./diagram/layout-config";
import { StpaSynthesisOptions } from "./diagram/stpa-synthesis-options";
import { StpaScopeProvider } from "./stpa-scopeProvider";
import { StpaValidationRegistry, StpaValidator } from "./stpa-validator";
import { LayoutEngine } from "../layout-engine";

/**
* Declaration of custom services - add your own service classes here.
Expand Down
2 changes: 1 addition & 1 deletion extension/src-language-server/synthesis-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@ export class SynthesisOptions {
getModelOrder(): boolean {
return this.getOption(modelOrderID)?.currentValue;
}
}
}
2 changes: 1 addition & 1 deletion extension/src-webview/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ export namespace MinimalCutSetAnalysisAction {
startId,
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export class PastaContextMenuMouseListener extends ContextMenuMouseListener {
super.showContextMenu(target, event);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { CutSetAnalysisAction, MinimalCutSetAnalysisAction } from "../actions";

@injectable()
export class ContextMenuProvider implements IContextMenuItemProvider {
getItems(root: Readonly<SModelRoot>, lastMousePosition?: Point | undefined): Promise<LabeledAction[]> {
getItems(root: Readonly<SModelRoot>, _lastMousePosition?: Point | undefined): Promise<LabeledAction[]> {
if (root.type === FTA_GRAPH_TYPE) {
// find node that was clicked on
let clickedNode: FTANode | undefined;
Expand Down
2 changes: 1 addition & 1 deletion extension/src-webview/css/context-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
color: var(--vscode-menu-selectionForeground);
}

/* --vscode-menu-separatorBackground: #d4d4d4; */
/* --vscode-menu-separatorBackground: #d4d4d4; */
2 changes: 1 addition & 1 deletion extension/src-webview/css/fta-diagram.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@

.top-event {
stroke: dodgerblue;
}
}
2 changes: 1 addition & 1 deletion extension/src-webview/fta/fta-views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@ export class FTAGraphView extends SGraphView {
}
}

}
}
2 changes: 1 addition & 1 deletion extension/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ export namespace MinimalCutSetAnalysisAction {
startId,
};
}
}
}

0 comments on commit 3e15ad8

Please sign in to comment.