blob: 8bd85c53d57e88eded05ced5a402db777abf1d49 [file] [log] [blame]
/**
* generated by Xtext 2.11.0
*/
package org.eclipse.osbp.xtext.menu.scoping;
import com.google.common.base.Objects;
import com.google.common.base.Predicate;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.osbp.xtext.dialogdsl.Dialog;
import org.eclipse.osbp.xtext.menu.MenuDslPackage;
import org.eclipse.osbp.xtext.menu.scoping.AbstractMenuDslScopeProvider;
import org.eclipse.osbp.xtext.table.Table;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.scoping.IScope;
import org.eclipse.xtext.scoping.impl.FilteringScope;
/**
* This class contains custom scoping description.
*
* See https://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#scoping
* on how and when to use it.
*/
@SuppressWarnings("all")
public class MenuDslScopeProvider extends AbstractMenuDslScopeProvider {
@Override
public IScope getScope(final EObject context, final EReference reference) {
boolean _equals = Objects.equal(reference, MenuDslPackage.Literals.MENU_CATEGORY__DIALOG);
if (_equals) {
return this.getEmbeddedDialog(context, reference);
} else {
boolean _equals_1 = Objects.equal(reference, MenuDslPackage.Literals.MENU_CATEGORY__TABLE);
if (_equals_1) {
return this.getEmbeddedTable(context, reference);
} else {
final IScope scope = super.getScope(context, reference);
return scope;
}
}
}
public IScope getEmbeddedDialog(final EObject context, final EReference reference) {
IScope _scope = super.getScope(context, reference);
final Predicate<IEObjectDescription> _function = (IEObjectDescription it) -> {
final EObject entityProxy = it.getEObjectOrProxy();
Dialog dialog = null;
boolean _eIsProxy = entityProxy.eIsProxy();
if (_eIsProxy) {
final URI uri = ((InternalEObject) entityProxy).eProxyURI();
EObject _eObject = context.eResource().getResourceSet().getEObject(uri, true);
dialog = ((Dialog) _eObject);
} else {
dialog = ((Dialog) entityProxy);
}
if ((dialog != null)) {
boolean _isEmbedded = dialog.isEmbedded();
if (_isEmbedded) {
return true;
}
}
return false;
};
return new FilteringScope(_scope, _function);
}
public IScope getEmbeddedTable(final EObject context, final EReference reference) {
IScope _scope = super.getScope(context, reference);
final Predicate<IEObjectDescription> _function = (IEObjectDescription it) -> {
final EObject entityProxy = it.getEObjectOrProxy();
Table table = null;
boolean _eIsProxy = entityProxy.eIsProxy();
if (_eIsProxy) {
final URI uri = ((InternalEObject) entityProxy).eProxyURI();
EObject _eObject = context.eResource().getResourceSet().getEObject(uri, true);
table = ((Table) _eObject);
} else {
table = ((Table) entityProxy);
}
if ((table != null)) {
boolean _isEmbedded = table.getTabletype().isEmbedded();
if (_isEmbedded) {
return true;
}
}
return false;
};
return new FilteringScope(_scope, _function);
}
}