Skip to content

Commit

Permalink
[2027] Support both versions of the ITool interface in the imageURL d…
Browse files Browse the repository at this point in the history
…ata fetchers

Bug: #2027
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
  • Loading branch information
pcdavid authored and sbegaudeau committed Jun 6, 2023
1 parent 9ed75cf commit d753cb7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -54,6 +54,7 @@ It will start by improving a bit performances since diagrams were persisted twic
- https://github.com/eclipse-sirius/sirius-components/issues/1991[#1991] [form] Fix an issue where widgets from different groups share the same ID.
- https://github.com/eclipse-sirius/sirius-components/issues/1305[#1305] [diagram] Fix an issue where the default tools of the palette's tool sections where not updated.
- https://github.com/eclipse-sirius/sirius-components/issues/2008[#2008] [view] Make edge tool more robust for applications which use a custom IViewRepresentationDescriptionSearchService.
- https://github.com/eclipse-sirius/sirius-components/issues/2027[#2027] [diagram] Support both versions of the ITool interface in the imageURL data fetchers

=== New Features

Expand Down
Expand Up @@ -29,7 +29,13 @@ public class SingleClickOnDiagramElementToolImageURLDataFetcher implements IData

@Override
public String get(DataFetchingEnvironment environment) throws Exception {
ITool tool = environment.getSource();
return URLConstants.IMAGE_BASE_PATH + tool.imageURL();
String url = "";
Object source = environment.getSource();
if (source instanceof org.eclipse.sirius.components.diagrams.tools.ITool tool) {
url = URLConstants.IMAGE_BASE_PATH + tool.getImageURL();
} else if (source instanceof ITool tool) {
url = URLConstants.IMAGE_BASE_PATH + tool.imageURL();
}
return url;
}
}
Expand Up @@ -29,7 +29,13 @@ public class SingleClickOnTwoDiagramElementsToolImageURLDataFetcher implements I

@Override
public String get(DataFetchingEnvironment environment) throws Exception {
ITool tool = environment.getSource();
return URLConstants.IMAGE_BASE_PATH + tool.imageURL();
String url = "";
Object source = environment.getSource();
if (source instanceof org.eclipse.sirius.components.diagrams.tools.ITool tool) {
url = URLConstants.IMAGE_BASE_PATH + tool.getImageURL();
} else if (source instanceof ITool tool) {
url = URLConstants.IMAGE_BASE_PATH + tool.imageURL();
}
return url;
}
}

0 comments on commit d753cb7

Please sign in to comment.