Java 类org.eclipse.xtext.xbase.jvmmodel.IJvmModelAssociations 实例源码

项目:xtext-extras    文件:TreeAppendable.java   
public TreeAppendable(ImportManager importManager, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source,
        String indentation, String lineSeparator) {
    this(
            new SharedAppendableState(indentation, lineSeparator, importManager, source.eResource()),
            converter,
            locationProvider,
            jvmModelAssociations,
            source);
}
项目:xtext-extras    文件:TreeAppendable.java   
protected TreeAppendable(SharedAppendableState state, ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject source) {
    this(
            state,
            converter,
            locationProvider,
            jvmModelAssociations,
            createAllLocationData(
                    converter,
                    locationProvider,
                    jvmModelAssociations,
                    source,
                    ILocationInFileProviderExtension.RegionDescription.INCLUDING_COMMENTS,
                    false), // don't skip empty root regions
            false);
}
项目:xtext-extras    文件:TreeAppendable.java   
protected TreeAppendable(SharedAppendableState state,
        final ITraceURIConverter converter,
        ILocationInFileProvider locationProvider,
        IJvmModelAssociations jvmModelAssociations,
        Set<ILocationData> sourceLocations, 
        boolean useForDebugging) {
    this.state = state;
    this.traceURIConverter = converter;
    this.locationProvider = locationProvider;
    this.jvmModelAssociations = jvmModelAssociations;
    this.children = Lists.newArrayList();
    this.locationData = sourceLocations;
    this.useForDebugging = useForDebugging;
    this.lightweightTypeReferenceSerializer = createLightweightTypeReferenceSerializer();
}
项目:xtext-extras    文件:ErrorTreeAppendable.java   
public ErrorTreeAppendable(SharedAppendableState state, 
        ITraceURIConverter converter,
        ILocationInFileProvider locationProvider,
        IJvmModelAssociations jvmModelAssociations,
        Set<ILocationData> sourceLocations, 
        boolean useForDebugging) {
    super(state, converter, locationProvider, jvmModelAssociations, sourceLocations, useForDebugging);
    encoder = getOrCreateURIEncoder();
}
项目:dsl-devkit    文件:InferredJvmModelUtil.java   
/**
 * Returns an inferred model element of a given type for a given source element.
 * 
 * @param <T>
 *          the type of inferred model element to return
 * @param source
 *          the source of the inferred model element, must not be {@code null}
 * @param clazz
 *          the class of the inferred model element to return, must not be {@code null}
 * @return the inferred model element, or {@code null} if there is none
 */
@SuppressWarnings("unchecked")
public static <T extends EObject> T getInferredElement(final EObject source, final Class<T> clazz) {
  final IJvmModelAssociations modelAssociations = getModelAssociations(source);
  if (modelAssociations != null) {
    for (EObject eObj : modelAssociations.getJvmElements(source)) {
      if (clazz.isInstance(eObj)) {
        return (T) eObj;
      }
    }
  }
  return null;
}
项目:dsl-devkit    文件:InferredJvmModelUtil.java   
/**
 * Returns all inferred model elements of a given type for a given source element.
 * 
 * @param <T>
 *          the type of inferred model elements to return
 * @param source
 *          the source of the inferred model elements, must not be {@code null}
 * @param clazz
 *          the class of the inferred model elements to return, must not be {@code null}
 * @return the set of inferred model elements or an empty set if there are none
 */
@SuppressWarnings("unchecked")
public static <T extends EObject> Set<T> getInferredElements(final EObject source, final Class<T> clazz) {
  final IJvmModelAssociations modelAssociations = getModelAssociations(source);
  if (modelAssociations != null) {
    final Set<EObject> inferredModelElements = modelAssociations.getJvmElements(source);
    return (Set<T>) Sets.filter(inferredModelElements, new Predicate<EObject>() {
      public boolean apply(final EObject input) {
        return clazz.isInstance(input);
      }
    });
  }
  return Collections.emptySet();
}
项目:dsl-devkit    文件:InferredJvmModelUtil.java   
/**
 * Returns all inferred model elements for a given source element.
 * 
 * @param source
 *          the source of the inferred model elements, must not be {@code null}
 * @return the set of inferred model elements or an empty set if there are none
 */
public static Set<EObject> getInferredElements(final EObject source) {
  final IJvmModelAssociations modelAssociations = getModelAssociations(source);
  if (modelAssociations != null) {
    return modelAssociations.getJvmElements(source);
  }
  return Collections.emptySet();
}
项目:dsl-devkit    文件:InferredJvmModelUtil.java   
/**
 * Gets the primary source model element that inferred a given {@link EObject}, if there is one.
 * 
 * @param eObject
 *          the object to get the primary source for, must not be {@code null}
 * @return the primary source model element for the given {link EObject}, or null if there is none
 */
public static EObject getPrimarySource(final EObject eObject) {
  final IJvmModelAssociations modelAssociations = getModelAssociations(eObject);
  if (modelAssociations != null) {
    return modelAssociations.getPrimarySourceElement(eObject);
  } else {
    return null;
  }
}
项目:xtext-extras    文件:XImportSectionNamespaceScopeProvider.java   
protected IJvmModelAssociations getAssociations() {
    return associations;
}
项目:xtext-extras    文件:TreeAppendable.java   
/**
 * @since 2.4
 */
protected TreeAppendable createChild(SharedAppendableState state, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, Set<ILocationData> newData, boolean useForDebugging) {
    return new TreeAppendable(state, traceURIConverter, locationProvider, jvmModelAssociations, newData, useForDebugging);
}
项目:xtext-extras    文件:TreeAppendable.java   
private static Set<ILocationData> createAllLocationData(ITraceURIConverter converter, ILocationInFileProvider locationProvider, IJvmModelAssociations jvmModelAssociations, EObject object, ILocationInFileProviderExtension.RegionDescription query) {
    return createAllLocationData(converter, locationProvider, jvmModelAssociations, object, query, true);
}
项目:xtext-extras    文件:ErrorTreeAppendable.java   
@Override
protected TreeAppendable createChild(SharedAppendableState state, ILocationInFileProvider locationProvider, 
        IJvmModelAssociations jvmModelAssociations, Set<ILocationData> newData, boolean useForDebugging) {
    return this;
}
项目:xtext-extras    文件:CommonTypeComputationServices.java   
@Pure
public IJvmModelAssociations getJvmModelAssociations() {
  return this.jvmModelAssociations;
}
项目:xtext-extras    文件:CommonTypeComputationServices.java   
public void setJvmModelAssociations(final IJvmModelAssociations jvmModelAssociations) {
  this.jvmModelAssociations = jvmModelAssociations;
}
项目:dsl-devkit    文件:InferredJvmModelUtil.java   
/**
 * Returns the model associations corresponding to an EObject.
 * <p>
 * Model associations are maintained per resource. This returns the model associations for the EObject's containing resource.
 * </p>
 * 
 * @param eObject
 *          the object to get the model associations from, must not be {@code null}
 * @return the model associations for {@code eObject}, or null if there are none
 */
public static IJvmModelAssociations getModelAssociations(final EObject eObject) {
  if (eObject != null) {
    final Resource resource = eObject.eResource();
    if (resource instanceof XtextResource) {
      return ((XtextResource) resource).getResourceServiceProvider().get(IJvmModelAssociations.class);
    }
  }
  return null;
}