本文整理汇总了Java中org.eclipse.xtext.resource.IReferenceDescription类的典型用法代码示例。如果您正苦于以下问题:Java IReferenceDescription类的具体用法?Java IReferenceDescription怎么用?Java IReferenceDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IReferenceDescription类属于org.eclipse.xtext.resource包,在下文中一共展示了IReferenceDescription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getIncomingReferences
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
/***/
public static Set<IReferenceDescription> getIncomingReferences(URI uri) {
Set<IReferenceDescription> desc = Sets.newHashSet();
Iterable<IResourceDescription> descriptions = getAllResourceDescriptions();
for (IResourceDescription res : descriptions) {
Iterable<IReferenceDescription> descriptions2 = res.getReferenceDescriptions();
for (IReferenceDescription ref : descriptions2) {
if (uri.hasFragment()) {
if (ref.getTargetEObjectUri().equals(uri))
desc.add(ref);
} else {
if (ref.getTargetEObjectUri().trimFragment().equals(uri.trimFragment()))
desc.add(ref);
}
}
}
return desc;
}
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:BuilderUtil.java
示例2: getContainedReferences
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
/***/
public static Set<IReferenceDescription> getContainedReferences(URI uri) {
Set<IReferenceDescription> desc = Sets.newHashSet();
Iterable<IResourceDescription> descriptions = getAllResourceDescriptions();
for (IResourceDescription res : descriptions) {
Iterable<IReferenceDescription> descriptions2 = res.getReferenceDescriptions();
for (IReferenceDescription ref : descriptions2) {
if (uri.hasFragment()) {
if (ref.getSourceEObjectUri().equals(uri))
desc.add(ref);
} else {
if (ref.getSourceEObjectUri().trimFragment().equals(uri.trimFragment()))
desc.add(ref);
}
}
}
return desc;
}
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:BuilderUtil.java
示例3: isRelevantToUser
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
/**
* Returns <code>true</code> if the reference should be presented to the user.
*/
@Override
protected boolean isRelevantToUser(IReferenceDescription referenceDescription) {
if (referenceDescription instanceof LabelledReferenceDescription) {
EObject source = ((LabelledReferenceDescription) referenceDescription).getSource();
if (source.eContainer() instanceof JSXElementName && source.eContainer()
.eContainingFeature() == N4JSPackage.eINSTANCE.getJSXElement_JsxClosingName()) {
// Do not show JSX element's closing tag
return false;
} else {
return true;
}
} else {
return super.isRelevantToUser(referenceDescription);
}
}
开发者ID:eclipse,项目名称:n4js,代码行数:19,代码来源:N4JSReferenceQueryExecutor.java
示例4: toAcceptor
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Override
protected Acceptor toAcceptor(IAcceptor<IReferenceDescription> acceptor) {
return new ReferenceAcceptor(acceptor, getResourceServiceProviderRegistry()) {
@Override
public void accept(EObject source, URI sourceURI, EReference eReference, int index, EObject targetOrProxy,
URI targetURI) {
// Check if we should ignore named import specifier
if (N4JSReferenceQueryExecutor.ignoreNamedImportSpecifier && source instanceof NamedImportSpecifier)
return;
EObject displayObject = calculateDisplayEObject(source);
String logicallyQualifiedDisplayName = N4JSHierarchicalNameComputerHelper
.calculateLogicallyQualifiedDisplayName(displayObject, labelProvider, false);
ICompositeNode srcNode = NodeModelUtils.getNode(source);
int line = srcNode.getStartLine();
LabelledReferenceDescription description = new LabelledReferenceDescription(source, displayObject,
sourceURI,
targetOrProxy,
targetURI,
eReference, index, logicallyQualifiedDisplayName, line);
accept(description);
}
};
}
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:LabellingReferenceFinder.java
示例5: findReferencesTo
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
/**
* Find all references to the given target with its resource set as working environment.
*
* @param target
* the object to look for.
* @param monitor
* the progress monitor.
* @return the list of reference descriptions.
*/
public List<IReferenceDescription> findReferencesTo(EObject target, IProgressMonitor monitor) {
final TargetURIs targetURIs = getTargetURIs(target);
final ResourceSet resourceSet = target.eResource().getResourceSet();
final List<IReferenceDescription> result = Lists.newArrayList();
IReferenceFinder.IResourceAccess resourceAccess = new SimpleResourceAccess(resourceSet);
IReferenceFinder.Acceptor acceptor = new IReferenceFinder.Acceptor() {
@Override
public void accept(IReferenceDescription description) {
result.add(description);
}
@Override
public void accept(EObject source, URI sourceURI, EReference eReference, int index, EObject targetOrProxy,
URI targetURI) {
accept(new DefaultReferenceDescription(sourceURI, targetURI, eReference, index, null));
}
};
referenceFinder.findAllReferences(targetURIs, resourceAccess,
resourceDescriptionsProvider.getResourceDescriptions(resourceSet),
acceptor, monitor);
return result;
}
开发者ID:eclipse,项目名称:n4js,代码行数:33,代码来源:HeadlessReferenceFinder.java
示例6: testNoReferenceDescriptionsForPackageFragments
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Test
public void testNoReferenceDescriptionsForPackageFragments() {
try {
final XExpression expression = this.expression("java::lang::String::valueOf(\"\")");
final Resource resource = expression.eResource();
final IResourceDescription description = this.resourceDescriptionManager.getResourceDescription(resource);
final Function1<IReferenceDescription, String> _function = (IReferenceDescription it) -> {
return it.getTargetEObjectUri().toString();
};
final Set<String> referenceDescriptions = IterableExtensions.<String>toSet(IterableExtensions.<IReferenceDescription, String>map(description.getReferenceDescriptions(), _function));
Assert.assertEquals(2, referenceDescriptions.size());
final Set<String> expectation = Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet("java:/Objects/java.lang.String#java.lang.String", "java:/Objects/java.lang.String#java.lang.String.valueOf(java.lang.Object)"));
Assert.assertEquals(expectation, referenceDescriptions);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:XbaseResourceDescriptionStrategyTest.java
示例7: computeReferenceDescriptions
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
protected List<IReferenceDescription> computeReferenceDescriptions() {
final List<IReferenceDescription> referenceDescriptions = Lists.newArrayList();
IAcceptor<IReferenceDescription> acceptor = new IAcceptor<IReferenceDescription>() {
@Override
public void accept(IReferenceDescription referenceDescription) {
referenceDescriptions.add(referenceDescription);
}
};
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
Map<EObject, IEObjectDescription> eObject2exportedEObjects = createEObject2ExportedEObjectsMap(getExportedObjects());
TreeIterator<EObject> contents = EcoreUtil.getAllProperContents(this.resource, true);
while (contents.hasNext()) {
EObject eObject = contents.next();
URI exportedContainerURI = findExportedContainerURI(eObject, eObject2exportedEObjects);
if (!strategy.createReferenceDescriptions(eObject, exportedContainerURI, acceptor))
contents.prune();
}
return referenceDescriptions;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:DefaultResourceDescription.java
示例8: convertExternalURIsToPortableURIs
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
protected void convertExternalURIsToPortableURIs(final SerializableResourceDescription description, final StorageAwareResource resource) {
Iterable<IReferenceDescription> _referenceDescriptions = description.getReferenceDescriptions();
for (final IReferenceDescription ref : _referenceDescriptions) {
URI _trimFragment = ref.getTargetEObjectUri().trimFragment();
URI _uRI = resource.getURI();
boolean _notEquals = (!Objects.equal(_trimFragment, _uRI));
if (_notEquals) {
URI _elvis = null;
URI _portableURI = resource.getPortableURIs().toPortableURI(resource, ref.getTargetEObjectUri());
if (_portableURI != null) {
_elvis = _portableURI;
} else {
URI _targetEObjectUri = ref.getTargetEObjectUri();
_elvis = _targetEObjectUri;
}
((SerializableReferenceDescription) ref).setTargetEObjectUri(_elvis);
}
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:ResourceStorageWritable.java
示例9: testgetReferenceDescriptions
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Test public void testgetReferenceDescriptions() throws Exception {
with(new LangATestLanguageStandaloneSetup());
XtextResource targetResource = getResource("type C", "bar.langatestlanguage");
EObject typeC = targetResource.getContents().get(0).eContents().get(0);
XtextResource resource = (XtextResource) targetResource.getResourceSet().createResource(URI.createURI("foo.langatestlanguage"));
resource.load(new StringInputStream("type A extends C type B extends A"), null);
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
IResourceDescription resDesc = resource.getResourceServiceProvider().getResourceDescriptionManager().getResourceDescription(resource);
Iterable<IReferenceDescription> descriptions = resDesc.getReferenceDescriptions();
Collection<IReferenceDescription> collection = Lists.newArrayList(descriptions);
assertEquals(1,collection.size());
IReferenceDescription refDesc = descriptions.iterator().next();
Main m = (Main) resource.getParseResult().getRootASTElement();
assertEquals(m.getTypes().get(0),resource.getResourceSet().getEObject(refDesc.getSourceEObjectUri(),false));
assertEquals(typeC, resource.getResourceSet().getEObject(refDesc.getTargetEObjectUri(),false));
assertEquals(-1,refDesc.getIndexInList());
assertEquals(LangATestLanguagePackage.Literals.TYPE__EXTENDS,refDesc.getEReference());
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:DefaultReferenceDescriptionTest.java
示例10: testgetReferenceDescriptionForMultiValue
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Test public void testgetReferenceDescriptionForMultiValue() throws Exception {
with(new LangATestLanguageStandaloneSetup());
XtextResource targetResource = getResource("type C type D", "bar.langatestlanguage");
EObject typeC = targetResource.getContents().get(0).eContents().get(0);
EObject typeD = targetResource.getContents().get(0).eContents().get(1);
XtextResource resource = (XtextResource) targetResource.getResourceSet().createResource(URI.createURI("foo.langatestlanguage"));
resource.load(new StringInputStream("type A implements B,C,D type B"), null);
EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
IResourceDescription resDesc = resource.getResourceServiceProvider().getResourceDescriptionManager().getResourceDescription(resource);
Iterable<IReferenceDescription> descriptions = resDesc.getReferenceDescriptions();
Collection<IReferenceDescription> collection = Lists.newArrayList(descriptions);
assertEquals(2,collection.size());
Iterator<IReferenceDescription> iterator = descriptions.iterator();
IReferenceDescription refDesc1 = iterator.next();
IReferenceDescription refDesc2 = iterator.next();
Main m = (Main) resource.getParseResult().getRootASTElement();
assertEquals(m.getTypes().get(0),resource.getResourceSet().getEObject(refDesc1.getSourceEObjectUri(),false));
assertEquals(typeC,resource.getResourceSet().getEObject(refDesc1.getTargetEObjectUri(),false));
assertEquals(1,refDesc1.getIndexInList());
assertEquals(LangATestLanguagePackage.Literals.TYPE__IMPLEMENTS,refDesc1.getEReference());
assertEquals(m.getTypes().get(0),resource.getResourceSet().getEObject(refDesc2.getSourceEObjectUri(),false));
assertEquals(typeD,resource.getResourceSet().getEObject(refDesc2.getTargetEObjectUri(),false));
assertEquals(2,refDesc2.getIndexInList());
assertEquals(LangATestLanguagePackage.Literals.TYPE__IMPLEMENTS,refDesc2.getEReference());
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:DefaultReferenceDescriptionTest.java
示例11: getReferences
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
public List<? extends Location> getReferences(final XtextResource resource, final int offset, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) {
final EObject element = this._eObjectAtOffsetHelper.resolveElementAt(resource, offset);
if ((element == null)) {
return CollectionLiterals.<Location>emptyList();
}
final ArrayList<Location> locations = CollectionLiterals.<Location>newArrayList();
final TargetURIs targetURIs = this.collectTargetURIs(element);
final IAcceptor<IReferenceDescription> _function = (IReferenceDescription reference) -> {
final Procedure1<EObject> _function_1 = (EObject obj) -> {
final Location location = this._documentExtensions.newLocation(obj, reference.getEReference(), reference.getIndexInList());
if ((location != null)) {
locations.add(location);
}
};
this.doRead(resourceAccess, reference.getSourceEObjectUri(), _function_1);
};
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(this.resourceServiceProviderRegistry, _function);
CancelIndicatorProgressMonitor _cancelIndicatorProgressMonitor = new CancelIndicatorProgressMonitor(cancelIndicator);
this.referenceFinder.findAllReferences(targetURIs, resourceAccess, indexData, _referenceAcceptor, _cancelIndicatorProgressMonitor);
return locations;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:DocumentSymbolService.java
示例12: buildChildren
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Override
public Collection<IHierarchyNode> buildChildren(final IHierarchyNode parent, final IProgressMonitor monitor) {
boolean _mayHaveChildren = parent.mayHaveChildren();
boolean _not = (!_mayHaveChildren);
if (_not) {
return CollectionLiterals.<IHierarchyNode>emptyList();
}
final LinkedHashMap<URI, IHierarchyNode> children = CollectionLiterals.<URI, IHierarchyNode>newLinkedHashMap();
final Procedure2<IEObjectDescription, IReferenceDescription> _function = (IEObjectDescription declaration, IReferenceDescription reference) -> {
final IHierarchyNode childNode = this.createChild(children, declaration, parent);
if ((childNode != null)) {
final IHierarchyNodeReference nodeReference = this.createNodeReference(reference);
if ((nodeReference != null)) {
Collection<IHierarchyNodeReference> _references = childNode.getReferences();
_references.add(nodeReference);
}
}
};
this.findDeclarations(parent, monitor, _function);
return children.values();
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:DefaultCallHierarchyBuilder.java
示例13: findTargetDeclarations
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
protected void findTargetDeclarations(final URI sourceDeclarationURI, final IProgressMonitor monitor, final Procedure2<? super IEObjectDescription, ? super IReferenceDescription> acceptor) {
final IUnitOfWork<Object, EObject> _function = (EObject sourceDeclaration) -> {
Object _xblockexpression = null;
{
IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry();
final IAcceptor<IReferenceDescription> _function_1 = (IReferenceDescription reference) -> {
boolean _filterReference = this.filterReference(reference);
if (_filterReference) {
IEObjectDescription _findTargetDeclaration = null;
if (reference!=null) {
_findTargetDeclaration=this.findTargetDeclaration(reference);
}
final IEObjectDescription targetDeclaration = _findTargetDeclaration;
acceptor.apply(targetDeclaration, reference);
}
};
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function_1);
this.getReferenceFinder().findAllReferences(sourceDeclaration, _referenceAcceptor, monitor);
_xblockexpression = null;
}
return _xblockexpression;
};
this.<Object>readOnly(sourceDeclarationURI, _function);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:DefaultCallHierarchyBuilder.java
示例14: findSourceDeclarations
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
protected void findSourceDeclarations(final URI targetDeclarationURI, final IProgressMonitor monitor, final Procedure2<? super IEObjectDescription, ? super IReferenceDescription> acceptor) {
final TargetURIs targetURIs = this.collectTargetURIs(targetDeclarationURI);
IResourceServiceProvider.Registry _resourceServiceProviderRegistry = this.getResourceServiceProviderRegistry();
final IAcceptor<IReferenceDescription> _function = (IReferenceDescription reference) -> {
boolean _filterReference = this.filterReference(reference);
if (_filterReference) {
IEObjectDescription _findSourceDeclaration = null;
if (reference!=null) {
_findSourceDeclaration=this.findSourceDeclaration(reference);
}
final IEObjectDescription sourceDeclaration = _findSourceDeclaration;
acceptor.apply(sourceDeclaration, reference);
}
};
ReferenceAcceptor _referenceAcceptor = new ReferenceAcceptor(_resourceServiceProviderRegistry, _function);
this.getReferenceFinder().findAllReferences(targetURIs,
this.getResourceAccess(),
this.getIndexData(), _referenceAcceptor, monitor);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:DefaultCallHierarchyBuilder.java
示例15: computeReferenceDescriptions
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Override
protected List<IReferenceDescription> computeReferenceDescriptions() {
final ImmutableList.Builder<IReferenceDescription> referenceDescriptions = ImmutableList.builder();
EcoreUtil2.resolveLazyCrossReferences(getResource(), CancelIndicator.NullImpl);
Map<EObject, IEObjectDescription> eObject2exportedEObjects = createEObject2ExportedEObjectsMap(getExportedObjects());
TreeIterator<EObject> contents = EcoreUtil.getAllProperContents(getResource(), true);
while (contents.hasNext()) {
EObject eObject = contents.next();
URI exportedContainerURI = findExportedContainerURI(eObject, eObject2exportedEObjects);
if (!strategy.createReferenceDescriptions(eObject, exportedContainerURI, referenceDescriptions::add)) {
contents.prune();
}
}
if (strategy instanceof AbstractResourceDescriptionStrategy) {
((AbstractResourceDescriptionStrategy) strategy).createImplicitReferenceDescriptions(getResource(), referenceDescriptions::add);
}
return referenceDescriptions.build();
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:19,代码来源:ResourceDescription2.java
示例16: inputChanged
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
@Override
public void inputChanged(final Viewer v, final Object oldInput, final Object newInput) {
synchronized (v) {
rootNodes.clear();
if (oldInput instanceof ReferenceSearchResult) {
((ReferenceSearchResult) oldInput).removeListener(this);
}
if (newInput instanceof ReferenceSearchResult && v instanceof TreeViewer) {
((ReferenceSearchResult) newInput).addListener(this);
this.viewer = (TreeViewer) v;
for (IReferenceDescription referenceDescription : ((ReferenceSearchResult) newInput).getMatchingReferences()) {
addReference(referenceDescription);
}
}
}
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:17,代码来源:FastReferenceSearchResultContentProvider.java
示例17: addReference
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
/**
* 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;
}
});
}
}
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:24,代码来源:FastReferenceSearchResultContentProvider.java
示例18: inputChanged
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
synchronized (viewer) {
if (rootNodes != null) {
rootNodes.clear();
}
if (oldInput instanceof ReferenceSearchResult) {
((ReferenceSearchResult) oldInput).removeListener(this);
}
if (newInput instanceof ReferenceSearchResult && viewer instanceof TreeViewer) {
((ReferenceSearchResult) newInput).addListener(this);
this.viewer = (TreeViewer) viewer;
for (IReferenceDescription referenceDescription : ((ReferenceSearchResult) newInput)
.getMatchingReferences()) {
addReference(referenceDescription, false);
}
}
}
}
开发者ID:cplutte,项目名称:bts,代码行数:19,代码来源:ReferenceSearchResultContentProvider.java
示例19: addReference
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
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);
}
}
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:ReferenceSearchResultContentProvider.java
示例20: handleOpen
import org.eclipse.xtext.resource.IReferenceDescription; //导入依赖的package包/类
protected void handleOpen(OpenEvent openEvent) {
ISelection selection = openEvent.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
for (Iterator<?> i = structuredSelection.iterator(); i.hasNext();) {
Object selectedObject = i.next();
if (selectedObject instanceof ReferenceSearchViewTreeNode) {
ReferenceSearchViewTreeNode treeNode = (ReferenceSearchViewTreeNode) selectedObject;
Object description = treeNode.getDescription();
if (description instanceof IReferenceDescription) {
IReferenceDescription referenceDescription = (IReferenceDescription) description;
uriEditorOpener.open(referenceDescription.getSourceEObjectUri(),
referenceDescription.getEReference(), referenceDescription.getIndexInList(), true);
} else if (description instanceof IResourceDescription) {
uriEditorOpener.open(((IResourceDescription) description).getURI(), true);
}
}
}
}
}
开发者ID:cplutte,项目名称:bts,代码行数:21,代码来源:ReferenceSearchViewPage.java
注:本文中的org.eclipse.xtext.resource.IReferenceDescription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论