|
@@ -13,15 +13,19 @@ package org.yakindu.base.types.provider;
|
|
|
import java.util.Collection;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.eclipse.emf.common.notify.AdapterFactory;
|
|
|
import org.eclipse.emf.common.notify.Notification;
|
|
|
import org.eclipse.emf.common.util.EList;
|
|
|
+import org.eclipse.emf.common.util.URI;
|
|
|
import org.eclipse.emf.ecore.EStructuralFeature;
|
|
|
+import org.eclipse.emf.ecore.InternalEObject;
|
|
|
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
|
|
|
import org.eclipse.emf.edit.provider.ViewerNotification;
|
|
|
import org.yakindu.base.types.Operation;
|
|
|
import org.yakindu.base.types.Parameter;
|
|
|
import org.yakindu.base.types.Type;
|
|
|
+import org.yakindu.base.types.TypeSpecifier;
|
|
|
import org.yakindu.base.types.TypesFactory;
|
|
|
import org.yakindu.base.types.TypesPackage;
|
|
|
|
|
@@ -100,7 +104,7 @@ public class OperationItemProvider extends DeclarationItemProvider {
|
|
|
*/
|
|
|
@Override
|
|
|
public String getText(Object object) {
|
|
|
- Operation operation = (Operation)object;
|
|
|
+ Operation operation = (Operation) object;
|
|
|
StringBuilder builder = new StringBuilder(operation.getName());
|
|
|
builder.append("(");
|
|
|
EList<Parameter> parameters = operation.getParameters();
|
|
@@ -108,20 +112,34 @@ public class OperationItemProvider extends DeclarationItemProvider {
|
|
|
for (Parameter parameter : parameters) {
|
|
|
builder.append(sep);
|
|
|
builder.append(parameter.getName());
|
|
|
- builder.append(" : " );
|
|
|
- Type type = parameter.getType();
|
|
|
- builder.append(type != null? type.getName() : "null");
|
|
|
+ builder.append(" : ");
|
|
|
+ String typeName = getTypeName(parameter.getTypeSpecifier());
|
|
|
+ builder.append(typeName);
|
|
|
sep = ", ";
|
|
|
}
|
|
|
builder.append(")");
|
|
|
- if(operation.getType() != null){
|
|
|
+ if (operation.getType() != null) {
|
|
|
builder.append(" : ");
|
|
|
- String name = operation.getType().getName();
|
|
|
+ String name = getTypeName(operation.getTypeSpecifier());
|
|
|
builder.append(name == null ? "void" : name);
|
|
|
}
|
|
|
return builder.toString();
|
|
|
}
|
|
|
|
|
|
+ protected String getTypeName(TypeSpecifier typeSpecifier) {
|
|
|
+ Type type = (Type) typeSpecifier.eGet(TypesPackage.Literals.TYPE_SPECIFIER__TYPE, false);
|
|
|
+ String typeName = "";
|
|
|
+ if (type == null) {
|
|
|
+ typeName = "null";
|
|
|
+ } else if (type.eIsProxy()) {
|
|
|
+ URI eProxyURI = ((InternalEObject) type).eProxyURI();
|
|
|
+ typeName = StringUtils.substringAfterLast(eProxyURI.fragment(), ".");
|
|
|
+ } else {
|
|
|
+ typeName = type.getName();
|
|
|
+ }
|
|
|
+ return typeName;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 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}.
|