Java Code Examples for org.eclipse.xtext.resource.IReferenceDescription#getSourceEObjectUri()

The following examples show how to use org.eclipse.xtext.resource.IReferenceDescription#getSourceEObjectUri() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferenceSearchResultContentProvider.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private void addReference(IReferenceDescription referenceDescription, boolean isUpdateViewer) {
	URI containerEObjectURI = referenceDescription.getContainerEObjectURI();
	final URI eObjectURI = (containerEObjectURI == null) ? referenceDescription.getSourceEObjectUri()
			: containerEObjectURI;
	IResourceDescription resourceDescription = resourceDescriptions.getResourceDescription(eObjectURI
			.trimFragment());
	if (resourceDescription != null) {
		ReferenceSearchViewTreeNode resourceNode = resourceNode(resourceDescription, isUpdateViewer);
		ReferenceSearchViewTreeNode referenceNode = null;
		for (IEObjectDescription eObjectDescription : resourceDescription.getExportedObjects()) {
			if (eObjectDescription.getEObjectURI().equals(eObjectURI)) {
				referenceNode = new ReferenceSearchViewTreeNode(resourceNode, referenceDescription,
						eObjectDescription);
				break;
			}
		}
		if (referenceNode == null && resourceNode != null)
			new ReferenceSearchViewTreeNode(resourceNode, referenceDescription, referenceDescription);
	}
}
 
Example 2
Source File: FastReferenceSearchResultContentProvider.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Adds the given reference to the contents.
 *
 * @param referenceDescription
 *          reference to add
 */
private void addReference(final IReferenceDescription referenceDescription) {
  URI containerEObjectURI = referenceDescription.getContainerEObjectURI();
  final URI eObjectURI = (containerEObjectURI == null) ? referenceDescription.getSourceEObjectUri() : containerEObjectURI;
  IResourceDescription resourceDescription = resourceDescriptions.getResourceDescription(eObjectURI.trimFragment());
  if (resourceDescription != null) {
    ReferenceSearchViewTreeNode resourceNode = resourceNode(resourceDescription);
    new DynamicReferenceSearchViewTreeNode(resourceNode, referenceDescription, new Supplier<Object>() {
      @Override
      public Object get() {
        InternalEObject dummyProxy = (InternalEObject) EcoreFactory.eINSTANCE.createEObject();
        dummyProxy.eSetProxyURI(eObjectURI);
        Iterator<IEObjectDescription> sourceObjects = resourceDescriptions.getExportedObjectsByObject(dummyProxy).iterator();
        return sourceObjects.hasNext() ? sourceObjects.next() : referenceDescription;
      }
    });
  }
}
 
Example 3
Source File: ReferenceUpdaterDispatcher.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void accept(IReferenceDescription referenceDescription) {
	if (referenceDescription.getSourceEObjectUri() == null
			|| referenceDescription.getTargetEObjectUri() == null
			|| referenceDescription.getEReference() == null) {
		handleCorruptReferenceDescription(referenceDescription, status);
	} else {
		URI sourceResourceURI = referenceDescription.getSourceEObjectUri().trimFragment();
		IReferenceUpdater referenceUpdater = getReferenceUpdater(sourceResourceURI);
		if (referenceUpdater == null)
			handleNoReferenceUpdater(sourceResourceURI, status);
		else
			updater2refs.put(referenceUpdater, referenceDescription);
	}
}
 
Example 4
Source File: FindReferencesTestUtil.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private String toString(IReferenceDescription rd) {
	return rd.getSourceEObjectUri() + " ---" + rd.getEReference().getName() + "---> "
			+ rd.getTargetEObjectUri();
}
 
Example 5
Source File: FindReferencesTestUtil.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private String toString(IReferenceDescription rd) {
	return rd.getSourceEObjectUri() + " ---" + rd.getEReference().getName() + "---> "
			+ rd.getTargetEObjectUri();
}
 
Example 6
Source File: DotDescriptionLabelProvider.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
private EObject getEObject(IReferenceDescription referenceDescription) {
	URI sourceUri = referenceDescription.getSourceEObjectUri();
	EObject eObject = new ResourceSetImpl().getEObject(sourceUri, true);
	return eObject;
}
 
Example 7
Source File: FindReferencesTestUtil.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
private String toString(IReferenceDescription rd) {
	return rd.getSourceEObjectUri() + " ---" + rd.getEReference().getName() + "---> "
			+ rd.getTargetEObjectUri();
}
 
Example 8
Source File: DefaultDescriptionLabelProvider.java    From xtext-eclipse with Eclipse Public License 2.0 2 votes vote down vote up
/**
 * This method is only invoked if the containerEObjectURI of the {@link IReferenceDescription} is null, i.e. the
 * reference is owned by an element without any indexed container.
 * 
 * @since 2.1
 */
public Object image(IReferenceDescription referenceDescription) {
	if (referenceDescription.getSourceEObjectUri() != null)
		return getImageForURI(referenceDescription.getSourceEObjectUri());
	return null;
}