Skip to content

Commit

Permalink
[4547] Adapt the VSCode extension to the use of SemanticData#id as ed…
Browse files Browse the repository at this point in the history
…itingContextId

Bug: #4547
Signed-off-by: Guillaume Coutable <[email protected]>
  • Loading branch information
gcoutable authored and sbegaudeau committed Feb 13, 2025
1 parent eb763fa commit 30b10cf
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Now they are executed for some data if the data was coming from a studio too.
- https://github.com/eclipse-sirius/sirius-web/issues/4544[#4544] [diagram] Fix an issue where quicktools could be misaligned by ensuring now that all quick tools provided by Sirius Web are 24px in width and 24px in height
- https://github.com/eclipse-sirius/sirius-web/issues/4523[#4523] [diagram] Fix an issue that caused the palette to be unopenable during a fit view
- https://github.com/eclipse-sirius/sirius-web/issues/4557[#4557] [sirius-web] Fix an issue where targetObjectURI was not set in manifest.json during the download of a project
- https://github.com/eclipse-sirius/sirius-web/issues/4547[#4547] [vs-code] Adapt the VSCode extension to the use of SemanticData#id as editingContextId


=== New Features
Expand Down
2 changes: 1 addition & 1 deletion vscode-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"@mui/icons-material": "5.15.19",
"@mui/material": "5.15.19",
"@xstate/react": "3.0.0",
"@xyflow/react": "12.2.1",
"axios": "0.21.4",
"d3": "7.0.0",
"elkjs": "0.8.2",
Expand All @@ -155,7 +156,6 @@
"notistack": "3.0.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"@xyflow/react": "12.2.1",
"reflect-metadata": "0.1.13",
"subscriptions-transport-ws": "0.11.0",
"uuid": "8.3.2",
Expand Down
4 changes: 2 additions & 2 deletions vscode-extension/src/data/ModelData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Obeo.
* Copyright (c) 2022, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -19,7 +19,7 @@ export class ModelData {
public readonly kind: string,
public readonly imageURL: string,
public readonly serverId: string,
public readonly projectId: string,
public readonly editingContextId: string,
public readonly hasChildren: boolean
) {
this.children = [];
Expand Down
22 changes: 16 additions & 6 deletions vscode-extension/src/data/ProjectData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022, 2024 Obeo.
* Copyright (c) 2022, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -28,7 +28,12 @@ export class ProjectData {
private representationsData: RepresentationData[];
private subscriptionTreeEventId: string | undefined;

constructor(public readonly id: string, public readonly name: string, public readonly serverId: string) {
constructor(
public readonly id: string,
public readonly editingContextId: string,
public readonly name: string,
public readonly serverId: string
) {
this.modelsData = [];
this.representationsData = [];
}
Expand Down Expand Up @@ -71,7 +76,7 @@ export class ProjectData {
representationId: `explorer://?treeDescriptionId=explorer_tree_description&expandedIds=[${expandedItems
.map(encodeURIComponent)
.join(',')}]&activeFilterIds=[]`,
editingContextId: this.id,
editingContextId: this.editingContextId,
},
},
};
Expand Down Expand Up @@ -126,7 +131,7 @@ export class ProjectData {
element.kind,
element.imageURL,
this.serverId,
this.id,
this.editingContextId,
element.hasChildren
);
modelsData.push(modelData);
Expand Down Expand Up @@ -166,7 +171,7 @@ export class ProjectData {
queryURL,
{
query: graphQLQuery,
variables: { editingContextId: this.id },
variables: { editingContextId: this.editingContextId },
},
headers
)
Expand All @@ -180,7 +185,12 @@ export class ProjectData {
.map((e) => e.node)
.filter(this.isHandledRepresentation);
representations.forEach((diagram) => {
const representationData = new RepresentationData(diagram.id, diagram.label, diagram.kind, this.id);
const representationData = new RepresentationData(
diagram.id,
diagram.label,
diagram.kind,
this.editingContextId
);
this.representationsData.push(representationData);
});
return Promise.resolve(this.representationsData);
Expand Down
4 changes: 2 additions & 2 deletions vscode-extension/src/data/RepresentationData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Obeo.
* Copyright (c) 2022, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -16,6 +16,6 @@ export class RepresentationData {
public readonly id: string,
public readonly label: string,
public readonly kind: string,
public readonly projectId: string
public readonly editingContextId: string
) {}
}
7 changes: 5 additions & 2 deletions vscode-extension/src/data/ServerData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export class ServerData {
node {
id
name
currentEditingContext {
id
}
}
}
}
Expand All @@ -82,8 +85,8 @@ export class ServerData {
} else {
this.projectsData = [];
const projects = response.data.data.viewer.projects.edges.map((e: { node: any }) => e.node);
projects.forEach((node: { id: string; name: string; visibility: string }) => {
const projectData = new ProjectData(node.id, node.name, this.id);
projects.forEach((node: { id: string; name: string; currentEditingContext: { id: string } }) => {
const projectData = new ProjectData(node.id, node.currentEditingContext.id, node.name, this.id);
this.projectsData.push(projectData);
});
return Promise.resolve(this.projectsData);
Expand Down
6 changes: 3 additions & 3 deletions vscode-extension/src/viewsContainer/views/explorerView.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Obeo.
* Copyright (c) 2022, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand All @@ -18,7 +18,7 @@ import {
ProviderResult,
TreeDataProvider,
TreeItem,
TreeItemCollapsibleState
TreeItemCollapsibleState,
} from 'vscode';
import { ModelData } from '../../data/ModelData';
import { ProjectData } from '../../data/ProjectData';
Expand Down Expand Up @@ -146,7 +146,7 @@ export class ExplorerViewProvider implements TreeDataProvider<ModelItem> {
serverData.serverAddress,
serverData.username,
serverData.password,
projectData.id,
projectData.editingContextId,
element.id,
element.label,
element.kind,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 Obeo.
* Copyright (c) 2022, 2025 Obeo.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -61,7 +61,7 @@ export class RepresentationsViewProvider implements TreeDataProvider<Representat
serverData.serverAddress,
serverData.username,
serverData.password,
projectData.id,
projectData.editingContextId,
representationData.id,
representationData.label,
representationData.kind,
Expand Down

0 comments on commit 30b10cf

Please sign in to comment.