Java 类org.eclipse.xtext.util.SimpleAttributeResolver 实例源码

项目:gemoc-studio-modeldebugging    文件:ViewUtils.java   
public static String eventToString(MSE mse) {
    StringBuilder builder = new StringBuilder();
    if (mse.getCaller() != null)
    {
        builder.append(mse.getCaller().eClass().getName());
        builder.append("->");
        builder.append(SimpleAttributeResolver.NAME_RESOLVER.apply(mse.getCaller()));

    }
    if (mse.getAction() != null)
    {
        builder.append(".");
        builder.append(mse.getAction().getName());          
        builder.append("()");
    }
    return builder.toString();
}
项目:xtext-core    文件:SimpleNameLabelProvider.java   
@Override
public String getNameLabel(final Object element) {
  String _switchResult = null;
  boolean _matched = false;
  if (element instanceof EObject) {
    _matched=true;
    _switchResult = SimpleAttributeResolver.NAME_RESOLVER.apply(((EObject)element));
  }
  if (!_matched) {
    if (element instanceof IEObjectDescription) {
      _matched=true;
      _switchResult = ((IEObjectDescription)element).getName().getLastSegment();
    }
  }
  if (!_matched) {
    _switchResult = null;
  }
  return _switchResult;
}
项目:ModelDebugging    文件:ViewUtils.java   
public static String eventToString(MSE mse) {
    StringBuilder builder = new StringBuilder();
    if (mse.getCaller() != null)
    {
        builder.append(mse.getCaller().eClass().getName());
        builder.append("->");
        builder.append(SimpleAttributeResolver.NAME_RESOLVER.apply(mse.getCaller()));

    }
    if (mse.getAction() != null)
    {
        builder.append(".");
        builder.append(mse.getAction().getName());          
        builder.append("()");
    }
    return builder.toString();
}
项目:n4js    文件:TargetURIKey.java   
/**
 * Add information about the given object to this cache.
 *
 * @param object
 *            the object to handle
 */
public void add(EObject object) {
    this.applicableTypes.add(object.eClass());
    this.valueStrings.add(SimpleAttributeResolver.NAME_RESOLVER.apply(object));

    // Handle composed members
    if (object instanceof TMember && ((TMember) object).isComposed()) {
        List<TMember> constituentMembers = ((TMember) object).getConstituentMembers();
        for (TMember constituentMember : constituentMembers) {
            addFQNs(constituentMember);
        }
    } else {
        addFQNs(object);
    }
}
项目:n4js    文件:N4TSQualifiedNameProvider.java   
@Override
public QualifiedName getFullyQualifiedName(EObject obj) {
    String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj);
    if (name == null || name.length() == 0)
        return null;
    return converter.toQualifiedName(name);
}
项目:xtext-core    文件:SimpleNameProvider.java   
@Override
public QualifiedName getFullyQualifiedName(EObject obj) {
    String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj);
    if(name == null || name.length() == 0)
        return null;
    return qualifiedNameConverter.toQualifiedName(name);
}
项目:xtext-core    文件:DefaultResourceDescription2Test.java   
protected IResourceDescription createResourceDescription(Resource testResource) {
    DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
    strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() {
        @Override
        public QualifiedName getFullyQualifiedName(EObject obj) {
            String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj);
            return (name != null) ? QualifiedName.create(name) : null;
        }
    });
    IResourceDescription resourceDescription = new DefaultResourceDescription(testResource, strategy);
    return resourceDescription;
}
项目:xtext-core    文件:DefaultReferenceDescriptionTest.java   
protected IResourceDescription createResourceDescription(Resource testResource) {
    DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
    strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() {
        @Override
        public QualifiedName getFullyQualifiedName(EObject obj) {
            String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj);
            return (name != null) ? QualifiedName.create(name) : null;
        }
    });
    strategy.setLazyURIEncoder(new LazyURIEncoder());
    IResourceDescription resourceDescription = new DefaultResourceDescription(testResource, strategy);
    return resourceDescription;
}
项目:bts    文件:ReferenceQueryExecutor.java   
protected String getElementName(EObject primaryTarget) {
    QualifiedName qualifiedName = qualifiedNameProvider.getFullyQualifiedName(primaryTarget);
    if (qualifiedName != null) {
        return qualifiedNameConverter.toString(qualifiedName);
    }
    String simpleName = SimpleAttributeResolver.NAME_RESOLVER.getValue(primaryTarget);
    return (simpleName != null) ? simpleName : primaryTarget.eResource().getURIFragment(primaryTarget);
}
项目:statecharts    文件:SGraphNameProvider.java   
public QualifiedName qualifiedName(Scope ele) {
    QualifiedName name = null;
    String nameString = SimpleAttributeResolver.NAME_RESOLVER.apply(ele);
    if (!Strings.isEmpty(nameString)) {
        name = nameConverter.toQualifiedName(nameString);
    }

    QualifiedName namespace = getNamespace(ele);
    if (namespace != null && name != null) {
        name = namespace.append(name);
    }
    return name;
}
项目:xtext-core    文件:NamesAreUniqueValidationHelper.java   
protected EStructuralFeature getNameFeature(EObject object) {
    return SimpleAttributeResolver.NAME_RESOLVER.getAttribute(object);
}
项目:xtext-core    文件:Scopes.java   
/**
 * creates a scope using {@link SimpleAttributeResolver#NAME_RESOLVER} to compute the names
 */
public static IScope scopeFor(Iterable<? extends EObject> elements, IScope outer) {
    return scopeFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER), outer);
}
项目:xtext-core    文件:ImportUriResolver.java   
public SimpleAttributeResolver<EObject, String> getResolver() {
    if (resolver == null) {
        resolver = SimpleAttributeResolver.newResolver(String.class, attributeName);
    }
    return resolver;
}
项目:xtext-core    文件:SimpleAttributeResolverTest.java   
@Before
public void setUp() throws Exception {
    factory = EcoreFactory.eINSTANCE;
    nameResolver = SimpleAttributeResolver.newResolver(String.class, "name");
    superClassResolver = SimpleAttributeResolver.newResolver(EList.class, "eSuperTypes");
}
项目:bts    文件:AbstractRenameStrategy.java   
protected EAttribute getNameAttribute(EObject targetElement) {
    return SimpleAttributeResolver.NAME_RESOLVER.getAttribute(targetElement);
}
项目:bts    文件:StatusWrapper.java   
protected String _toString(EObject element) {
    return element.eClass().getName() + " '" + notNull(SimpleAttributeResolver.NAME_RESOLVER.apply(element)) + "' in " + _toString(element.eResource().getURI());
}
项目:statecharts    文件:SGraphNameProvider.java   
@Override
protected Function<EObject, String> getResolver() {
    return SimpleAttributeResolver.NAME_RESOLVER;
}
项目:xtext-core    文件:Scopes.java   
/**
 * transforms an {@link Iterable} of {@link EObject}s into an {@link Iterable} of {@link IEObjectDescription}s computing
 * the {@link EAttribute} 'name' to compute the {@link IEObjectDescription}'s name. If not existent the object is
 * filtered out.
 */
public static Iterable<IEObjectDescription> scopedElementsFor(Iterable<? extends EObject> elements) {
    return scopedElementsFor(elements, QualifiedName.wrapper(SimpleAttributeResolver.NAME_RESOLVER));
}