diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index af84c9640eb..8d0f43b31cc 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -45,7 +45,7 @@ More existing APIs will be migrated to this new common pattern. - [releng] Remove the dependency to `reflect-metadata` - [releng] Switch to `subscriptions-transport-ws` 0.11.0 - [releng] Switch to EMF Json 2.3.11 -- https://github.com/eclipse-sirius/sirius-web/issues/3523[#3523] [gantt] Move to @ObeoNetwork/gantt-task-react 0.4.17 to benefit for enhancements +- https://github.com/eclipse-sirius/sirius-web/issues/3523[#3523] [gantt] Move to @ObeoNetwork/gantt-task-react 0.4.18 to benefit for enhancements === Bug fixes @@ -81,6 +81,7 @@ This dialog presents diagram elements in a tree and allows to select them and up + image:doc/screenshots/diagramFilterView.png[Diagram Filter View, 70%] - https://github.com/eclipse-sirius/sirius-web/issues/3523[#3523] [gantt] Support rounding dates when changing dates from gantt +- https://github.com/eclipse-sirius/sirius-web/issues/3655[#3655] [gantt] Support "Delete Task Dependency" tool in gantt === Improvements diff --git a/doc/specifier/images/gantt-task-dependency-palette.png b/doc/specifier/images/gantt-task-dependency-palette.png new file mode 100644 index 00000000000..2fc424c92e3 Binary files /dev/null and b/doc/specifier/images/gantt-task-dependency-palette.png differ diff --git a/doc/specifier/images/gantt-task-handlers.png b/doc/specifier/images/gantt-task-handlers.png index c48bbcbdd9a..09fda51b47b 100644 Binary files a/doc/specifier/images/gantt-task-handlers.png and b/doc/specifier/images/gantt-task-handlers.png differ diff --git a/doc/specifier/representation-gantt.adoc b/doc/specifier/representation-gantt.adoc index 7d2e578f046..5e62638b7d8 100644 --- a/doc/specifier/representation-gantt.adoc +++ b/doc/specifier/representation-gantt.adoc @@ -99,7 +99,7 @@ Available variables: ** `newStartTime`: The new value of the start time. ** `newEndTime`: The new value of the end time. ** `newDescription`: The new value of the description. -** `newProgress`: The new value of the progress. +** `newProgress`: The new value of the progress. image::images/gantt-task-handlers.png[Task handlers] @@ -121,7 +121,14 @@ index=0 means first position. This tool defines the behavior when creating a task dependency by dragging the dependency handler from one task to another. Available variables: ** `sourceObject`: The semantic element associated with the task from which the dependency link is initiated. -** `targetObject`: The semantic element associated with the target task where the dependency finishes. +** `targetObject`: The semantic element associated with the dependant task where the dependency finishes. image::images/gantt-task-relation-tool.png[Create Task Dependency Tool] +* `Delete Task Dependency Tool`: +This tool defines the behavior when deleting a task dependency using the button in the task dependency contextual palette in Gantt. +Available variables: +** `sourceObject`: The semantic element associated with the task from which the dependency link is initiated. +** `targetObject`: The semantic element associated with the dependant task where the dependency finishes. + +image:images/gantt-task-dependency-palette.png[Task Dependency Contextual Palette] diff --git a/doc/user/images/gantt-task-dependency-palette.png b/doc/user/images/gantt-task-dependency-palette.png new file mode 100644 index 00000000000..2fc424c92e3 Binary files /dev/null and b/doc/user/images/gantt-task-dependency-palette.png differ diff --git a/doc/user/images/gantt-task-handlers.png b/doc/user/images/gantt-task-handlers.png index c48bbcbdd9a..09fda51b47b 100644 Binary files a/doc/user/images/gantt-task-handlers.png and b/doc/user/images/gantt-task-handlers.png differ diff --git a/doc/user/images/gantt-task-palette.png b/doc/user/images/gantt-task-palette.png new file mode 100644 index 00000000000..1cccbc08bf4 Binary files /dev/null and b/doc/user/images/gantt-task-palette.png differ diff --git a/doc/user/representation-gantt.adoc b/doc/user/representation-gantt.adoc index 12194582cb4..b48656b7200 100644 --- a/doc/user/representation-gantt.adoc +++ b/doc/user/representation-gantt.adoc @@ -64,7 +64,7 @@ When selecting a `Task` in Gantt or in the Table, the associated semantic elemen Using handlers on the task, it is possible to change the start/end dates and the progress. Clicking on the task and moving it left or right, allows to shift the date keeping the same duration. -image:images/gantt-task-handlers.png[Show/Hide Cards] +image:images/gantt-task-handlers.png[Task handlers] When changing a date, the date is rounded accordingly to the `Date Rounding Expression` define in the `GanttDescription`. Holiday is set as Saturday and Sunday. If the rounded date is part of the holiday, it is moved to the next or previous working date. @@ -78,6 +78,21 @@ image:images/gantt-task-dependency-tool.png[Task Dependency Tool] image:images/gantt-task-dependency.png[Task Dependency] +### Contextual tool palettes + +Clicking on a task displays a contextual menu. + +* `Create Task`: It will invoke `Create Task Tool` +* `Delete Task`: It will invoke `Delete Task Tool` + +image:images/gantt-task-palette.png[Task Contextual Palette] + +Clicking on a task dependency displays a contextual menu. + +* `Delete Task Dependency`: It will invoke `Create Task Dependency Tool` + +image:images/gantt-task-dependency-palette.png[Task Dependency Contextual Palette] + ### Task reordering From the table, it is possible to drag and drop a Task to reorder the task or change its container. diff --git a/package-lock.json b/package-lock.json index 89fcc63112a..3bdef7929bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1527,9 +1527,9 @@ } }, "node_modules/@ObeoNetwork/gantt-task-react": { - "version": "0.4.17", - "resolved": "https://npm.pkg.github.com/download/@ObeoNetwork/gantt-task-react/0.4.17/f6238f9f4395b00e943f2330c66015023e64d82e", - "integrity": "sha512-TUHFlx19WL+NM+y1JxdBjCneFlDgjgl56Qjv5biDORVtysQ1fC3wzfOE2gj6VeiNsYlh0cPkJdMSIB0ifnsl1Q==", + "version": "0.4.18", + "resolved": "https://npm.pkg.github.com/download/@ObeoNetwork/gantt-task-react/0.4.18/276cb14a66c34fe87e5759299af6251d00c46890", + "integrity": "sha512-v1/og4CMyhCRJUc96smvehTRDueLjz+vbftkf/jhZjlDssN+3DpO9BD1Rq2o0QfON1/846jNIKF5PAKBmx4zbw==", "license": "MIT", "dependencies": { "@floating-ui/dom": "1.1.1", @@ -13317,7 +13317,7 @@ "@eclipse-sirius/sirius-components-tsconfig": "*", "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@types/react": "17.0.37", "@vitejs/plugin-react": "4.3.0", "@xstate/react": "1.6.3", @@ -13335,7 +13335,7 @@ "@eclipse-sirius/sirius-components-core": "*", "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@xstate/react": "1.6.3", "graphql": "16.8.1", "react": "17.0.2", @@ -15884,7 +15884,7 @@ "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", "@material-ui/lab": "4.0.0-alpha.61", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@ObeoNetwork/react-trello": "2.4.11", "@types/react": "17.0.37", "@types/react-router-dom": "5.3.3", @@ -23160,7 +23160,7 @@ "@eclipse-sirius/sirius-components-tsconfig": "*", "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@types/react": "17.0.37", "@vitejs/plugin-react": "4.3.0", "@xstate/react": "1.6.3", @@ -26315,7 +26315,7 @@ "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", "@material-ui/lab": "4.0.0-alpha.61", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@ObeoNetwork/react-trello": "2.4.11", "@testing-library/jest-dom": "5.14.1", "@testing-library/react": "12.1.2", @@ -27911,9 +27911,9 @@ } }, "@ObeoNetwork/gantt-task-react": { - "version": "0.4.17", - "resolved": "https://npm.pkg.github.com/download/@ObeoNetwork/gantt-task-react/0.4.17/f6238f9f4395b00e943f2330c66015023e64d82e", - "integrity": "sha512-TUHFlx19WL+NM+y1JxdBjCneFlDgjgl56Qjv5biDORVtysQ1fC3wzfOE2gj6VeiNsYlh0cPkJdMSIB0ifnsl1Q==", + "version": "0.4.18", + "resolved": "https://npm.pkg.github.com/download/@ObeoNetwork/gantt-task-react/0.4.18/276cb14a66c34fe87e5759299af6251d00c46890", + "integrity": "sha512-v1/og4CMyhCRJUc96smvehTRDueLjz+vbftkf/jhZjlDssN+3DpO9BD1Rq2o0QfON1/846jNIKF5PAKBmx4zbw==", "requires": { "@floating-ui/dom": "1.1.1", "@floating-ui/react": "0.19.0", diff --git a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/api/IGanttTaskService.java b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/api/IGanttTaskService.java index 4ce0c1c1dbb..e47cd527adc 100644 --- a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/api/IGanttTaskService.java +++ b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/api/IGanttTaskService.java @@ -16,6 +16,7 @@ import org.eclipse.sirius.components.collaborative.gantt.dto.input.ChangeTaskCollapseStateInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskDependencyInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskInput; +import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.DropGanttTaskInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.EditGanttTaskInput; @@ -55,6 +56,11 @@ public interface IGanttTaskService { */ IPayload createTaskDependency(CreateGanttTaskDependencyInput createTaskDependencyInput, IEditingContext editingContext, Gantt gantt); + /** + * Delete a dependency between two tasks. + */ + IPayload deleteTaskDependency(DeleteGanttTaskDependencyInput createTaskDependencyInput, IEditingContext editingContext, Gantt gantt); + /** * Change the state collapse of a task. */ @@ -97,6 +103,11 @@ public IPayload createTaskDependency(CreateGanttTaskDependencyInput createTaskDe return null; } + @Override + public IPayload deleteTaskDependency(DeleteGanttTaskDependencyInput createTaskDependencyInput, IEditingContext editingContext, Gantt gantt) { + return null; + } + @Override public IPayload changeTaskCollapseState(ChangeTaskCollapseStateInput changeTaskCollapseStateInput, IEditingContext editingContext, IGanttContext ganttContext) { return null; diff --git a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/dto/input/DeleteGanttTaskDependencyInput.java b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/dto/input/DeleteGanttTaskDependencyInput.java new file mode 100644 index 00000000000..e8d49373692 --- /dev/null +++ b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/dto/input/DeleteGanttTaskDependencyInput.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * 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.sirius.components.collaborative.gantt.dto.input; + +import java.util.Objects; +import java.util.UUID; + +import org.eclipse.sirius.components.collaborative.gantt.api.IGanttInput; + +/** + * The input of the "Delete task dependency" mutation. + * + * @author lfasani + */ +public record DeleteGanttTaskDependencyInput(UUID id, String editingContextId, String representationId, String sourceTaskId, String targetTaskId) implements IGanttInput { + public DeleteGanttTaskDependencyInput { + Objects.requireNonNull(id); + Objects.requireNonNull(editingContextId); + Objects.requireNonNull(representationId); + Objects.requireNonNull(sourceTaskId); + Objects.requireNonNull(targetTaskId); + } +} diff --git a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/handlers/DeleteTaskDependencyEventHandler.java b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/handlers/DeleteTaskDependencyEventHandler.java new file mode 100644 index 00000000000..299e1ef3475 --- /dev/null +++ b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/handlers/DeleteTaskDependencyEventHandler.java @@ -0,0 +1,79 @@ +/******************************************************************************* + * 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.sirius.components.collaborative.gantt.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.api.Monitoring; +import org.eclipse.sirius.components.collaborative.gantt.api.IGanttContext; +import org.eclipse.sirius.components.collaborative.gantt.api.IGanttEventHandler; +import org.eclipse.sirius.components.collaborative.gantt.api.IGanttInput; +import org.eclipse.sirius.components.collaborative.gantt.api.IGanttTaskService; +import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; +import org.eclipse.sirius.components.collaborative.gantt.message.ICollaborativeGanttMessageService; +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.springframework.stereotype.Service; + +import io.micrometer.core.instrument.Counter; +import io.micrometer.core.instrument.MeterRegistry; +import reactor.core.publisher.Sinks.Many; +import reactor.core.publisher.Sinks.One; + +/** + * Handle "Delete Task Dependency" events. + * + * @author lfasani + */ +@Service +public class DeleteTaskDependencyEventHandler implements IGanttEventHandler { + + private final IGanttTaskService ganttTaskService; + + private final ICollaborativeGanttMessageService messageService; + + private final Counter counter; + + public DeleteTaskDependencyEventHandler(IGanttTaskService ganttTaskService, ICollaborativeGanttMessageService messageService, MeterRegistry meterRegistry) { + this.ganttTaskService = Objects.requireNonNull(ganttTaskService); + this.messageService = Objects.requireNonNull(messageService); + + this.counter = Counter.builder(Monitoring.EVENT_HANDLER).tag(Monitoring.NAME, this.getClass().getSimpleName()).register(meterRegistry); + } + + @Override + public boolean canHandle(IGanttInput ganttInput) { + return ganttInput instanceof DeleteGanttTaskDependencyInput; + } + + @Override + public void handle(One payloadSink, Many changeDescriptionSink, IEditingContext editingContext, IGanttContext ganttContext, IGanttInput ganttInput) { + this.counter.increment(); + + String message = this.messageService.invalidInput(ganttInput.getClass().getSimpleName(), DeleteGanttTaskDependencyInput.class.getSimpleName()); + IPayload payload = new ErrorPayload(ganttInput.id(), message); + ChangeDescription changeDescription = new ChangeDescription(ChangeKind.NOTHING, ganttInput.representationId(), ganttInput); + + if (ganttInput instanceof DeleteGanttTaskDependencyInput input) { + payload = this.ganttTaskService.deleteTaskDependency(input, editingContext, ganttContext.getGantt()); + + changeDescription = new ChangeDescription(ChangeKind.SEMANTIC_CHANGE, ganttInput.representationId(), ganttInput); + } + + payloadSink.tryEmitValue(payload); + changeDescriptionSink.tryEmitNext(changeDescription); + } +} diff --git a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/service/GanttTaskService.java b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/service/GanttTaskService.java index 9d2700d1973..a479e9cefb4 100644 --- a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/service/GanttTaskService.java +++ b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/java/org/eclipse/sirius/components/collaborative/gantt/service/GanttTaskService.java @@ -25,6 +25,7 @@ import org.eclipse.sirius.components.collaborative.gantt.dto.input.ChangeTaskCollapseStateInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskDependencyInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskInput; +import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.DropGanttTaskInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.EditGanttTaskInput; @@ -228,6 +229,34 @@ public IPayload createTaskDependency(CreateGanttTaskDependencyInput createTaskDe return payload; } + @Override + public IPayload deleteTaskDependency(DeleteGanttTaskDependencyInput deleteTaskDependencyInput, IEditingContext editingContext, Gantt gantt) { + IPayload payload = new ErrorPayload(deleteTaskDependencyInput.id(), "Delete task dependency failed"); + + Optional ganttDescriptionOpt = this.findGanttDescription(gantt.descriptionId(), editingContext); + + if (ganttDescriptionOpt.isPresent()) { + VariableManager variableManager = new VariableManager(); + variableManager.put(IEditingContext.EDITING_CONTEXT, editingContext); + + Optional sourceObjectOpt = Optional.of(deleteTaskDependencyInput.sourceTaskId()) + .flatMap(taskId -> this.getTaskSemanticObject(taskId, gantt, editingContext)); + + Optional targetObjectOpt = Optional.of(deleteTaskDependencyInput.targetTaskId()) + .flatMap(taskId -> this.getTaskSemanticObject(taskId, gantt, editingContext)); + + if (sourceObjectOpt.isPresent() && targetObjectOpt.isPresent()) { + variableManager.put(GanttDescription.SOURCE_OBJECT, sourceObjectOpt.get()); + variableManager.put(GanttDescription.TARGET_OBJECT, targetObjectOpt.get()); + ganttDescriptionOpt.get().deleteTaskDependencyProvider().accept(variableManager); + } + + payload = this.getPayload(deleteTaskDependencyInput.id()); + } + + return payload; + } + private Optional getTaskSemanticObject(String taskId, Gantt gantt, IEditingContext editingContext) { Optional targetObjectOpt = this.findTask(task -> Objects.equals(task.id(), taskId), gantt.tasks()) .map(task -> this.objectService.getObject(editingContext, task.targetObjectId())) diff --git a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/resources/schema/gantt.graphqls b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/resources/schema/gantt.graphqls index 014feed9d35..0cf204b221e 100644 --- a/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/resources/schema/gantt.graphqls +++ b/packages/gantt/backend/sirius-components-collaborative-gantt/src/main/resources/schema/gantt.graphqls @@ -85,6 +85,7 @@ extend type Mutation { editGanttTask(input: EditGanttTaskInput!): EditGanttTaskPayload dropGanttTask(input: DropGanttTaskInput!): DropGanttTaskPayload createGanttTaskDependency(input: CreateGanttTaskDependencyInput!): CreateGanttTaskDependencyPayload + deleteGanttTaskDependency(input: DeleteGanttTaskDependencyInput!): DeleteGanttTaskDependencyPayload changeGanttTaskCollapseState(input: ChangeGanttTaskCollapseStateInput!): ChangeGanttTaskCollapseStatePayload changeGanttColumn(input: ChangeGanttColumnInput!): ChangeGanttColumnPayload } @@ -143,6 +144,15 @@ input CreateGanttTaskDependencyInput { } union CreateGanttTaskDependencyPayload = SuccessPayload | ErrorPayload +input DeleteGanttTaskDependencyInput { + id: ID! + editingContextId: ID! + representationId: ID! + sourceTaskId: ID! + targetTaskId: ID! +} +union DeleteGanttTaskDependencyPayload = SuccessPayload | ErrorPayload + input ChangeGanttTaskCollapseStateInput { id: ID! editingContextId: ID! diff --git a/packages/gantt/backend/sirius-components-gantt-graphql/src/main/java/org/eclipse/sirius/components/gantt/graphql/datafetchers/mutation/MutationDeleteTaskDependencyDataFetcher.java b/packages/gantt/backend/sirius-components-gantt-graphql/src/main/java/org/eclipse/sirius/components/gantt/graphql/datafetchers/mutation/MutationDeleteTaskDependencyDataFetcher.java new file mode 100644 index 00000000000..8b93f461382 --- /dev/null +++ b/packages/gantt/backend/sirius-components-gantt-graphql/src/main/java/org/eclipse/sirius/components/gantt/graphql/datafetchers/mutation/MutationDeleteTaskDependencyDataFetcher.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * 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.sirius.components.gantt.graphql.datafetchers.mutation; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import java.util.Objects; +import java.util.concurrent.CompletableFuture; + +import org.eclipse.sirius.components.annotations.spring.graphql.MutationDataFetcher; +import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; +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 graphql.schema.DataFetchingEnvironment; + +/** + * The data fetcher used to delete a gantt task dependency. + * + * @author lfasani + */ +@MutationDataFetcher(type = "Mutation", field = "deleteGanttTaskDependency") +public class MutationDeleteTaskDependencyDataFetcher implements IDataFetcherWithFieldCoordinates> { + + private static final String INPUT_ARGUMENT = "input"; + + private final ObjectMapper objectMapper; + + private final IExceptionWrapper exceptionWrapper; + + private final IEditingContextDispatcher editingContextDispatcher; + + public MutationDeleteTaskDependencyDataFetcher(ObjectMapper objectMapper, IExceptionWrapper exceptionWrapper, IEditingContextDispatcher editingContextDispatcher) { + this.objectMapper = Objects.requireNonNull(objectMapper); + this.exceptionWrapper = Objects.requireNonNull(exceptionWrapper); + this.editingContextDispatcher = Objects.requireNonNull(editingContextDispatcher); + } + + @Override + public CompletableFuture get(DataFetchingEnvironment environment) throws Exception { + Object argument = environment.getArgument(INPUT_ARGUMENT); + var input = this.objectMapper.convertValue(argument, DeleteGanttTaskDependencyInput.class); + + return this.exceptionWrapper.wrapMono(() -> this.editingContextDispatcher.dispatchMutation(input.editingContextId(), input), input).toFuture(); + } + +} diff --git a/packages/gantt/backend/sirius-components-gantt-tests/src/main/java/org/eclipse/sirius/components/gantt/tests/graphql/CreateTaskDependencyMutationRunner.java b/packages/gantt/backend/sirius-components-gantt-tests/src/main/java/org/eclipse/sirius/components/gantt/tests/graphql/CreateTaskDependencyMutationRunner.java new file mode 100644 index 00000000000..4a03f7577f9 --- /dev/null +++ b/packages/gantt/backend/sirius-components-gantt-tests/src/main/java/org/eclipse/sirius/components/gantt/tests/graphql/CreateTaskDependencyMutationRunner.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * 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.sirius.components.gantt.tests.graphql; + +import java.util.Objects; + +import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskDependencyInput; +import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; +import org.eclipse.sirius.components.graphql.tests.api.IMutationRunner; +import org.springframework.stereotype.Service; + +/** + * Used to create a Task Dependency with the GraphQL API. + * + * @author lfasani + */ +@Service +public class CreateTaskDependencyMutationRunner implements IMutationRunner { + + private static final String CREATE_TASK_DEPENDENCY_MUTATION = """ + mutation createGanttTaskDependency($input: CreateGanttTaskDependencyInput!) { + createGanttTaskDependency(input: $input) { + __typename + ... on ErrorPayload { + messages { + body + level + } + } + ... on SuccessPayload { + messages { + body + level + } + } + } + } + """; + + private final IGraphQLRequestor graphQLRequestor; + + public CreateTaskDependencyMutationRunner(IGraphQLRequestor graphQLRequestor) { + this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); + } + + @Override + public String run(CreateGanttTaskDependencyInput input) { + return this.graphQLRequestor.execute(CREATE_TASK_DEPENDENCY_MUTATION, input); + } +} diff --git a/packages/gantt/backend/sirius-components-gantt-tests/src/main/java/org/eclipse/sirius/components/gantt/tests/graphql/DeleteTaskDependencyMutationRunner.java b/packages/gantt/backend/sirius-components-gantt-tests/src/main/java/org/eclipse/sirius/components/gantt/tests/graphql/DeleteTaskDependencyMutationRunner.java new file mode 100644 index 00000000000..0592d61cb7e --- /dev/null +++ b/packages/gantt/backend/sirius-components-gantt-tests/src/main/java/org/eclipse/sirius/components/gantt/tests/graphql/DeleteTaskDependencyMutationRunner.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * 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.sirius.components.gantt.tests.graphql; + +import java.util.Objects; + +import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; +import org.eclipse.sirius.components.graphql.tests.api.IGraphQLRequestor; +import org.eclipse.sirius.components.graphql.tests.api.IMutationRunner; +import org.springframework.stereotype.Service; + +/** + * Used to delete a Task Dependency with the GraphQL API. + * + * @author lfasani + */ +@Service +public class DeleteTaskDependencyMutationRunner implements IMutationRunner { + + private static final String DELETE_TASK_DEPENDENCY_MUTATION = """ + mutation deleteTaskDependency($input: DeleteGanttTaskDependencyInput!) { + deleteGanttTaskDependency(input: $input) { + __typename + ... on ErrorPayload { + messages { + body + level + } + } + ... on SuccessPayload { + messages { + body + level + } + } + } + } + """; + + private final IGraphQLRequestor graphQLRequestor; + + public DeleteTaskDependencyMutationRunner(IGraphQLRequestor graphQLRequestor) { + this.graphQLRequestor = Objects.requireNonNull(graphQLRequestor); + } + + @Override + public String run(DeleteGanttTaskDependencyInput input) { + return this.graphQLRequestor.execute(DELETE_TASK_DEPENDENCY_MUTATION, input); + } +} diff --git a/packages/gantt/backend/sirius-components-gantt/src/main/java/org/eclipse/sirius/components/gantt/description/GanttDescription.java b/packages/gantt/backend/sirius-components-gantt/src/main/java/org/eclipse/sirius/components/gantt/description/GanttDescription.java index fc463afebd5..b57128258c0 100644 --- a/packages/gantt/backend/sirius-components-gantt/src/main/java/org/eclipse/sirius/components/gantt/description/GanttDescription.java +++ b/packages/gantt/backend/sirius-components-gantt/src/main/java/org/eclipse/sirius/components/gantt/description/GanttDescription.java @@ -32,7 +32,7 @@ public record GanttDescription(String id, String label, Function idProvider, Function labelProvider, Function targetObjectIdProvider, Predicate canCreatePredicate, List taskDescriptions, Consumer createTaskProvider, Consumer editTaskProvider, Consumer deleteTaskProvider, Consumer dropTaskProvider, Consumer createTaskDependencyProvider, - Function dateRoundingProvider) implements IRepresentationDescription { + Consumer deleteTaskDependencyProvider, Function dateRoundingProvider) implements IRepresentationDescription { public static final String LABEL = "label"; @@ -122,6 +122,8 @@ public static final class Builder { private Consumer createTaskDependencyProvider; + private Consumer deleteTaskDependencyProvider; + private List taskDescriptions; private Function dateRoundingProvider; @@ -175,6 +177,11 @@ public Builder createTaskDependencyProvider(Consumer createTask return this; } + public Builder deleteTaskDependencyProvider(Consumer deleteTaskDependencyProvider) { + this.deleteTaskDependencyProvider = deleteTaskDependencyProvider; + return this; + } + public Builder canCreatePredicate(Predicate canCreatePredicate) { this.canCreatePredicate = Objects.requireNonNull(canCreatePredicate); return this; @@ -192,7 +199,8 @@ public Builder dateRoundingProvider(Function dateRoundi public GanttDescription build() { GanttDescription ganttDescription = new GanttDescription(this.id, this.label, this.idProvider, this.labelProvider, this.targetObjectIdProvider, this.canCreatePredicate, - this.taskDescriptions, this.createTaskProvider, this.editTaskProvider, this.deleteTaskProvider, this.dropTaskProvider, this.createTaskDependencyProvider, this.dateRoundingProvider); + this.taskDescriptions, this.createTaskProvider, this.editTaskProvider, this.deleteTaskProvider, this.dropTaskProvider, this.createTaskDependencyProvider, + this.deleteTaskDependencyProvider, this.dateRoundingProvider); return ganttDescription; } } diff --git a/packages/gantt/frontend/sirius-components-gantt/package.json b/packages/gantt/frontend/sirius-components-gantt/package.json index 9e69bb19122..f8bbd819965 100644 --- a/packages/gantt/frontend/sirius-components-gantt/package.json +++ b/packages/gantt/frontend/sirius-components-gantt/package.json @@ -31,7 +31,7 @@ }, "peerDependencies": { "@apollo/client": "3.10.4", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@eclipse-sirius/sirius-components-core": "*", "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", @@ -47,7 +47,7 @@ "@eclipse-sirius/sirius-components-tsconfig": "*", "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@types/react": "17.0.37", "@vitejs/plugin-react": "4.3.0", "@xstate/react": "1.6.3", diff --git a/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/GanttMutation.types.ts b/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/GanttMutation.types.ts index 5339fd0b641..576b14f5dec 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/GanttMutation.types.ts +++ b/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/GanttMutation.types.ts @@ -20,6 +20,7 @@ export interface UseGanttMutations { deleteTask: (tasks: readonly TaskOrEmpty[]) => void; dropTask: (droppedTask: TaskOrEmpty, targetTask: TaskOrEmpty | undefined, dropIndex: number) => void; createTaskDependency: (sourceTaskId: string, targetTaskId: string) => void; + deleteTaskDependency: (sourceTaskId: string, targetTaskId: string) => void; changeTaskCollapseState: (taskId: string, collapsed: boolean) => void; changeColumn: (columnId: string, displayed: boolean, width: number) => void; } @@ -111,6 +112,22 @@ export interface GQLCreateTaskDependencyData { export type GQLCreateGanttTaskDependencyPayload = GQLErrorPayload | GQLSuccessPayload; +export interface GQLDeleteTaskDependencyVariables { + input: GQLDeleteTaskDependencyInput; +} +export interface GQLDeleteTaskDependencyInput { + id: string; + editingContextId: string; + representationId: string; + sourceTaskId: string; + targetTaskId: string; +} +export interface GQLDeleteTaskDependencyData { + deleteGanttTaskDependency: GQLDeleteTaskDependencyPayload; +} + +export type GQLDeleteTaskDependencyPayload = GQLErrorPayload | GQLSuccessPayload; + export interface GQLChangeTaskCollapseStateVariables { input: GQLChangeTaskCollapseStateInput; } diff --git a/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/ganttMutation.ts b/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/ganttMutation.ts index 67b05787abb..15722b54e07 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/ganttMutation.ts +++ b/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/ganttMutation.ts @@ -112,6 +112,26 @@ export const createTaskDependencyMutation = gql` } `; +export const deleteTaskDependencyMutation = gql` + mutation deleteTaskDependency($input: DeleteGanttTaskDependencyInput!) { + deleteGanttTaskDependency(input: $input) { + __typename + ... on ErrorPayload { + messages { + body + level + } + } + ... on SuccessPayload { + messages { + body + level + } + } + } + } +`; + export const changeTaskCollapseStateMutation = gql` mutation changeGanttTaskCollapseState($input: ChangeGanttTaskCollapseStateInput!) { changeGanttTaskCollapseState(input: $input) { diff --git a/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/useGanttMutations.ts b/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/useGanttMutations.ts index 8b8e8e6e895..7e2dc0a7b01 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/useGanttMutations.ts +++ b/packages/gantt/frontend/sirius-components-gantt/src/graphql/mutation/useGanttMutations.ts @@ -30,6 +30,9 @@ import { GQLCreateTaskVariables, GQLDeleteGanttTaskInput, GQLDeleteTaskData, + GQLDeleteTaskDependencyData, + GQLDeleteTaskDependencyInput, + GQLDeleteTaskDependencyVariables, GQLDeleteTaskVariables, GQLDropGanttTaskInput, GQLDropTaskData, @@ -44,6 +47,7 @@ import { changeTaskCollapseStateMutation, createTaskDependencyMutation, createTaskMutation, + deleteTaskDependencyMutation, deleteTaskMutation, dropTaskMutation, editTaskMutation, @@ -149,6 +153,27 @@ export const useGanttMutations = (editingContextId: string, representationId: st mutationCreateTaskDependency({ variables: { input } }); }; + const [mutationDeleteTaskDependency, mutationDeleteTaskDependencyResult] = useMutation< + GQLDeleteTaskDependencyData, + GQLDeleteTaskDependencyVariables + >(deleteTaskDependencyMutation); + useReporting( + mutationDeleteTaskDependencyResult, + (data: GQLDeleteTaskDependencyData) => data.deleteGanttTaskDependency + ); + + const deleteTaskDependency = (sourceTaskId: string, targetTaskId: string) => { + const input: GQLDeleteTaskDependencyInput = { + id: crypto.randomUUID(), + editingContextId, + representationId, + sourceTaskId, + targetTaskId, + }; + + mutationDeleteTaskDependency({ variables: { input } }); + }; + const [mutationChangeTaskCollapseState, mutationChangeTaskCollapseStateResult] = useMutation< GQLChangeTaskCollapseStateData, GQLChangeTaskCollapseStateVariables @@ -194,6 +219,7 @@ export const useGanttMutations = (editingContextId: string, representationId: st editTask, dropTask, createTaskDependency, + deleteTaskDependency, changeTaskCollapseState, changeColumn, }; diff --git a/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.tsx b/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.tsx index 35654868c23..d5c75c06ce2 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.tsx +++ b/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.tsx @@ -14,18 +14,29 @@ import IconButton from '@material-ui/core/IconButton'; import { makeStyles } from '@material-ui/core/styles'; import Delete from '@material-ui/icons/Delete'; import { TaskIcon } from '../icons/TaskIcon'; +import { TaskContextualPaletteProps, TaskDependencyContextualPaletteProps } from './ContextualPalette.types'; -import { TaskContextualPaletteProps } from '@ObeoNetwork/gantt-task-react'; -import { ContextualPaletteProps } from './ContextualPalette.types'; +import { + TaskContextualPaletteProps as GanttTaskContextualPaletteProps, + TaskDependencyContextualPaletteProps as GanttTaskDependencyContextualPaletteProps, + Task, +} from '@ObeoNetwork/gantt-task-react'; const useContextualPaletteStyle = makeStyles((theme) => ({ - buttonEntries: { + taskButtonEntries: { display: 'grid', gridTemplateColumns: `repeat(2, 28px)`, gridTemplateRows: '28px', gridAutoRows: '28px', placeItems: 'center', }, + taskDependencyButtonEntries: { + display: 'grid', + gridTemplateColumns: `repeat(1, 28px)`, + gridTemplateRows: '28px', + gridAutoRows: '28px', + placeItems: 'center', + }, toolIcon: { color: theme.palette.text.primary, }, @@ -37,17 +48,27 @@ const useContextualPaletteStyle = makeStyles((theme) => ({ }, })); -export const getContextalPalette = ({ onCreateTask, onDeleteTask }: ContextualPaletteProps) => { - const ContextualPalette: React.FC = ({ selectedTask }) => { +export const getTaskContextalPalette = ({ onCreateTask, onDeleteTask }: TaskContextualPaletteProps) => { + const TaskContextualPalette: React.FC = ({ selectedTask, onClosePalette }) => { const classes = useContextualPaletteStyle(); + + const handleCreateTask = (task: Task) => { + onClosePalette(); + onCreateTask(task); + }; + const handleDeleteTask = (task: Task) => { + onClosePalette(); + onDeleteTask(task); + }; + return ( -
+
onCreateTask(selectedTask)} + onClick={() => handleCreateTask(selectedTask)} data-testid="create-task"> @@ -56,7 +77,7 @@ export const getContextalPalette = ({ onCreateTask, onDeleteTask }: ContextualPa size="small" aria-label="Delete task" title="Delete task" - onClick={() => onDeleteTask(selectedTask)} + onClick={() => handleDeleteTask(selectedTask)} data-testid="delete-task"> @@ -64,5 +85,34 @@ export const getContextalPalette = ({ onCreateTask, onDeleteTask }: ContextualPa ); }; - return ContextualPalette; + return TaskContextualPalette; +}; + +export const getTaskDependencyContextalPalette = ({ onDeleteTaskDependency }: TaskDependencyContextualPaletteProps) => { + const handleTaskDependencyDelete = (taskFrom: Task, taskTo: Task, onClosePalette: () => any) => { + onClosePalette(); + onDeleteTaskDependency(taskFrom.id, taskTo.id); + }; + + const classes = useContextualPaletteStyle(); + + const DependencyContextualPalette: React.FC = ({ + taskFrom, + taskTo, + onClosePalette, + }) => { + return ( +
+ handleTaskDependencyDelete(taskFrom, taskTo, onClosePalette)} + data-testid="delete-task-dependency"> + + +
+ ); + }; + return DependencyContextualPalette; }; diff --git a/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.types.ts b/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.types.ts index 09832f969bc..29c1b7c469b 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.types.ts +++ b/packages/gantt/frontend/sirius-components-gantt/src/palette/ContextualPalette.types.ts @@ -12,8 +12,12 @@ *******************************************************************************/ import { Task } from '@ObeoNetwork/gantt-task-react'; -export interface ContextualPaletteProps { +export interface TaskContextualPaletteProps { onCreateTask: (task: Task) => void; onEditTask: (task: Task) => void; onDeleteTask: (task: Task) => void; } + +export interface TaskDependencyContextualPaletteProps { + onDeleteTaskDependency: (sourceTaskId: string, targetTaskId: string) => void; +} diff --git a/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.tsx b/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.tsx index 51a0ad14199..0369777a922 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.tsx +++ b/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.tsx @@ -37,7 +37,7 @@ import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import { useEffect, useRef, useState } from 'react'; import { GQLGanttDateRoundingTimeUnit, SelectableTask } from '../graphql/subscription/GanttSubscription.types'; import { checkIsHoliday, getDisplayedColumns, getSelectedColumns, roundDate } from '../helper/helper'; -import { getContextalPalette } from '../palette/ContextualPalette'; +import { getTaskContextalPalette, getTaskDependencyContextalPalette } from '../palette/ContextualPalette'; import { Toolbar } from '../toolbar/Toolbar'; import { GanttProps, GanttState, TaskListColumnEnum } from './Gantt.types'; @@ -69,6 +69,7 @@ export const Gantt = ({ onDeleteTask, onDropTask, onCreateTaskDependency, + onDeleteTaskDependency, onChangeTaskCollapseState, onChangeColumn, }: GanttProps) => { @@ -129,10 +130,6 @@ export const Gantt = ({ }); }; - const handleDeleteTaskOnContextualPalette = (task: Task) => { - onDeleteTask([task]); - }; - const handleMoveTaskAfter: OnMoveTaskBeforeAfter = (task, taskForMove) => { const index = tasks.filter((t) => t.parent === task.parent).findIndex((t) => t.id === task.id); const parent = tasks.find((t) => t.id === task.parent); @@ -285,11 +282,14 @@ export const Gantt = ({ checkIsHoliday={checkIsHoliday} dateMoveStep={dateRounding} onWheel={onwheel} - ContextualPalette={getContextalPalette({ + ContextualPalette={getTaskContextalPalette({ onCreateTask, - onDeleteTask: handleDeleteTaskOnContextualPalette, + onDeleteTask: (task: Task) => onDeleteTask([task]), onEditTask, })} + TaskDependencyContextualPalette={getTaskDependencyContextalPalette({ + onDeleteTaskDependency, + })} isMoveChildsWithParent={false} onMoveTaskBefore={handleMoveTaskBefore} onMoveTaskAfter={handleMoveTaskAfter} diff --git a/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.types.ts b/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.types.ts index e0ea3baac74..f552f6eb1d9 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.types.ts +++ b/packages/gantt/frontend/sirius-components-gantt/src/representation/Gantt.types.ts @@ -42,6 +42,7 @@ export interface GanttProps { onExpandCollapse: (task: Task) => void; onDropTask: (droppedTask: TaskOrEmpty, targetTask: TaskOrEmpty | undefined, dropIndex: number) => void; onCreateTaskDependency: (sourceTaskId: string, targetTaskId: string) => void; + onDeleteTaskDependency: (sourceTaskId: string, targetTaskId: string) => void; onChangeTaskCollapseState: (taskId: string, collapsed: boolean) => void; onChangeColumn: (columnId: string, displayed: boolean, width: number) => void; } diff --git a/packages/gantt/frontend/sirius-components-gantt/src/representation/GanttRepresentation.tsx b/packages/gantt/frontend/sirius-components-gantt/src/representation/GanttRepresentation.tsx index 871d21586d2..ce90c1100b5 100644 --- a/packages/gantt/frontend/sirius-components-gantt/src/representation/GanttRepresentation.tsx +++ b/packages/gantt/frontend/sirius-components-gantt/src/representation/GanttRepresentation.tsx @@ -110,8 +110,16 @@ export const GanttRepresentation = ({ editingContextId, representationId }: Repr //--------------------------------- // Mutations - const { deleteTask, editTask, createTask, dropTask, createTaskDependency, changeTaskCollapseState, changeColumn } = - useGanttMutations(editingContextId, representationId); + const { + deleteTask, + editTask, + createTask, + dropTask, + createTaskDependency, + deleteTaskDependency, + changeTaskCollapseState, + changeColumn, + } = useGanttMutations(editingContextId, representationId); const handleEditTask = (task: TaskOrEmpty) => { const newDetail: GQLTaskDetail = { @@ -158,6 +166,7 @@ export const GanttRepresentation = ({ editingContextId, representationId }: Repr onCreateTaskDependency={createTaskDependency} onChangeTaskCollapseState={changeTaskCollapseState} onChangeColumn={changeColumn} + onDeleteTaskDependency={deleteTaskDependency} /> ); } diff --git a/packages/papaya/backend/sirius-components-papaya-edit/src/main/java/org/eclipse/sirius/components/papaya/provider/TaskItemProvider.java b/packages/papaya/backend/sirius-components-papaya-edit/src/main/java/org/eclipse/sirius/components/papaya/provider/TaskItemProvider.java index fb8a5ea1095..94679c08ad9 100644 --- a/packages/papaya/backend/sirius-components-papaya-edit/src/main/java/org/eclipse/sirius/components/papaya/provider/TaskItemProvider.java +++ b/packages/papaya/backend/sirius-components-papaya-edit/src/main/java/org/eclipse/sirius/components/papaya/provider/TaskItemProvider.java @@ -58,6 +58,7 @@ public List getPropertyDescriptors(Object object) { this.addStartDatePropertyDescriptor(object); this.addEndDatePropertyDescriptor(object); this.addDonePropertyDescriptor(object); + this.addDependenciesPropertyDescriptor(object); } return this.itemPropertyDescriptors; } @@ -128,6 +129,17 @@ protected void addDonePropertyDescriptor(Object object) { false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } + /** + * This adds a property descriptor for the Dependencies feature. + * + * @generated + */ + protected void addDependenciesPropertyDescriptor(Object object) { + this.itemPropertyDescriptors.add(this.createItemPropertyDescriptor(((ComposeableAdapterFactory) this.adapterFactory).getRootAdapterFactory(), this.getResourceLocator(), + this.getString("_UI_Task_dependencies_feature"), this.getString("_UI_PropertyDescriptor_description", "_UI_Task_dependencies_feature", "_UI_Task_type"), + PapayaPackage.Literals.TASK__DEPENDENCIES, true, false, true, null, null, null)); + } + /** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or diff --git a/packages/papaya/backend/sirius-components-papaya-edit/src/main/resources/plugin.properties b/packages/papaya/backend/sirius-components-papaya-edit/src/main/resources/plugin.properties index 5d78964b540..71aa8451417 100644 --- a/packages/papaya/backend/sirius-components-papaya-edit/src/main/resources/plugin.properties +++ b/packages/papaya/backend/sirius-components-papaya-edit/src/main/resources/plugin.properties @@ -81,6 +81,7 @@ _UI_Task_tasks_feature = Tasks _UI_Task_startDate_feature = Start Date _UI_Task_endDate_feature = End Date _UI_Task_done_feature = Done +_UI_Task_dependencies_feature = Dependencies _UI_Contribution_relatedTasks_feature = Related Tasks _UI_Contribution_targets_feature = Targets _UI_Contribution_done_feature = Done diff --git a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/PapayaPackage.java b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/PapayaPackage.java index 77050f7fd2a..709e9142ad3 100644 --- a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/PapayaPackage.java +++ b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/PapayaPackage.java @@ -484,13 +484,22 @@ public interface PapayaPackage extends EPackage { */ int TASK__DONE = NAMED_ELEMENT_FEATURE_COUNT + 6; + /** + * The feature id for the 'Dependencies' reference list. + * + * @generated + * @ordered + */ + int TASK__DEPENDENCIES = NAMED_ELEMENT_FEATURE_COUNT + 7; + /** * The number of structural features of the 'Task' class. * * @generated * @ordered */ - int TASK_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 7; + int TASK_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 8; /** * The number of operations of the 'Task' class. @@ -3076,6 +3085,17 @@ public interface PapayaPackage extends EPackage { */ EAttribute getTask_Done(); + /** + * Returns the meta object for the reference list '{@link org.eclipse.sirius.components.papaya.Task#getDependencies + * Dependencies}'. + * + * @return the meta object for the reference list 'Dependencies'. + * @see org.eclipse.sirius.components.papaya.Task#getDependencies() + * @see #getTask() + * @generated + */ + EReference getTask_Dependencies(); + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.papaya.Contribution * Contribution}'. @@ -4306,6 +4326,14 @@ interface Literals { */ EAttribute TASK__DONE = eINSTANCE.getTask_Done(); + /** + * The meta object literal for the 'Dependencies' reference list feature. + * + * @generated + */ + EReference TASK__DEPENDENCIES = eINSTANCE.getTask_Dependencies(); + /** * The meta object literal for the '{@link org.eclipse.sirius.components.papaya.impl.ContributionImpl * Contribution}' class. diff --git a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/Task.java b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/Task.java index 4c58eb094b6..09d6e959077 100644 --- a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/Task.java +++ b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/Task.java @@ -30,6 +30,7 @@ *
  • {@link org.eclipse.sirius.components.papaya.Task#getStartDate Start Date}
  • *
  • {@link org.eclipse.sirius.components.papaya.Task#getEndDate End Date}
  • *
  • {@link org.eclipse.sirius.components.papaya.Task#isDone Done}
  • + *
  • {@link org.eclipse.sirius.components.papaya.Task#getDependencies Dependencies}
  • * * * @see org.eclipse.sirius.components.papaya.PapayaPackage#getTask() @@ -172,4 +173,15 @@ public interface Task extends NamedElement { */ void setDone(boolean value); + /** + * Returns the value of the 'Dependencies' reference list. The list contents are of type + * {@link org.eclipse.sirius.components.papaya.Task}. + * + * @return the value of the 'Dependencies' reference list. + * @see org.eclipse.sirius.components.papaya.PapayaPackage#getTask_Dependencies() + * @model + * @generated + */ + EList getDependencies(); + } // Task diff --git a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/PapayaPackageImpl.java b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/PapayaPackageImpl.java index efd8611f726..e0e05804a20 100644 --- a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/PapayaPackageImpl.java +++ b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/PapayaPackageImpl.java @@ -666,6 +666,16 @@ public EAttribute getTask_Done() { return (EAttribute) this.taskEClass.getEStructuralFeatures().get(6); } + /** + * + * + * @generated + */ + @Override + public EReference getTask_Dependencies() { + return (EReference) this.taskEClass.getEStructuralFeatures().get(7); + } + /** * * @@ -1599,6 +1609,7 @@ public void createPackageContents() { this.createEAttribute(this.taskEClass, TASK__START_DATE); this.createEAttribute(this.taskEClass, TASK__END_DATE); this.createEAttribute(this.taskEClass, TASK__DONE); + this.createEReference(this.taskEClass, TASK__DEPENDENCIES); this.contributionEClass = this.createEClass(CONTRIBUTION); this.createEReference(this.contributionEClass, CONTRIBUTION__RELATED_TASKS); @@ -1842,6 +1853,8 @@ public void initializePackageContents() { IS_ORDERED); this.initEAttribute(this.getTask_Done(), this.ecorePackage.getEBoolean(), "done", null, 0, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getTask_Dependencies(), this.getTask(), null, "dependencies", null, 0, -1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, + !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEClass(this.contributionEClass, Contribution.class, "Contribution", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); this.initEReference(this.getContribution_RelatedTasks(), this.getTask(), null, "relatedTasks", null, 0, -1, Contribution.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, diff --git a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/TaskImpl.java b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/TaskImpl.java index 1e084414e21..d470466e58a 100644 --- a/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/TaskImpl.java +++ b/packages/papaya/backend/sirius-components-papaya/src/main/java/org/eclipse/sirius/components/papaya/impl/TaskImpl.java @@ -42,6 +42,7 @@ *
  • {@link org.eclipse.sirius.components.papaya.impl.TaskImpl#getStartDate Start Date}
  • *
  • {@link org.eclipse.sirius.components.papaya.impl.TaskImpl#getEndDate End Date}
  • *
  • {@link org.eclipse.sirius.components.papaya.impl.TaskImpl#isDone Done}
  • + *
  • {@link org.eclipse.sirius.components.papaya.impl.TaskImpl#getDependencies Dependencies}
  • * * * @generated @@ -167,6 +168,16 @@ public class TaskImpl extends NamedElementImpl implements Task { */ protected boolean done = DONE_EDEFAULT; + /** + * The cached value of the '{@link #getDependencies() Dependencies}' reference list. + * + * @see #getDependencies() + * @generated + * @ordered + */ + protected EList dependencies; + /** * * @@ -327,6 +338,19 @@ public void setDone(boolean newDone) { this.eNotify(new ENotificationImpl(this, Notification.SET, PapayaPackage.TASK__DONE, oldDone, this.done)); } + /** + * + * + * @generated + */ + @Override + public EList getDependencies() { + if (this.dependencies == null) { + this.dependencies = new EObjectResolvingEList<>(Task.class, this, PapayaPackage.TASK__DEPENDENCIES); + } + return this.dependencies; + } + /** * * @@ -363,6 +387,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getEndDate(); case PapayaPackage.TASK__DONE: return this.isDone(); + case PapayaPackage.TASK__DEPENDENCIES: + return this.getDependencies(); } return super.eGet(featureID, resolve, coreType); } @@ -399,6 +425,10 @@ public void eSet(int featureID, Object newValue) { case PapayaPackage.TASK__DONE: this.setDone((Boolean) newValue); return; + case PapayaPackage.TASK__DEPENDENCIES: + this.getDependencies().clear(); + this.getDependencies().addAll((Collection) newValue); + return; } super.eSet(featureID, newValue); } @@ -432,6 +462,9 @@ public void eUnset(int featureID) { case PapayaPackage.TASK__DONE: this.setDone(DONE_EDEFAULT); return; + case PapayaPackage.TASK__DEPENDENCIES: + this.getDependencies().clear(); + return; } super.eUnset(featureID); } @@ -458,6 +491,8 @@ public boolean eIsSet(int featureID) { return END_DATE_EDEFAULT == null ? this.endDate != null : !END_DATE_EDEFAULT.equals(this.endDate); case PapayaPackage.TASK__DONE: return this.done != DONE_EDEFAULT; + case PapayaPackage.TASK__DEPENDENCIES: + return this.dependencies != null && !this.dependencies.isEmpty(); } return super.eIsSet(featureID); } diff --git a/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.ecore b/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.ecore index 5eb4fcc7423..2b64a900e07 100644 --- a/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.ecore +++ b/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.ecore @@ -48,6 +48,8 @@ + diff --git a/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.genmodel b/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.genmodel index b1ecfc89927..eef6a13acf9 100644 --- a/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.genmodel +++ b/packages/papaya/backend/sirius-components-papaya/src/main/resources/model/papaya.genmodel @@ -59,6 +59,7 @@ + diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/gantt/PapayaGanttControllerIntegrationTests.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/gantt/PapayaGanttControllerIntegrationTests.java index ea4d9f7a8b9..6d3fceaaf08 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/gantt/PapayaGanttControllerIntegrationTests.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/application/controllers/gantt/PapayaGanttControllerIntegrationTests.java @@ -27,13 +27,17 @@ import org.eclipse.sirius.components.collaborative.gantt.dto.GanttRefreshedEventPayload; import org.eclipse.sirius.components.collaborative.gantt.dto.input.ChangeGanttColumnInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.ChangeTaskCollapseStateInput; +import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskDependencyInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.CreateGanttTaskInput; +import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskDependencyInput; import org.eclipse.sirius.components.collaborative.gantt.dto.input.DeleteGanttTaskInput; import org.eclipse.sirius.components.core.api.SuccessPayload; import org.eclipse.sirius.components.gantt.Gantt; import org.eclipse.sirius.components.gantt.tests.graphql.ChangeColumnMutationRunner; import org.eclipse.sirius.components.gantt.tests.graphql.ChangeTaskCollapseStateMutationRunner; +import org.eclipse.sirius.components.gantt.tests.graphql.CreateTaskDependencyMutationRunner; import org.eclipse.sirius.components.gantt.tests.graphql.CreateTaskMutationRunner; +import org.eclipse.sirius.components.gantt.tests.graphql.DeleteTaskDependencyMutationRunner; import org.eclipse.sirius.components.gantt.tests.graphql.DeleteTaskMutationRunner; import org.eclipse.sirius.components.gantt.tests.navigation.GanttNavigator; import org.eclipse.sirius.web.AbstractIntegrationTests; @@ -85,6 +89,11 @@ public class PapayaGanttControllerIntegrationTests extends AbstractIntegrationTe @Autowired private ChangeColumnMutationRunner changeColumnMutationRunner; + @Autowired + private CreateTaskDependencyMutationRunner createTaskDependencyMutationRunner; + + @Autowired + private DeleteTaskDependencyMutationRunner deleteTaskDependencyMutationRunner; @BeforeEach public void beforeEach() { @@ -318,4 +327,76 @@ public void givenGanttRepresentationWhenChangeColumnMutationIsPerformedThenItSuc .thenCancel() .verify(Duration.ofSeconds(10)); } + + @Test + @DisplayName("Given a gantt representation, when the task dependency creation and deletion mutations are invoked, then it succeeds") + @Sql(scripts = {"/scripts/papaya.sql"}, executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) + @Sql(scripts = {"/scripts/cleanup.sql"}, executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD, config = @SqlConfig(transactionMode = SqlConfig.TransactionMode.ISOLATED)) + public void givenGanttWhenCreateAndDeleteTaskDependencyMutationArePerformedThenItSucceeds() { + + var flux = this.givenSubscriptionToGantt(); + + var ganttRef = new AtomicReference(); + var sourceTaskId = new AtomicReference(); + var targetTaskId = new AtomicReference(); + String taskName1 = "Improve some features of the deck"; + String taskName2 = "Improve some features of the gantt"; + Consumer initialGanttContentConsumer = payload -> Optional.of(payload) + .map(GanttRefreshedEventPayload::gantt) + .ifPresentOrElse(gantt -> { + ganttRef.set(gantt); + var task = new GanttNavigator(gantt).findTaskByName(taskName1); + sourceTaskId.set(task.id()); + task = new GanttNavigator(gantt).findTaskByName(taskName2); + assertThat(task.taskDependencyIds()).isEmpty(); + targetTaskId.set(task.id()); + }, () -> fail(MISSING_GANTT)); + + + Runnable createDependencyRunnable = () -> { + var createGanttTaskDependencyInput = new CreateGanttTaskDependencyInput( + UUID.randomUUID(), + PapayaIdentifiers.PAPAYA_PROJECT.toString(), + ganttRef.get().getId(), sourceTaskId.get(), targetTaskId.get()); + var result = this.createTaskDependencyMutationRunner.run(createGanttTaskDependencyInput); + + String typename = JsonPath.read(result, "$.data.createGanttTaskDependency.__typename"); + assertThat(typename).isEqualTo(SuccessPayload.class.getSimpleName()); + }; + + Consumer checkDependencyConsumer = payload -> Optional.of(payload) + .map(GanttRefreshedEventPayload::gantt) + .ifPresentOrElse(gantt -> { + var task = new GanttNavigator(gantt).findTaskByName(taskName2); + assertThat(task.taskDependencyIds()).contains(sourceTaskId.get()); + }, () -> fail(MISSING_GANTT)); + + Runnable deleteDependencyRunnable = () -> { + var deleteGanttTaskDependencyInput = new DeleteGanttTaskDependencyInput( + UUID.randomUUID(), + PapayaIdentifiers.PAPAYA_PROJECT.toString(), + ganttRef.get().getId(), sourceTaskId.get(), targetTaskId.get()); + var result = this.deleteTaskDependencyMutationRunner.run(deleteGanttTaskDependencyInput); + + String typename = JsonPath.read(result, "$.data.deleteGanttTaskDependency.__typename"); + assertThat(typename).isEqualTo(SuccessPayload.class.getSimpleName()); + }; + + Consumer checkDependencyAfterDeleteConsumer = payload -> Optional.of(payload) + .map(GanttRefreshedEventPayload::gantt) + .ifPresentOrElse(gantt -> { + var task = new GanttNavigator(gantt).findTaskByName(taskName2); + assertThat(task.taskDependencyIds()).isEmpty(); + }, () -> fail(MISSING_GANTT)); + + + StepVerifier.create(flux) + .consumeNextWith(initialGanttContentConsumer) + .then(createDependencyRunnable) + .consumeNextWith(checkDependencyConsumer) + .then(deleteDependencyRunnable) + .consumeNextWith(checkDependencyAfterDeleteConsumer) + .thenCancel() + .verify(Duration.ofSeconds(10)); + } } diff --git a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/gantt/PapayaGanttDescriptionProvider.java b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/gantt/PapayaGanttDescriptionProvider.java index 8e96205d6ac..ffb749f1259 100644 --- a/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/gantt/PapayaGanttDescriptionProvider.java +++ b/packages/sirius-web/backend/sirius-web/src/test/java/org/eclipse/sirius/web/services/gantt/PapayaGanttDescriptionProvider.java @@ -24,14 +24,19 @@ import org.eclipse.sirius.components.view.ChangeContext; import org.eclipse.sirius.components.view.SetValue; import org.eclipse.sirius.components.view.View; +import org.eclipse.sirius.components.view.builder.generated.ChangeContextBuilder; import org.eclipse.sirius.components.view.builder.generated.CreateInstanceBuilder; import org.eclipse.sirius.components.view.builder.generated.DeleteElementBuilder; import org.eclipse.sirius.components.view.builder.generated.GanttBuilders; import org.eclipse.sirius.components.view.builder.generated.GanttDescriptionBuilder; +import org.eclipse.sirius.components.view.builder.generated.SetValueBuilder; +import org.eclipse.sirius.components.view.builder.generated.UnsetValueBuilder; import org.eclipse.sirius.components.view.builder.generated.ViewBuilder; import org.eclipse.sirius.components.view.builder.generated.ViewBuilders; import org.eclipse.sirius.components.view.emf.gantt.IGanttIdProvider; +import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.GanttDescription; import org.eclipse.sirius.components.view.gantt.TaskDescription; @@ -92,6 +97,8 @@ private View createView() { private GanttDescription createGanttDescription() { CreateTaskTool createTaskTool = this.createCreateTaskTool(); DeleteTaskTool deleteTaskTool = this.createDeleteTaskTool(); + CreateTaskDependencyTool createTaskDependencyTool = this.createCreateTaskDependencyTool(); + DeleteTaskDependencyTool deleteTaskDependencyTool = this.createDeleteTaskDependencyTool(); this.ganttDescription = new GanttDescriptionBuilder() .name("Gantt") @@ -100,6 +107,8 @@ private GanttDescription createGanttDescription() { .taskElementDescriptions(this.createTaskDescriptionInProject()) .createTool(createTaskTool) .deleteTool(deleteTaskTool) + .createTaskDependencyTool(createTaskDependencyTool) + .deleteTaskDependencyTool(deleteTaskDependencyTool) .build(); return this.ganttDescription; @@ -129,6 +138,7 @@ private TaskDescription createTaskDescriptionInTask() { .startTimeExpression("aql:self.startTime") .endTimeExpression("aql:self.endTime") .progressExpression("aql:self.progress") + .taskDependenciesExpression("aql:self.dependencies") .build(); taskDescription.getReusedTaskElementDescriptions().add(taskDescription); @@ -166,4 +176,30 @@ private CreateTaskTool createCreateTaskTool() { .build()) .build(); } + + private CreateTaskDependencyTool createCreateTaskDependencyTool() { + return new GanttBuilders().newCreateTaskDependencyTool() + .name("Create Task Dependency") + .body(new ChangeContextBuilder() + .expression("aql:targetObject") + .children(new SetValueBuilder() + .featureName("dependencies") + .valueExpression("aql:sourceObject") + .build()) + .build()) + .build(); + } + + private DeleteTaskDependencyTool createDeleteTaskDependencyTool() { + return new GanttBuilders().newDeleteTaskDependencyTool() + .name("Delete Task Dependency") + .body(new ChangeContextBuilder() + .expression("aql:targetObject") + .children(new UnsetValueBuilder() + .featureName("dependencies") + .elementExpression("aql:sourceObject") + .build()) + .build()) + .build(); + } } diff --git a/packages/sirius-web/frontend/sirius-web/package.json b/packages/sirius-web/frontend/sirius-web/package.json index b191eab44db..46722d79d48 100644 --- a/packages/sirius-web/frontend/sirius-web/package.json +++ b/packages/sirius-web/frontend/sirius-web/package.json @@ -30,7 +30,7 @@ "@material-ui/core": "4.12.4", "@material-ui/icons": "4.11.3", "@material-ui/lab": "4.0.0-alpha.61", - "@ObeoNetwork/gantt-task-react": "0.4.17", + "@ObeoNetwork/gantt-task-react": "0.4.18", "@ObeoNetwork/react-trello": "2.4.11", "@types/react": "17.0.37", "@types/react-router-dom": "5.3.3", diff --git a/packages/starters/backend/sirius-components-task-starter/src/main/java/org/eclipse/sirius/components/task/starter/configuration/view/ViewGanttDescriptionBuilder.java b/packages/starters/backend/sirius-components-task-starter/src/main/java/org/eclipse/sirius/components/task/starter/configuration/view/ViewGanttDescriptionBuilder.java index 98bba45ac57..b20748a006c 100644 --- a/packages/starters/backend/sirius-components-task-starter/src/main/java/org/eclipse/sirius/components/task/starter/configuration/view/ViewGanttDescriptionBuilder.java +++ b/packages/starters/backend/sirius-components-task-starter/src/main/java/org/eclipse/sirius/components/task/starter/configuration/view/ViewGanttDescriptionBuilder.java @@ -17,8 +17,10 @@ import org.eclipse.sirius.components.view.builder.generated.DeleteElementBuilder; import org.eclipse.sirius.components.view.builder.generated.GanttBuilders; import org.eclipse.sirius.components.view.builder.generated.SetValueBuilder; +import org.eclipse.sirius.components.view.builder.generated.UnsetValueBuilder; import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.DropTaskTool; import org.eclipse.sirius.components.view.gantt.EditTaskTool; @@ -54,6 +56,7 @@ private GanttDescription createGanttDescription() { DeleteTaskTool deleteTaskTool = this.createDeleteTaskTool(); DropTaskTool dropTaskTool = this.createDropTaskTool(); CreateTaskDependencyTool createTaskDependencyTool = this.createTaskDependencyTool(); + DeleteTaskDependencyTool deleteTaskDependencyTool = this.createDeleteTaskDependencyTool(); GanttDescription ganttDescription = new GanttBuilders().newGanttDescription() .name(GANTT_REP_DESC_NAME) @@ -65,6 +68,7 @@ private GanttDescription createGanttDescription() { .deleteTool(deleteTaskTool) .dropTool(dropTaskTool) .createTaskDependencyTool(createTaskDependencyTool) + .deleteTaskDependencyTool(deleteTaskDependencyTool) .build(); return ganttDescription; @@ -118,6 +122,19 @@ private CreateTaskDependencyTool createTaskDependencyTool() { .build(); } + private DeleteTaskDependencyTool createDeleteTaskDependencyTool() { + return new GanttBuilders().newDeleteTaskDependencyTool() + .name("Delete Task Dependency") + .body(new ChangeContextBuilder() + .expression("aql:targetObject") + .children(new UnsetValueBuilder() + .featureName("dependencies") + .elementExpression("aql:sourceObject") + .build()) + .build()) + .build(); + } + private TaskDescription createTaskDescriptionInProject() { TaskDescription taskDescriptionInTask = this.createTaskDescriptionInTask(); diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/DeleteTaskDependencyToolBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/DeleteTaskDependencyToolBuilder.java new file mode 100644 index 00000000000..2cd9d2b87ee --- /dev/null +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/DeleteTaskDependencyToolBuilder.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2023, 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.sirius.components.view.builder.generated; + +/** + * Builder for DeleteTaskDependencyToolBuilder. + * + * @author BuilderGenerator + * @generated + */ +public class DeleteTaskDependencyToolBuilder { + + /** + * Create instance org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool. + * @generated + */ + private org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool deleteTaskDependencyTool = org.eclipse.sirius.components.view.gantt.GanttFactory.eINSTANCE.createDeleteTaskDependencyTool(); + + /** + * Return instance org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool. + * @generated + */ + protected org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool getDeleteTaskDependencyTool() { + return this.deleteTaskDependencyTool; + } + + /** + * Return instance org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool. + * @generated + */ + public org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool build() { + return this.getDeleteTaskDependencyTool(); + } + + /** + * Setter for Name. + * + * @generated + */ + public DeleteTaskDependencyToolBuilder name(java.lang.String value) { + this.getDeleteTaskDependencyTool().setName(value); + return this; + } + /** + * Setter for Body. + * + * @generated + */ + public DeleteTaskDependencyToolBuilder body(org.eclipse.sirius.components.view.Operation ... values) { + for (org.eclipse.sirius.components.view.Operation value : values) { + this.getDeleteTaskDependencyTool().getBody().add(value); + } + return this; + } + + +} + diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttBuilders.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttBuilders.java index 193db7ebf59..54f819bf364 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttBuilders.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttBuilders.java @@ -89,5 +89,15 @@ public CreateTaskDependencyToolBuilder newCreateTaskDependencyTool() { return new CreateTaskDependencyToolBuilder(); } + /** + * Instantiate a DeleteTaskDependencyToolBuilder . + * + * @author BuilderGenerator + * @generated + */ + public DeleteTaskDependencyToolBuilder newDeleteTaskDependencyTool() { + return new DeleteTaskDependencyToolBuilder(); + } + } diff --git a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttDescriptionBuilder.java b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttDescriptionBuilder.java index ea649b2e60a..6775a8a995f 100644 --- a/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttDescriptionBuilder.java +++ b/packages/view/backend/sirius-components-view-builder/src/main/java/org/eclipse/sirius/components/view/builder/generated/GanttDescriptionBuilder.java @@ -138,6 +138,16 @@ public GanttDescriptionBuilder createTaskDependencyTool(org.eclipse.sirius.compo return this; } + /** + * Setter for DeleteTaskDependencyTool. + * + * @generated + */ + public GanttDescriptionBuilder deleteTaskDependencyTool(org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool value) { + this.getGanttDescription().setDeleteTaskDependencyTool(value); + return this; + } + /** * Setter for DateRoundingExpression. * diff --git a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/gantt/ViewGanttDescriptionConverter.java b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/gantt/ViewGanttDescriptionConverter.java index 39a31d244dc..cfd608c4f36 100644 --- a/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/gantt/ViewGanttDescriptionConverter.java +++ b/packages/view/backend/sirius-components-view-emf/src/main/java/org/eclipse/sirius/components/view/emf/gantt/ViewGanttDescriptionConverter.java @@ -108,6 +108,9 @@ public IRepresentationDescription convert(RepresentationDescription viewRepresen .createTaskDependencyProvider(Optional.ofNullable(viewGanttDescription.getCreateTaskDependencyTool()).map(tool -> this.getOperationsHandler(tool.getBody(), interpreter)) .orElse(variable -> { })) + .deleteTaskDependencyProvider(Optional.ofNullable(viewGanttDescription.getDeleteTaskDependencyTool()).map(tool -> this.getOperationsHandler(tool.getBody(), interpreter)) + .orElse(variable -> { + })) .taskDescriptions(taskDescriptions) .dateRoundingProvider(variableManager -> this.evaluateString(interpreter, variableManager, viewGanttDescription.getDateRoundingExpression())) .build(); diff --git a/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/DeleteTaskDependencyToolItemProvider.java b/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/DeleteTaskDependencyToolItemProvider.java new file mode 100644 index 00000000000..719947d01a0 --- /dev/null +++ b/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/DeleteTaskDependencyToolItemProvider.java @@ -0,0 +1,108 @@ +/******************************************************************************* + * 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.sirius.components.view.gantt.provider; + +import java.util.Collection; +import java.util.List; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool} + * object. + * + * @generated + */ +public class DeleteTaskDependencyToolItemProvider extends TaskToolItemProvider { + /** + * This constructs an instance from a factory and a notifier. + * + * @generated + */ + public DeleteTaskDependencyToolItemProvider(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + /** + * This returns the property descriptors for the adapted class. + * + * @generated + */ + @Override + public List getPropertyDescriptors(Object object) { + if (this.itemPropertyDescriptors == null) { + super.getPropertyDescriptors(object); + + } + return this.itemPropertyDescriptors; + } + + /** + * This returns DeleteTaskDependencyTool.gif. + * + * @generated NOT + */ + @Override + public Object getImage(Object object) { + return this.overlayImage(object, this.getResourceLocator().getImage("full/obj16/DeleteTaskDependencyTool.svg")); + } + + /** + * + * + * @generated + */ + @Override + protected boolean shouldComposeCreationImage() { + return true; + } + + /** + * This returns the label text for the adapted class. + * + * @generated + */ + @Override + public String getText(Object object) { + String label = ((DeleteTaskDependencyTool) object).getName(); + return label == null || label.length() == 0 ? this.getString("_UI_DeleteTaskDependencyTool_type") : this.getString("_UI_DeleteTaskDependencyTool_type") + " " + label; + } + + /** + * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating + * a viewer notification, which it passes to {@link #fireNotifyChanged}. + * + * @generated + */ + @Override + public void notifyChanged(Notification notification) { + this.updateChildren(notification); + super.notifyChanged(notification); + } + + /** + * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created + * under this object. + * + * @generated + */ + @Override + protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { + super.collectNewChildDescriptors(newChildDescriptors, object); + } + +} diff --git a/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttDescriptionItemProvider.java b/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttDescriptionItemProvider.java index c69567d11cf..358df60ffeb 100644 --- a/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttDescriptionItemProvider.java +++ b/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttDescriptionItemProvider.java @@ -89,6 +89,7 @@ public Collection getChildrenFeatures(Object objec this.childrenFeatures.add(GanttPackage.Literals.GANTT_DESCRIPTION__DELETE_TOOL); this.childrenFeatures.add(GanttPackage.Literals.GANTT_DESCRIPTION__DROP_TOOL); this.childrenFeatures.add(GanttPackage.Literals.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL); + this.childrenFeatures.add(GanttPackage.Literals.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL); } return this.childrenFeatures; } @@ -158,6 +159,7 @@ public void notifyChanged(Notification notification) { case GanttPackage.GANTT_DESCRIPTION__DELETE_TOOL: case GanttPackage.GANTT_DESCRIPTION__DROP_TOOL: case GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL: + case GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL: this.fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -185,6 +187,8 @@ protected void collectNewChildDescriptors(Collection newChildDescriptors newChildDescriptors.add(this.createChildParameter(GanttPackage.Literals.GANTT_DESCRIPTION__DROP_TOOL, GanttFactory.eINSTANCE.createDropTaskTool())); newChildDescriptors.add(this.createChildParameter(GanttPackage.Literals.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL, GanttFactory.eINSTANCE.createCreateTaskDependencyTool())); + + newChildDescriptors.add(this.createChildParameter(GanttPackage.Literals.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL, GanttFactory.eINSTANCE.createDeleteTaskDependencyTool())); } } diff --git a/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttItemProviderAdapterFactory.java b/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttItemProviderAdapterFactory.java index caa06ead431..dfb503cc47e 100644 --- a/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttItemProviderAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-gantt-edit/src/main/java/org/eclipse/sirius/components/view/gantt/provider/GanttItemProviderAdapterFactory.java @@ -260,6 +260,30 @@ public Adapter createCreateTaskDependencyToolAdapter() { return this.createTaskDependencyToolItemProvider; } + /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool} instances. + * + * @generated + */ + protected DeleteTaskDependencyToolItemProvider deleteTaskDependencyToolItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool}. + * + * @generated + */ + @Override + public Adapter createDeleteTaskDependencyToolAdapter() { + if (this.deleteTaskDependencyToolItemProvider == null) { + this.deleteTaskDependencyToolItemProvider = new DeleteTaskDependencyToolItemProvider(this); + } + + return this.deleteTaskDependencyToolItemProvider; + } + /** * This returns the root adapter factory that contains this factory. * @@ -403,6 +427,8 @@ public void dispose() { this.dropTaskToolItemProvider.dispose(); if (this.createTaskDependencyToolItemProvider != null) this.createTaskDependencyToolItemProvider.dispose(); + if (this.deleteTaskDependencyToolItemProvider != null) + this.deleteTaskDependencyToolItemProvider.dispose(); } /** diff --git a/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/icons/full/obj16/DeleteTaskDependencyTool.svg b/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/icons/full/obj16/DeleteTaskDependencyTool.svg new file mode 100644 index 00000000000..d479aeeeeeb --- /dev/null +++ b/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/icons/full/obj16/DeleteTaskDependencyTool.svg @@ -0,0 +1,22 @@ + + + + + + diff --git a/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/plugin.properties b/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/plugin.properties index 87354a0bbd3..188a37d5173 100644 --- a/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/plugin.properties +++ b/packages/view/backend/sirius-components-view-gantt-edit/src/main/resources/plugin.properties @@ -29,6 +29,7 @@ _UI_EditTaskTool_type = Edit Task Tool _UI_DeleteTaskTool_type = Delete Task Tool _UI_DropTaskTool_type= Drop Task Tool _UI_CreateTaskDependencyTool_type = Create Task Dependency Tool +_UI_DeleteTaskDependencyTool_type = Delete Task Dependency Tool _UI_Unknown_type = Object _UI_Unknown_datatype= Value @@ -39,6 +40,7 @@ _UI_GanttDescription_editTool_feature = Edit Tool _UI_GanttDescription_deleteTool_feature = Delete Tool _UI_GanttDescription_dropTool_feature = Drop Tool _UI_GanttDescription_createTaskDependencyTool_feature = Create Task Dependency Tool +_UI_GanttDescription_deleteTaskDependencyTool_feature = Delete Task Dependency Tool _UI_GanttDescription_dateRoundingExpression_feature = Date Rounding Expression _UI_TaskDescription_name_feature = Name _UI_TaskDescription_domainType_feature = Domain Type diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/DeleteTaskDependencyTool.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/DeleteTaskDependencyTool.java new file mode 100644 index 00000000000..118a33d587e --- /dev/null +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/DeleteTaskDependencyTool.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2023, 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.sirius.components.view.gantt; + +/** + * A representation of the model object 'Delete Task Dependency Tool'. + * + * + * @see org.eclipse.sirius.components.view.gantt.GanttPackage#getDeleteTaskDependencyTool() + * @model + * @generated + */ +public interface DeleteTaskDependencyTool extends TaskTool { +} // DeleteTaskDependencyTool diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttDescription.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttDescription.java index f60b3d9a1e8..8a2d6ced889 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttDescription.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttDescription.java @@ -30,6 +30,8 @@ *
  • {@link org.eclipse.sirius.components.view.gantt.GanttDescription#getDropTool Drop Tool}
  • *
  • {@link org.eclipse.sirius.components.view.gantt.GanttDescription#getCreateTaskDependencyTool Create Task * Dependency Tool}
  • + *
  • {@link org.eclipse.sirius.components.view.gantt.GanttDescription#getDeleteTaskDependencyTool Delete Task + * Dependency Tool}
  • *
  • {@link org.eclipse.sirius.components.view.gantt.GanttDescription#getDateRoundingExpression Date Rounding * Expression}
  • * @@ -167,6 +169,30 @@ public interface GanttDescription extends RepresentationDescription { */ void setCreateTaskDependencyTool(CreateTaskDependencyTool value); + /** + * Returns the value of the 'Delete Task Dependency Tool' containment reference. + * + * @return the value of the 'Delete Task Dependency Tool' containment reference. + * @see #setDeleteTaskDependencyTool(DeleteTaskDependencyTool) + * @see org.eclipse.sirius.components.view.gantt.GanttPackage#getGanttDescription_DeleteTaskDependencyTool() + * @model containment="true" + * @generated + */ + DeleteTaskDependencyTool getDeleteTaskDependencyTool(); + + /** + * Sets the value of the + * '{@link org.eclipse.sirius.components.view.gantt.GanttDescription#getDeleteTaskDependencyTool Delete Task + * Dependency Tool}' containment reference. + * + * @param value + * the new value of the 'Delete Task Dependency Tool' containment reference. + * @see #getDeleteTaskDependencyTool() + * @generated + */ + void setDeleteTaskDependencyTool(DeleteTaskDependencyTool value); + /** * Returns the value of the 'Date Rounding Expression' attribute. The default value is * "12H". diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttFactory.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttFactory.java index cd2ea2bbbc2..9a0c91e8e1e 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttFactory.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttFactory.java @@ -86,6 +86,15 @@ public interface GanttFactory extends EFactory { */ CreateTaskDependencyTool createCreateTaskDependencyTool(); + /** + * Returns a new object of class 'Delete Task Dependency Tool'. + * + * @return a new object of class 'Delete Task Dependency Tool'. + * @generated + */ + DeleteTaskDependencyTool createDeleteTaskDependencyTool(); + /** * Returns the package supported by this factory. * diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttPackage.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttPackage.java index 864bbb923f8..34e090833ea 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttPackage.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/GanttPackage.java @@ -160,6 +160,15 @@ public interface GanttPackage extends EPackage { */ int GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 5; + /** + * The feature id for the 'Delete Task Dependency Tool' containment reference. + * + * @generated + * @ordered + */ + int GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 6; + /** * The feature id for the 'Date Rounding Expression' attribute. @@ -167,7 +176,7 @@ public interface GanttPackage extends EPackage { * @generated * @ordered */ - int GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 6; + int GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION = ViewPackage.REPRESENTATION_DESCRIPTION_FEATURE_COUNT + 7; /** * The number of structural features of the 'Description' class. @@ -583,6 +592,51 @@ public interface GanttPackage extends EPackage { */ int CREATE_TASK_DEPENDENCY_TOOL_OPERATION_COUNT = TASK_TOOL_OPERATION_COUNT + 0; + /** + * The meta object id for the '{@link org.eclipse.sirius.components.view.gantt.impl.DeleteTaskDependencyToolImpl + * Delete Task Dependency Tool}' class. + * + * @see org.eclipse.sirius.components.view.gantt.impl.DeleteTaskDependencyToolImpl + * @see org.eclipse.sirius.components.view.gantt.impl.GanttPackageImpl#getDeleteTaskDependencyTool() + * @generated + */ + int DELETE_TASK_DEPENDENCY_TOOL = 8; + + /** + * The feature id for the 'Name' attribute. + * + * @generated + * @ordered + */ + int DELETE_TASK_DEPENDENCY_TOOL__NAME = TASK_TOOL__NAME; + + /** + * The feature id for the 'Body' containment reference list. + * + * @generated + * @ordered + */ + int DELETE_TASK_DEPENDENCY_TOOL__BODY = TASK_TOOL__BODY; + + /** + * The number of structural features of the 'Delete Task Dependency Tool' class. + * + * + * @generated + * @ordered + */ + int DELETE_TASK_DEPENDENCY_TOOL_FEATURE_COUNT = TASK_TOOL_FEATURE_COUNT + 0; + + /** + * The number of operations of the 'Delete Task Dependency Tool' class. + * + * @generated + * @ordered + */ + int DELETE_TASK_DEPENDENCY_TOOL_OPERATION_COUNT = TASK_TOOL_OPERATION_COUNT + 0; + /** * Returns the meta object for class '{@link org.eclipse.sirius.components.view.gantt.GanttDescription * Description}'. @@ -665,6 +719,18 @@ public interface GanttPackage extends EPackage { */ EReference getGanttDescription_CreateTaskDependencyTool(); + /** + * Returns the meta object for the containment reference + * '{@link org.eclipse.sirius.components.view.gantt.GanttDescription#getDeleteTaskDependencyTool Delete Task + * Dependency Tool}'. + * + * @return the meta object for the containment reference 'Delete Task Dependency Tool'. + * @see org.eclipse.sirius.components.view.gantt.GanttDescription#getDeleteTaskDependencyTool() + * @see #getGanttDescription() + * @generated + */ + EReference getGanttDescription_DeleteTaskDependencyTool(); + /** * Returns the meta object for the attribute * '{@link org.eclipse.sirius.components.view.gantt.GanttDescription#getDateRoundingExpression Date Rounding @@ -914,6 +980,16 @@ public interface GanttPackage extends EPackage { */ EClass getCreateTaskDependencyTool(); + /** + * Returns the meta object for class '{@link org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool + * Delete Task Dependency Tool}'. + * + * @return the meta object for class 'Delete Task Dependency Tool'. + * @see org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool + * @generated + */ + EClass getDeleteTaskDependencyTool(); + /** * Returns the factory that creates the instances of the model. * @@ -994,6 +1070,14 @@ interface Literals { */ EReference GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL = eINSTANCE.getGanttDescription_CreateTaskDependencyTool(); + /** + * The meta object literal for the 'Delete Task Dependency Tool' containment reference feature. + * + * + * @generated + */ + EReference GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL = eINSTANCE.getGanttDescription_DeleteTaskDependencyTool(); + /** * The meta object literal for the 'Date Rounding Expression' attribute feature. @@ -1185,6 +1269,17 @@ interface Literals { */ EClass CREATE_TASK_DEPENDENCY_TOOL = eINSTANCE.getCreateTaskDependencyTool(); + /** + * The meta object literal for the + * '{@link org.eclipse.sirius.components.view.gantt.impl.DeleteTaskDependencyToolImpl Delete Task Dependency + * Tool}' class. + * + * @see org.eclipse.sirius.components.view.gantt.impl.DeleteTaskDependencyToolImpl + * @see org.eclipse.sirius.components.view.gantt.impl.GanttPackageImpl#getDeleteTaskDependencyTool() + * @generated + */ + EClass DELETE_TASK_DEPENDENCY_TOOL = eINSTANCE.getDeleteTaskDependencyTool(); + } } // GanttPackage diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/DeleteTaskDependencyToolImpl.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/DeleteTaskDependencyToolImpl.java new file mode 100644 index 00000000000..0ec5790b380 --- /dev/null +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/DeleteTaskDependencyToolImpl.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * 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.sirius.components.view.gantt.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; +import org.eclipse.sirius.components.view.gantt.GanttPackage; + +/** + * An implementation of the model object 'Delete Task Dependency Tool'. + * + * @generated + */ +public class DeleteTaskDependencyToolImpl extends TaskToolImpl implements DeleteTaskDependencyTool { + /** + * + * + * @generated + */ + protected DeleteTaskDependencyToolImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return GanttPackage.Literals.DELETE_TASK_DEPENDENCY_TOOL; + } + +} // DeleteTaskDependencyToolImpl diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttDescriptionImpl.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttDescriptionImpl.java index 8a638ba313f..87a339e1585 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttDescriptionImpl.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttDescriptionImpl.java @@ -24,6 +24,7 @@ import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.DropTaskTool; import org.eclipse.sirius.components.view.gantt.EditTaskTool; @@ -48,6 +49,8 @@ *
  • {@link org.eclipse.sirius.components.view.gantt.impl.GanttDescriptionImpl#getDropTool Drop Tool}
  • *
  • {@link org.eclipse.sirius.components.view.gantt.impl.GanttDescriptionImpl#getCreateTaskDependencyTool Create * Task Dependency Tool}
  • + *
  • {@link org.eclipse.sirius.components.view.gantt.impl.GanttDescriptionImpl#getDeleteTaskDependencyTool Delete + * Task Dependency Tool}
  • *
  • {@link org.eclipse.sirius.components.view.gantt.impl.GanttDescriptionImpl#getDateRoundingExpression Date * Rounding Expression}
  • * @@ -115,6 +118,16 @@ public class GanttDescriptionImpl extends RepresentationDescriptionImpl implemen */ protected CreateTaskDependencyTool createTaskDependencyTool; + /** + * The cached value of the '{@link #getDeleteTaskDependencyTool() Delete Task Dependency Tool}' containment + * reference. + * + * @see #getDeleteTaskDependencyTool() + * @generated + * @ordered + */ + protected DeleteTaskDependencyTool deleteTaskDependencyTool; + /** * The default value of the '{@link #getDateRoundingExpression() Date Rounding Expression}' attribute. @@ -408,6 +421,55 @@ public void setCreateTaskDependencyTool(CreateTaskDependencyTool newCreateTaskDe this.eNotify(new ENotificationImpl(this, Notification.SET, GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL, newCreateTaskDependencyTool, newCreateTaskDependencyTool)); } + /** + * + * + * @generated + */ + @Override + public DeleteTaskDependencyTool getDeleteTaskDependencyTool() { + return this.deleteTaskDependencyTool; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetDeleteTaskDependencyTool(DeleteTaskDependencyTool newDeleteTaskDependencyTool, NotificationChain msgs) { + DeleteTaskDependencyTool oldDeleteTaskDependencyTool = this.deleteTaskDependencyTool; + this.deleteTaskDependencyTool = newDeleteTaskDependencyTool; + if (this.eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL, oldDeleteTaskDependencyTool, + newDeleteTaskDependencyTool); + if (msgs == null) + msgs = notification; + else + msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + @Override + public void setDeleteTaskDependencyTool(DeleteTaskDependencyTool newDeleteTaskDependencyTool) { + if (newDeleteTaskDependencyTool != this.deleteTaskDependencyTool) { + NotificationChain msgs = null; + if (this.deleteTaskDependencyTool != null) + msgs = ((InternalEObject) this.deleteTaskDependencyTool).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL, null, msgs); + if (newDeleteTaskDependencyTool != null) + msgs = ((InternalEObject) newDeleteTaskDependencyTool).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL, null, msgs); + msgs = this.basicSetDeleteTaskDependencyTool(newDeleteTaskDependencyTool, msgs); + if (msgs != null) + msgs.dispatch(); + } else if (this.eNotificationRequired()) + this.eNotify(new ENotificationImpl(this, Notification.SET, GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL, newDeleteTaskDependencyTool, newDeleteTaskDependencyTool)); + } + /** * * @@ -451,6 +513,8 @@ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, return this.basicSetDropTool(null, msgs); case GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL: return this.basicSetCreateTaskDependencyTool(null, msgs); + case GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL: + return this.basicSetDeleteTaskDependencyTool(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -475,6 +539,8 @@ public Object eGet(int featureID, boolean resolve, boolean coreType) { return this.getDropTool(); case GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL: return this.getCreateTaskDependencyTool(); + case GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL: + return this.getDeleteTaskDependencyTool(); case GanttPackage.GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION: return this.getDateRoundingExpression(); } @@ -509,6 +575,9 @@ public void eSet(int featureID, Object newValue) { case GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL: this.setCreateTaskDependencyTool((CreateTaskDependencyTool) newValue); return; + case GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL: + this.setDeleteTaskDependencyTool((DeleteTaskDependencyTool) newValue); + return; case GanttPackage.GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION: this.setDateRoundingExpression((String) newValue); return; @@ -542,6 +611,9 @@ public void eUnset(int featureID) { case GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL: this.setCreateTaskDependencyTool((CreateTaskDependencyTool) null); return; + case GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL: + this.setDeleteTaskDependencyTool((DeleteTaskDependencyTool) null); + return; case GanttPackage.GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION: this.setDateRoundingExpression(DATE_ROUNDING_EXPRESSION_EDEFAULT); return; @@ -569,6 +641,8 @@ public boolean eIsSet(int featureID) { return this.dropTool != null; case GanttPackage.GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL: return this.createTaskDependencyTool != null; + case GanttPackage.GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL: + return this.deleteTaskDependencyTool != null; case GanttPackage.GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION: return DATE_ROUNDING_EXPRESSION_EDEFAULT == null ? this.dateRoundingExpression != null : !DATE_ROUNDING_EXPRESSION_EDEFAULT.equals(this.dateRoundingExpression); } diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttFactoryImpl.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttFactoryImpl.java index 19cb3740664..e28d6dbeddb 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttFactoryImpl.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttFactoryImpl.java @@ -19,6 +19,7 @@ import org.eclipse.emf.ecore.plugin.EcorePlugin; import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.DropTaskTool; import org.eclipse.sirius.components.view.gantt.EditTaskTool; @@ -81,6 +82,8 @@ public EObject create(EClass eClass) { return this.createDropTaskTool(); case GanttPackage.CREATE_TASK_DEPENDENCY_TOOL: return this.createCreateTaskDependencyTool(); + case GanttPackage.DELETE_TASK_DEPENDENCY_TOOL: + return this.createDeleteTaskDependencyTool(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } @@ -163,6 +166,17 @@ public CreateTaskDependencyTool createCreateTaskDependencyTool() { return createTaskDependencyTool; } + /** + * + * + * @generated + */ + @Override + public DeleteTaskDependencyTool createDeleteTaskDependencyTool() { + DeleteTaskDependencyToolImpl deleteTaskDependencyTool = new DeleteTaskDependencyToolImpl(); + return deleteTaskDependencyTool; + } + /** * * diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttPackageImpl.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttPackageImpl.java index 41fe0d3fba7..6b476712809 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttPackageImpl.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/impl/GanttPackageImpl.java @@ -20,6 +20,7 @@ import org.eclipse.sirius.components.view.ViewPackage; import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.DropTaskTool; import org.eclipse.sirius.components.view.gantt.EditTaskTool; @@ -91,6 +92,13 @@ public class GanttPackageImpl extends EPackageImpl implements GanttPackage { */ private EClass createTaskDependencyToolEClass = null; + /** + * + * + * @generated + */ + private EClass deleteTaskDependencyToolEClass = null; + /** * Creates an instance of the model Package, registered with {@link org.eclipse.emf.ecore.EPackage.Registry * EPackage.Registry} by the package package URI value. @@ -225,6 +233,16 @@ public EReference getGanttDescription_CreateTaskDependencyTool() { return (EReference) this.ganttDescriptionEClass.getEStructuralFeatures().get(5); } + /** + * + * + * @generated + */ + @Override + public EReference getGanttDescription_DeleteTaskDependencyTool() { + return (EReference) this.ganttDescriptionEClass.getEStructuralFeatures().get(6); + } + /** * * @@ -232,7 +250,7 @@ public EReference getGanttDescription_CreateTaskDependencyTool() { */ @Override public EAttribute getGanttDescription_DateRoundingExpression() { - return (EAttribute) this.ganttDescriptionEClass.getEStructuralFeatures().get(6); + return (EAttribute) this.ganttDescriptionEClass.getEStructuralFeatures().get(7); } /** @@ -445,6 +463,16 @@ public EClass getCreateTaskDependencyTool() { return this.createTaskDependencyToolEClass; } + /** + * + * + * @generated + */ + @Override + public EClass getDeleteTaskDependencyTool() { + return this.deleteTaskDependencyToolEClass; + } + /** * * @@ -481,6 +509,7 @@ public void createPackageContents() { this.createEReference(this.ganttDescriptionEClass, GANTT_DESCRIPTION__DELETE_TOOL); this.createEReference(this.ganttDescriptionEClass, GANTT_DESCRIPTION__DROP_TOOL); this.createEReference(this.ganttDescriptionEClass, GANTT_DESCRIPTION__CREATE_TASK_DEPENDENCY_TOOL); + this.createEReference(this.ganttDescriptionEClass, GANTT_DESCRIPTION__DELETE_TASK_DEPENDENCY_TOOL); this.createEAttribute(this.ganttDescriptionEClass, GANTT_DESCRIPTION__DATE_ROUNDING_EXPRESSION); this.taskDescriptionEClass = this.createEClass(TASK_DESCRIPTION); @@ -510,6 +539,8 @@ public void createPackageContents() { this.dropTaskToolEClass = this.createEClass(DROP_TASK_TOOL); this.createTaskDependencyToolEClass = this.createEClass(CREATE_TASK_DEPENDENCY_TOOL); + + this.deleteTaskDependencyToolEClass = this.createEClass(DELETE_TASK_DEPENDENCY_TOOL); } /** @@ -549,6 +580,7 @@ public void initializePackageContents() { this.deleteTaskToolEClass.getESuperTypes().add(this.getTaskTool()); this.dropTaskToolEClass.getESuperTypes().add(this.getTaskTool()); this.createTaskDependencyToolEClass.getESuperTypes().add(this.getTaskTool()); + this.deleteTaskDependencyToolEClass.getESuperTypes().add(this.getTaskTool()); // Initialize classes, features, and operations; add parameters this.initEClass(this.ganttDescriptionEClass, GanttDescription.class, "GanttDescription", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); @@ -564,6 +596,8 @@ public void initializePackageContents() { !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEReference(this.getGanttDescription_CreateTaskDependencyTool(), this.getCreateTaskDependencyTool(), null, "createTaskDependencyTool", null, 0, 1, GanttDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + this.initEReference(this.getGanttDescription_DeleteTaskDependencyTool(), this.getDeleteTaskDependencyTool(), null, "deleteTaskDependencyTool", null, 0, 1, GanttDescription.class, + !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); this.initEAttribute(this.getGanttDescription_DateRoundingExpression(), theViewPackage.getInterpretedExpression(), "dateRoundingExpression", "12H", 0, 1, GanttDescription.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); @@ -609,6 +643,8 @@ public void initializePackageContents() { this.initEClass(this.createTaskDependencyToolEClass, CreateTaskDependencyTool.class, "CreateTaskDependencyTool", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + this.initEClass(this.deleteTaskDependencyToolEClass, DeleteTaskDependencyTool.class, "DeleteTaskDependencyTool", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + // Create resource this.createResource(eNS_URI); } diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttAdapterFactory.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttAdapterFactory.java index 1687bddfea5..b194ec5cd88 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttAdapterFactory.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttAdapterFactory.java @@ -19,6 +19,7 @@ import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.DropTaskTool; import org.eclipse.sirius.components.view.gantt.EditTaskTool; @@ -118,6 +119,11 @@ public Adapter caseCreateTaskDependencyTool(CreateTaskDependencyTool object) { return GanttAdapterFactory.this.createCreateTaskDependencyToolAdapter(); } + @Override + public Adapter caseDeleteTaskDependencyTool(DeleteTaskDependencyTool object) { + return GanttAdapterFactory.this.createDeleteTaskDependencyToolAdapter(); + } + @Override public Adapter caseRepresentationDescription(RepresentationDescription object) { return GanttAdapterFactory.this.createRepresentationDescriptionAdapter(); @@ -253,6 +259,20 @@ public Adapter createCreateTaskDependencyToolAdapter() { return null; } + /** + * Creates a new adapter for an object of class + * '{@link org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool Delete Task Dependency Tool}'. + * This default implementation returns null so that we can easily ignore cases; it's useful + * to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool + * @generated + */ + public Adapter createDeleteTaskDependencyToolAdapter() { + return null; + } + /** * Creates a new adapter for an object of class '{@link org.eclipse.sirius.components.view.RepresentationDescription * Representation Description}'. This default implementation returns null so that diff --git a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttSwitch.java b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttSwitch.java index 37ee7a6b2fa..27f8cd86843 100644 --- a/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttSwitch.java +++ b/packages/view/backend/sirius-components-view-gantt/src/main/java/org/eclipse/sirius/components/view/gantt/util/GanttSwitch.java @@ -18,6 +18,7 @@ import org.eclipse.sirius.components.view.RepresentationDescription; import org.eclipse.sirius.components.view.gantt.CreateTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.CreateTaskTool; +import org.eclipse.sirius.components.view.gantt.DeleteTaskDependencyTool; import org.eclipse.sirius.components.view.gantt.DeleteTaskTool; import org.eclipse.sirius.components.view.gantt.DropTaskTool; import org.eclipse.sirius.components.view.gantt.EditTaskTool; @@ -145,6 +146,15 @@ protected T doSwitch(int classifierID, EObject theEObject) { result = this.defaultCase(theEObject); return result; } + case GanttPackage.DELETE_TASK_DEPENDENCY_TOOL: { + DeleteTaskDependencyTool deleteTaskDependencyTool = (DeleteTaskDependencyTool) theEObject; + T result = this.caseDeleteTaskDependencyTool(deleteTaskDependencyTool); + if (result == null) + result = this.caseTaskTool(deleteTaskDependencyTool); + if (result == null) + result = this.defaultCase(theEObject); + return result; + } default: return this.defaultCase(theEObject); } @@ -268,6 +278,21 @@ public T caseCreateTaskDependencyTool(CreateTaskDependencyTool object) { return null; } + /** + * Returns the result of interpreting the object as an instance of 'Delete Task Dependency Tool'. This implementation returns null; returning a non-null result will terminate the switch. + * + * @param object + * the target of the switch. + * @return the result of interpreting the object as an instance of 'Delete Task Dependency Tool'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDeleteTaskDependencyTool(DeleteTaskDependencyTool object) { + return null; + } + /** * Returns the result of interpreting the object as an instance of 'Representation Description'. This implementation returns null; returning a non-null result will terminate the switch.