本文整理汇总了Java中org.eclipse.xtext.resource.IEObjectDescription类的典型用法代码示例。如果您正苦于以下问题:Java IEObjectDescription类的具体用法?Java IEObjectDescription怎么用?Java IEObjectDescription使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEObjectDescription类属于org.eclipse.xtext.resource包,在下文中一共展示了IEObjectDescription类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAccepted
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
protected boolean isAccepted(IEObjectDescription description) {
EObject proxyOrInstance = description.getEObjectOrProxy();
if (proxyOrInstance instanceof TVariable && !proxyOrInstance.eIsProxy()) {
TVariable type = (TVariable) proxyOrInstance;
TypeVisibility visibility = checker.isVisible(this.contextResource, type);
if (!visibility.visibility) {
this.accessModifierSuggestionStore.put(description.getEObjectURI().toString(),
visibility.accessModifierSuggestion);
}
return visibility.visibility;
}
return super.isAccepted(description);
}
示例2: getSingleLocalElementByName
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
* Returns description for given element, name is assumed to consist of a single segment containing the simple name
* of the member. If no subScope contains a member with given name, null is returned. In other error cases (no or
* wrong access, mixed types etc.), {@link IEObjectDescriptionWithError}, and in particular
* {@link UnionMemberDescriptionWithError}, will be returned.
*/
@Override
protected IEObjectDescription getSingleLocalElementByName(QualifiedName qualifiedName) {
String name = qualifiedName.getLastSegment();
TMember member = getOrCreateComposedMember(name);
if (member == null) { // no such member, no need for "merging" descriptions, there won't be any
return null;
}
if (isErrorPlaceholder(member)) {
return createComposedMemberDescriptionWithErrors(EObjectDescription.create(member.getName(), member));
}
IEObjectDescription description = getCheckedDescription(name, member);
return description;
}
示例3: getItemsComparator
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked", "static-access" })
protected Comparator getItemsComparator() {
return Ordering.natural().nullsLast().from(new Comparator() {
@Override
public int compare(final Object o1, final Object o2) {
if (o1 instanceof IEObjectDescription && o2 instanceof IEObjectDescription) {
final IEObjectDescription d1 = (IEObjectDescription) o1;
final IEObjectDescription d2 = (IEObjectDescription) o2;
final QualifiedName fqn1 = d1.getQualifiedName();
final QualifiedName fqn2 = d2.getQualifiedName();
if (null != fqn1 && null != fqn2) {
return nullToEmpty(fqn1.getLastSegment()).compareToIgnoreCase(
nullToEmpty(fqn2.getLastSegment()));
}
}
return Objects.hashCode(o1) - Objects.hashCode(o2);
}
});
}
示例4: createScope
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
* Factory method to produce a scope. The factory pattern allows to bypass the explicit object creation if the
* produced scope would be empty.
*
* @param canLoadFromDescriptionHelper
* utility to decide if a resource must be loaded from source or may be loaded from the index.
*/
public static IScope createScope(
IScope outer,
ISelectable selectable,
Predicate<IEObjectDescription> filter,
EClass type, boolean ignoreCase,
ResourceSet resourceSet,
CanLoadFromDescriptionHelper canLoadFromDescriptionHelper,
IContainer container) {
if (selectable == null || selectable.isEmpty())
return outer;
IScope scope = new UserDataAwareScope(outer, selectable, filter, type, ignoreCase, resourceSet,
canLoadFromDescriptionHelper,
container);
return scope;
}
示例5: setupDialog
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
private void setupDialog() {
browseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
SingleClassSelectionDialog dialog = singleClassSelectionDialogProvider.get();
dialog.setInitialPattern(model.getSuperClass().getFullSpecifier());
dialog.open();
if (dialog.getReturnCode() == Window.CANCEL) {
return;
}
Object result = dialog.getFirstResult();
if (result instanceof IEObjectDescription) {
IEObjectDescription objectDescription = (IEObjectDescription) result;
URI objectUri = ((IEObjectDescription) result).getEObjectURI();
model.setSuperClass(
new ClassifierReference(objectDescription.getQualifiedName(), objectUri));
}
}
});
}
示例6: isSignificantChange
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
private boolean isSignificantChange(IResourceDescription.Delta delta) {
if (delta.haveEObjectDescriptionsChanged()) {
IResourceDescription newDescription = delta.getNew();
IResourceDescription oldDescription = delta.getOld();
if ((newDescription != null) != (oldDescription != null)) {
return true;
}
if (newDescription == null || oldDescription == null) {
throw new IllegalStateException();
}
List<IEObjectDescription> newDescriptions = Lists.newArrayList(newDescription.getExportedObjects());
List<IEObjectDescription> oldDescriptions = Lists.newArrayList(oldDescription.getExportedObjects());
if (newDescriptions.size() != oldDescriptions.size()) {
return true;
}
URI resourceURI = delta.getUri();
for (int i = 0; i < newDescriptions.size(); i++) {
if (!equalDescriptions(newDescriptions.get(i), oldDescriptions.get(i), resourceURI)) {
return true;
}
}
}
return false;
}
示例7: getTypes
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
public ArrayList<IEObjectDescription> getTypes(final Extension ext) {
ArrayList<IEObjectDescription> _xblockexpression = null;
{
ArrayList<IEObjectDescription> res = new ArrayList<IEObjectDescription>();
EList<DataType> _types = ext.getTypes();
for (final DataType k : _types) {
res.add(EObjectDescription.create(QualifiedName.create(k.getName()), k));
}
EList<Extension> _import = ext.getImport();
for (final Extension importExtension : _import) {
EList<DataType> _types_1 = importExtension.getTypes();
for (final DataType k_1 : _types_1) {
res.add(EObjectDescription.create(QualifiedName.create(importExtension.getName(), k_1.getName()), k_1));
}
}
_xblockexpression = res;
}
return _xblockexpression;
}
示例8: registerDescription
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void registerDescription(final IResourceDescription description,
final Map<QualifiedName, Object> target) {
for (final IEObjectDescription object : description.getExportedObjects()) {
final QualifiedName lowerCase = object.getName().toLowerCase();
final Object existing = target.put(lowerCase, description);
if (existing != null && existing != description) {
Set<IResourceDescription> set = null;
if (existing instanceof IResourceDescription) {
// The linked hash set is the difference comparing to the super class.
set = Sets.newLinkedHashSetWithExpectedSize(2);
set.add((IResourceDescription) existing);
} else {
set = (Set<IResourceDescription>) existing;
}
set.add(description);
target.put(lowerCase, set);
}
}
}
示例9: createEObjectDescriptions
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
public boolean createEObjectDescriptions(final EObject eObject, IAcceptor<IEObjectDescription> acceptor) {
if (getQualifiedNameProvider() == null)
return false;
if (eObject instanceof TModule) {
TModule module = (TModule) eObject;
internalCreateEObjectDescriptionForRoot(module, acceptor);
for (Type type : module.getTopLevelTypes()) {
internalCreateEObjectDescription(type, acceptor);
}
for (TVariable variable : module.getVariables()) {
internalCreateEObjectDescription(variable, acceptor);
}
}
// export is only possible for top-level elements
return false;
}
示例10: testResolveSuperTypeOfBuiltInType
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testResolveSuperTypeOfBuiltInType() {
BuiltInTypeScope scope = BuiltInTypeScope.get(resourceSet);
IEObjectDescription intDescription = scope.getSingleElement(QualifiedName.create("i18nKey")); // trigger loading
PrimitiveType intType = (PrimitiveType) intDescription.getEObjectOrProxy();
PrimitiveType assCompatType = intType.getAssignmentCompatible();
Assert.assertFalse(assCompatType.eIsProxy());
Assert.assertEquals("string", assCompatType.getName());
}
示例11: findLaunchConfig
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
* Finds a launch configuration with the given name from the current EMF index. The index contains all
* launch configurations from projects that have the Xtext nature. Launch configurations from projects
* without the Xtext nature are not found. Use {@link #findLaunchConfig(String, IFile)} in this case.
*
* @param name the name of the configuration to find
* @return the configuration or <code>null</code>
*/
public LaunchConfig findLaunchConfig(String name) {
Iterable<IEObjectDescription> indexed = index.getExportedObjectsByType(LcDslPackage.eINSTANCE.getLaunchConfig());
for (IEObjectDescription o : indexed) {
if (o.getName().getLastSegment().equals(name)) {
EObject obj = EcoreUtil.resolve(o.getEObjectOrProxy(), rsProvider.get());
EcoreUtil.resolveAll(obj);
return (LaunchConfig) obj;
}
}
return null;
}
示例12: getElements
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(final QualifiedName name) {
return new Iterable<IEObjectDescription>() {
@Override
public Iterator<IEObjectDescription> iterator() {
getImportedNames().add(name);
final Iterable<IEObjectDescription> elements = delegate.getElements(name);
return elements.iterator();
}
};
}
示例13: getElements
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
public Iterable<IEObjectDescription> getElements(QualifiedName name) {
Iterable<IEObjectDescription> parent = super.getElements(name);
return Iterables.transform(parent, new Function<IEObjectDescription, IEObjectDescription>() {
@Override
public IEObjectDescription apply(IEObjectDescription input) {
return resolve(input);
}
});
}
示例14: getAllLocalElements
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
if (elements == null) {
elements = createElements();
}
return elements.values();
}
示例15: getEObjectOrProxy
import org.eclipse.xtext.resource.IEObjectDescription; //导入依赖的package包/类
/**
* Returns a reference to the instance with the given qualified name.
*
* @return an optional reference.
*/
protected <T extends EObject> T getEObjectOrProxy(QualifiedName qn) {
IEObjectDescription description = getSingleElement(qn);
if (description == null)
throw new IllegalStateException(qn + " is not contained in this scope");
@SuppressWarnings("unchecked")
T result = (T) description.getEObjectOrProxy();
return result;
}