-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4474] Add EMF Services for Query View
Bug: #4474 Signed-off-by: Axel RICHARD <[email protected]>
- Loading branch information
1 parent
f39045d
commit 84f22bd
Showing
5 changed files
with
146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...c/main/java/org/eclipse/sirius/web/application/views/query/services/EMFQueryServices.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.web.application.views.query.services; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.emf.ecore.EStructuralFeature; | ||
|
||
/** | ||
* Custom services to manipulate EMF objects. | ||
* | ||
* @author arichard | ||
*/ | ||
public class EMFQueryServices { | ||
|
||
public void eSet(EObject object, EStructuralFeature eStructuralFeature, Object newValue) { | ||
object.eSet(eStructuralFeature, newValue); | ||
} | ||
|
||
public void eSet(EObject object, String eStructuralFeatureName, Object newValue) { | ||
var eStructuralFeature = object.eClass().getEStructuralFeature(eStructuralFeatureName); | ||
object.eSet(eStructuralFeature, newValue); | ||
} | ||
|
||
public void eUnset(EObject object, EStructuralFeature eStructuralFeature) { | ||
object.eUnset(eStructuralFeature); | ||
} | ||
|
||
public void eUnset(EObject object, String eStructuralFeatureName) { | ||
var eStructuralFeature = object.eClass().getEStructuralFeature(eStructuralFeatureName); | ||
object.eUnset(eStructuralFeature); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
.../sirius/web/application/views/query/services/SiriusWebInterpreterJavaServiceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.sirius.web.application.views.query.services; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.sirius.components.core.api.IEditingContext; | ||
import org.eclipse.sirius.web.application.views.query.services.api.IInterpreterJavaServiceProvider; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* Used to contribute additional services while executing queries. | ||
* | ||
* @author arichard | ||
*/ | ||
@Service | ||
public class SiriusWebInterpreterJavaServiceProvider implements IInterpreterJavaServiceProvider { | ||
@Override | ||
public List<Class<?>> getServiceClasses(IEditingContext editingContext) { | ||
return List.of(EMFQueryServices.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters