-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[680] Add "Show/Hide Diagrams Inherited Members from Standard Libraries"
Add "Show/Hide Diagrams Inherited Members from Standard Libraries" action in Diagram Panel Bug: #680 Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
- Loading branch information
1 parent
d16a615
commit b93c8f1
Showing
22 changed files
with
699 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...es/datafetchers/MutationShowDiagramsInheritedMembersFromStandardLibrariesDataFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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 | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.syson.diagram.common.view.services.datafetchers; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import java.util.Objects; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; | ||
import org.eclipse.sirius.components.core.api.IPayload; | ||
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; | ||
import org.eclipse.sirius.components.graphql.api.IEditingContextDispatcher; | ||
import org.eclipse.sirius.components.graphql.api.IExceptionWrapper; | ||
import org.eclipse.syson.diagram.common.view.services.dto.ShowDiagramsInheritedMembersFromStandardLibrariesInput; | ||
|
||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
/** | ||
* Data fetcher for the field Mutation#showDiagramsInheritedMembersFromStandardLibraries. | ||
* | ||
* @author arichard | ||
*/ | ||
@QueryDataFetcher(type = "Mutation", field = "showDiagramsInheritedMembersFromStandardLibraries") | ||
public class MutationShowDiagramsInheritedMembersFromStandardLibrariesDataFetcher implements IDataFetcherWithFieldCoordinates<CompletableFuture<IPayload>> { | ||
|
||
private static final String INPUT_ARGUMENT = "input"; | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
private final IExceptionWrapper exceptionWrapper; | ||
|
||
private final IEditingContextDispatcher editingContextDispatcher; | ||
|
||
public MutationShowDiagramsInheritedMembersFromStandardLibrariesDataFetcher(ObjectMapper objectMapper, IExceptionWrapper exceptionWrapper, IEditingContextDispatcher editingContextDispatcher) { | ||
this.objectMapper = Objects.requireNonNull(objectMapper); | ||
this.exceptionWrapper = Objects.requireNonNull(exceptionWrapper); | ||
this.editingContextDispatcher = Objects.requireNonNull(editingContextDispatcher); | ||
} | ||
|
||
@Override | ||
public CompletableFuture<IPayload> get(DataFetchingEnvironment environment) throws Exception { | ||
Object argument = environment.getArgument(INPUT_ARGUMENT); | ||
var input = this.objectMapper.convertValue(argument, ShowDiagramsInheritedMembersFromStandardLibrariesInput.class); | ||
|
||
return this.exceptionWrapper.wrapMono(() -> this.editingContextDispatcher.dispatchMutation(input.editingContextId(), input), input).toFuture(); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...w/services/datafetchers/ShowDiagramsInheritedMembersFromStandardLibrariesDataFetcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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 | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.syson.diagram.common.view.services.datafetchers; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.annotations.spring.graphql.QueryDataFetcher; | ||
import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; | ||
import org.eclipse.syson.diagram.common.view.services.ShowDiagramsInheritedMembersService; | ||
|
||
import graphql.schema.DataFetchingEnvironment; | ||
|
||
/** | ||
* Data fetcher for Viewer#showDiagramsInheritedMembers query. | ||
* | ||
* @author arichard | ||
*/ | ||
@QueryDataFetcher(type = "Viewer", field = "showDiagramsInheritedMembersFromStandardLibrariesValue") | ||
public class ShowDiagramsInheritedMembersFromStandardLibrariesDataFetcher implements IDataFetcherWithFieldCoordinates<Boolean> { | ||
|
||
private final ShowDiagramsInheritedMembersService showDiagramsInheritedMembersService; | ||
|
||
public ShowDiagramsInheritedMembersFromStandardLibrariesDataFetcher(ShowDiagramsInheritedMembersService showDiagramsInheritedMembersService) { | ||
this.showDiagramsInheritedMembersService = Objects.requireNonNull(showDiagramsInheritedMembersService); | ||
} | ||
|
||
@Override | ||
public Boolean get(DataFetchingEnvironment environment) throws Exception { | ||
return Boolean.valueOf(this.showDiagramsInheritedMembersService.getShowInheritedMembersFromStandardLibraries()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...gram/common/view/services/dto/ShowDiagramsInheritedMembersFromStandardLibrariesInput.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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 | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.syson.diagram.common.view.services.dto; | ||
|
||
import java.util.UUID; | ||
|
||
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput; | ||
|
||
/** | ||
* The input object of the show diagrams inherited members from standard libraries mutation. | ||
* | ||
* @author arichard | ||
*/ | ||
public record ShowDiagramsInheritedMembersFromStandardLibrariesInput(UUID id, String editingContextId, String representationId, boolean show) implements IDiagramInput { | ||
} |
30 changes: 30 additions & 0 deletions
30
...on/view/services/dto/ShowDiagramsInheritedMembersFromStandardLibrariesSuccessPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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 | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.syson.diagram.common.view.services.dto; | ||
|
||
import java.util.Objects; | ||
import java.util.UUID; | ||
|
||
import org.eclipse.sirius.components.core.api.IPayload; | ||
|
||
/** | ||
* The payload of the show diagrams inherited members from standard libraries mutation. | ||
* | ||
* @author arichard | ||
*/ | ||
public record ShowDiagramsInheritedMembersFromStandardLibrariesSuccessPayload(UUID id, boolean show) implements IPayload { | ||
|
||
public ShowDiagramsInheritedMembersFromStandardLibrariesSuccessPayload { | ||
Objects.requireNonNull(id); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...view/services/handlers/ShowDiagramsInheritedMembersFromStandardLibrariesEventHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 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 | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.syson.diagram.common.view.services.handlers; | ||
|
||
import java.util.Objects; | ||
|
||
import org.eclipse.sirius.components.collaborative.api.ChangeDescription; | ||
import org.eclipse.sirius.components.collaborative.api.ChangeKind; | ||
import org.eclipse.sirius.components.collaborative.diagrams.DiagramChangeKind; | ||
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramContext; | ||
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramEventHandler; | ||
import org.eclipse.sirius.components.collaborative.diagrams.api.IDiagramInput; | ||
import org.eclipse.sirius.components.collaborative.diagrams.messages.ICollaborativeDiagramMessageService; | ||
import org.eclipse.sirius.components.core.api.ErrorPayload; | ||
import org.eclipse.sirius.components.core.api.IEditingContext; | ||
import org.eclipse.sirius.components.core.api.IPayload; | ||
import org.eclipse.syson.diagram.common.view.services.ShowDiagramsInheritedMembersService; | ||
import org.eclipse.syson.diagram.common.view.services.dto.ShowDiagramsInheritedMembersFromStandardLibrariesInput; | ||
import org.eclipse.syson.diagram.common.view.services.dto.ShowDiagramsInheritedMembersFromStandardLibrariesSuccessPayload; | ||
import org.springframework.stereotype.Service; | ||
|
||
import reactor.core.publisher.Sinks.Many; | ||
import reactor.core.publisher.Sinks.One; | ||
|
||
/** | ||
* Handle show diagrams inherited members from standard libraries event. | ||
* | ||
* @author arichard | ||
*/ | ||
@Service | ||
public class ShowDiagramsInheritedMembersFromStandardLibrariesEventHandler implements IDiagramEventHandler { | ||
|
||
private final ICollaborativeDiagramMessageService messageService; | ||
|
||
private final ShowDiagramsInheritedMembersService showDiagramsInheritedMembersService; | ||
|
||
public ShowDiagramsInheritedMembersFromStandardLibrariesEventHandler(ICollaborativeDiagramMessageService messageService, ShowDiagramsInheritedMembersService showDiagramsInheritedMembersService) { | ||
this.messageService = Objects.requireNonNull(messageService); | ||
this.showDiagramsInheritedMembersService = Objects.requireNonNull(showDiagramsInheritedMembersService); | ||
} | ||
|
||
@Override | ||
public boolean canHandle(IDiagramInput diagramInput) { | ||
return diagramInput instanceof ShowDiagramsInheritedMembersFromStandardLibrariesInput; | ||
} | ||
|
||
@Override | ||
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IEditingContext editingContext, IDiagramContext diagramContext, IDiagramInput diagramInput) { | ||
if (diagramInput instanceof ShowDiagramsInheritedMembersFromStandardLibrariesInput showDiagramsInheritedMembersFromStandardLibrariesInput) { | ||
this.showDiagramsInheritedMembersService.setShowInheritedMembersFromStandardLibraries(showDiagramsInheritedMembersFromStandardLibrariesInput.show()); | ||
IPayload payload = new ShowDiagramsInheritedMembersFromStandardLibrariesSuccessPayload(diagramInput.id(), showDiagramsInheritedMembersFromStandardLibrariesInput.show()); | ||
ChangeDescription changeDescription = new ChangeDescription(DiagramChangeKind.DIAGRAM_ELEMENT_VISIBILITY_CHANGE, diagramInput.representationId(), diagramInput); | ||
payloadSink.tryEmitValue(payload); | ||
changeDescriptionSink.tryEmitNext(changeDescription); | ||
} else { | ||
String message = this.messageService.invalidInput(diagramInput.getClass().getSimpleName(), ShowDiagramsInheritedMembersFromStandardLibrariesInput.class.getSimpleName()); | ||
IPayload payload = new ErrorPayload(diagramInput.id(), message); | ||
ChangeDescription changeDescription = new ChangeDescription(ChangeKind.NOTHING, diagramInput.representationId(), diagramInput); | ||
payloadSink.tryEmitValue(payload); | ||
changeDescriptionSink.tryEmitNext(changeDescription); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+129 KB
...elease-notes-show-hide-inherited-members-from-standard-libraries-in-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-29.7 KB
(81%)
...r-manual/assets/images/release-notes-show-hide-inherited-members-in-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.