/
ALEServices.java
133 lines (114 loc) · 3.37 KB
/
ALEServices.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*******************************************************************************
* Copyright (c) 2017, 2023 Obeo.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which 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.emf.ecoretools.design.service;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
public class ALEServices {
public static boolean isConfiguredForALE(EPackage pak) {
return false;
}
public static void configureForALE(EPackage pak) {
}
/**
* Should return all the "things" which can be launched from the given
* EClassifier.
*
* @param clazz
* @return
*/
public static List<? extends EObject> getAllExecutables(EClassifier clazz) {
return List.of(clazz);
}
public static EObject addExecutable(EClassifier clazz) {
return null;
}
/**
* return the simple name for something which can be executed, a name which
* would be unambiguous for a user which has to pick among many.
*
* @param anExecutable
* @return the simple name for something which can be executed.
*/
public static String getExecutableName(EObject anExecutable) {
return "ALE body";
}
/**
* Return the executable body as text from the given EObject.
*
* @param anExecutable
* something which can be executed.
* @return Return the executable body as text.
*/
public static String getExecutableBody(EObject anExecutable) {
return "";
}
/**
* Set the executable body for the given EObject.
*
* @param anExecutable
* something which can be executed.
* @param newBody:
* body to set.
*/
public static void setExecutableBody(EObject anExecutable, String newBody) {
}
/**
* return true if the body is syntactically and semantically correct.
*
* @param anExecutable
* something which can be executed.
*/
public static boolean isValidBody(EObject anExecutable) {
return false;
}
/**
* return true if some executables are associated with this element.
*
* @param e
* any thing from Ecore.
* @return true if some executables are associated with this element.
*/
public static boolean hasExecutables(EModelElement e) {
return false;
}
public static List<EObject> getJavaImports(EModelElement e) {
List<EObject> result = new ArrayList<>();
if (e instanceof EPackage) {
result.add(e);
}
return result;
}
public static String getQualifiedName(EObject javaImport) {
return "com.mycompany.dsl.Service";
}
public static EObject setQualifiedName(EObject javaImport, String newVal) {
return javaImport;
}
public static boolean isValidImport(EObject javaImport) {
return true;
}
/**
* Configure a sourceviewer to provide completion & validation, might be
* called each time the selection changes.
*
* @param anExecutable
* something which can be executed.
* @param sourceViewer
* the sourceViewer
*/
public static void configureSourceViewer(EObject anExecutable, Object sourceViewer) {
}
}