• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java NodeModelUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.xtext.nodemodel.util.NodeModelUtils的典型用法代码示例。如果您正苦于以下问题:Java NodeModelUtils类的具体用法?Java NodeModelUtils怎么用?Java NodeModelUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NodeModelUtils类属于org.eclipse.xtext.nodemodel.util包,在下文中一共展示了NodeModelUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: collectAllResolutions

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
/**
 * CollectAll resolutions under the cursor at offset.
 *
 */
List<IssueResolution> collectAllResolutions(XtextResource resource, RegionWithCursor offset,
		Multimap<Integer, Issue> offset2issue) {

	EObject script = resource.getContents().get(0);
	ICompositeNode scriptNode = NodeModelUtils.getNode(script);
	ILeafNode offsetNode = NodeModelUtils.findLeafNodeAtOffset(scriptNode, offset.getGlobalCursorOffset());
	int offStartLine = offsetNode.getTotalStartLine();
	List<Issue> allIssues = QuickFixTestHelper.extractAllIssuesInLine(offStartLine, offset2issue);

	List<IssueResolution> resolutions = Lists.newArrayList();

	for (Issue issue : allIssues) {
		if (issue.getLineNumber() == offsetNode.getStartLine()
				&& issue.getLineNumber() <= offsetNode.getEndLine()) {
			Display.getDefault().syncExec(() -> resolutions.addAll(quickfixProvider.getResolutions(issue)));
		}
	}
	return resolutions;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:QuickFixXpectMethod.java


示例2: getDeadCodeRegion

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
private DeadCodeRegion getDeadCodeRegion(Set<ControlFlowElement> deadCodeGroup) {
	int startIdx = Integer.MAX_VALUE;
	int endIdx = 0;
	int firstElementOffset = Integer.MAX_VALUE;
	ControlFlowElement firstElement = null;

	for (ControlFlowElement deadCodeElement : deadCodeGroup) {
		ICompositeNode compNode = NodeModelUtils.findActualNodeFor(deadCodeElement);
		int elemStartIdx = compNode.getOffset();
		int elemEndIdx = elemStartIdx + compNode.getLength();
		startIdx = Math.min(startIdx, elemStartIdx);
		endIdx = Math.max(endIdx, elemEndIdx);
		if (elemStartIdx < firstElementOffset) {
			firstElementOffset = elemStartIdx;
			firstElement = deadCodeElement;
		}
	}

	ControlFlowElement containerCFE = flowAnalyzer.getContainer(firstElement);
	ControlFlowElement reachablePredecessor = findPrecedingStatement(firstElement);
	return new DeadCodeRegion(startIdx, endIdx - startIdx, containerCFE, reachablePredecessor);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:DeadCodeAnalyser.java


示例3: toAcceptor

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的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


示例4: enhanceExistingImportDeclaration

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@SuppressWarnings({ "unused", "deprecation" })
private AliasLocation enhanceExistingImportDeclaration(ImportDeclaration importDeclaration,
		QualifiedName qualifiedName,
		String optionalAlias, MultiTextEdit result) {

	addImportSpecifier(importDeclaration, qualifiedName, optionalAlias);
	ICompositeNode replaceMe = NodeModelUtils.getNode(importDeclaration);
	int offset = replaceMe.getOffset();
	AliasLocationAwareBuffer observableBuffer = new AliasLocationAwareBuffer(
			optionalAlias,
			offset,
			grammarAccess);

	try {
		serializer.serialize(
				importDeclaration,
				observableBuffer,
				SaveOptions.newBuilder().noValidation().getOptions());
	} catch (IOException e) {
		throw new RuntimeException("Should never happen since we write into memory", e);
	}
	result.addChild(new ReplaceEdit(offset, replaceMe.getLength(), observableBuffer.toString()));
	return observableBuffer.getAliasLocation();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:25,代码来源:ImportRewriter.java


示例5: findInsertionOffset

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
private int findInsertionOffset() {
	int result = 0;
	List<ScriptElement> scriptElements = script.getScriptElements();
	for (int i = 0, size = scriptElements.size(); i < size; i++) {
		ScriptElement element = scriptElements.get(i);
		if (element instanceof ImportDeclaration) {
			// Instead of getting the total offset for the first non-import-declaration, we try to get the
			// total end offset for the most recent import declaration which is followed by any other script element
			// this is required for the linebreak handling for automatic semicolon insertion.
			final ICompositeNode importNode = NodeModelUtils.findActualNodeFor(element);
			if (null != importNode) {
				result = importNode.getTotalOffset() + getLengthWithoutAutomaticSemicolon(importNode);
			}
		} else {
			// Otherwise, we assume there is no import declarations yet, we can put it to the top of the document.
			return result;
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:ImportRewriter.java


示例6: doWrapAndWrite

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
/**
 * Take the content of resource
 *
 * @param resource
 *            JS-code snippet which will be treated as text.
 * @param outCode
 *            writer to output to.
 */
private void doWrapAndWrite(N4JSResource resource, Writer outCode) {
	// check if wrapping really applies.
	boolean moduleWrapping = projectUtils.isModuleWrappingEnabled(resource.getURI());

	// get script
	EObject script = resource.getContents().get(0);

	// obtain text
	CharSequence scriptAsText = NodeModelUtils.getNode(script).getRootNode().getText();

	// wrap and write
	String decorated = (moduleWrapping ? ModuleWrappingTransformation.wrapPlainJSCode(scriptAsText)
			: scriptAsText).toString();
	try {

		outCode.write(decorated);

	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:30,代码来源:EcmaScriptTranspiler.java


示例7: toPos

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
private String toPos(EObject eobj) {
	if (eobj == null)
		return "";
	StringBuilder strb = new StringBuilder();
	String res = null;
	if (eobj.eResource() != null) {
		res = eobj.eResource().getURI().toString();
		if (res.startsWith("platform:/resource/")) {
			res = res.substring("platform:/resource/".length());
		}
	}
	if (res != null)
		strb.append(res);
	EObject astNode = eobj instanceof SyntaxRelatedTElement ? ((SyntaxRelatedTElement) eobj).getAstElement() : eobj;
	ICompositeNode node = NodeModelUtils.findActualNodeFor(astNode);
	if (node != null) {
		strb.append(":").append(node.getStartLine());
	}
	return strb.toString();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:JSDoc2SpecAcceptor.java


示例8: provideHighligtingFor

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
private void provideHighligtingFor(ElementReferenceExpression expression,
		org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor acceptor) {
	EObject reference = expression.getReference();
	if (reference instanceof Declaration) {
		Declaration decl = (Declaration) expression.getReference();
		switch (decl.getName()) {
		case "msg":
		case "block":
		case "tx":
		case "now":
		case "this":
		case "super":
			ICompositeNode node = NodeModelUtils.findActualNodeFor(expression);
			acceptor.addPosition(node.getTotalOffset(), node.getLength() + 1,
					DefaultHighlightingConfiguration.KEYWORD_ID);
		}
	}
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:19,代码来源:SoliditySemanticHighlighter.java


示例9: checkNoJavaStyleTypeCasting

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Check
public void checkNoJavaStyleTypeCasting(XBlockExpression blockExpression) {
	if(isIgnored(JAVA_STYLE_TYPE_CAST)) {
		return;
	}
	if (blockExpression.getExpressions().size() <= 1) {
		return;
	}
	ICompositeNode node = NodeModelUtils.getNode(blockExpression);
	if (node == null) {
		return;
	}
	INode expressionNode = null;
	for (INode child : node.getChildren()) {
		if (isSemicolon(child)) {
			expressionNode = null;
		} else if (isXExpressionInsideBlock(child)) {
			if (expressionNode != null) {
				checkNoJavaStyleTypeCasting(expressionNode);
			}
			expressionNode = child;
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:25,代码来源:XbaseValidator.java


示例10: createUnknownTypeReference

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
private LightweightTypeReference createUnknownTypeReference(JvmParameterizedTypeReference reference) {
	List<INode> nodes = NodeModelUtils.findNodesForFeature(reference, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
	if (nodes.isEmpty()) {
		Set<EObject> sourceElements = owner.getServices().getJvmModelAssociations().getSourceElements(reference);
		EObject firstSource = Iterables.getFirst(sourceElements, null);
		if (firstSource instanceof JvmParameterizedTypeReference) {
			nodes = NodeModelUtils.findNodesForFeature(firstSource, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE);
		}
	}
	if (nodes.size() == 1) {
		String name = nodes.get(0).getText().trim();
		if (name != null && name.length() != 0) {
			int lastDot = name.lastIndexOf('.');
			int lastDollar = name.lastIndexOf('$');
			int lastDotOrDollar = Math.max(lastDot, lastDollar);
			if (lastDotOrDollar != -1 && lastDotOrDollar != name.length() - 1) {
				String shortName = name.substring(lastDotOrDollar + 1);
				if (shortName.length() != 0) {
					name = shortName;
				}
			}
			return owner.newUnknownTypeReference(name);
		}
	}
	return owner.newUnknownTypeReference();
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:27,代码来源:LightweightTypeReferenceFactory.java


示例11: getSignificantTextRegion

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Override
public ITextRegion getSignificantTextRegion(EObject element) {
	if (element instanceof XAbstractFeatureCall) {
		XAbstractFeatureCall typeLiteral = typeLiteralHelper.getRootTypeLiteral((XAbstractFeatureCall) element);
		if (typeLiteral != null) {
			if (typeLiteral instanceof XMemberFeatureCall) {
				XAbstractFeatureCall target = (XAbstractFeatureCall) ((XMemberFeatureCall) typeLiteral).getMemberCallTarget();
				if (target.isTypeLiteral()) {
					return super.getSignificantTextRegion(typeLiteral);
				}
			}
			INode node = NodeModelUtils.findActualNodeFor(typeLiteral);
			if (node != null) {
				return toZeroBasedRegion(node.getTextRegionWithLineInformation());
			}
		}
	}
	return super.getSignificantTextRegion(element);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:20,代码来源:XbaseLocationInFileProvider.java


示例12: resolveCrossReferencedElement

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Override
protected EObject resolveCrossReferencedElement(INode node) {
	EObject referenceOwner = NodeModelUtils.findActualSemanticObjectFor(node);
	if (referenceOwner != null) {
		EReference crossReference = GrammarUtil.getReference((CrossReference) node.getGrammarElement(),
				referenceOwner.eClass());
		if (!crossReference.isMany()) {
			EObject resultOrProxy = (EObject) referenceOwner.eGet(crossReference);
			if (resultOrProxy != null && resultOrProxy.eIsProxy() && crossReference == XbasePackage.Literals.XCONSTRUCTOR_CALL__CONSTRUCTOR) {
				if (referenceOwner instanceof XConstructorCall) {
					JvmIdentifiableElement linkedType = batchTypeResolver.resolveTypes(referenceOwner).getLinkedFeature((XConstructorCall)referenceOwner);
					if (linkedType != null)
						return linkedType;
				}
			} 
			return resultOrProxy;
		} else {
			return super.resolveCrossReferencedElement(node);
		}
	}
	return null;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:23,代码来源:BrokenConstructorCallAwareEObjectAtOffsetHelper.java


示例13: test1

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Test
public void test1() {
  try {
    this.with(ReferenceGrammarTestLanguageStandaloneSetup.class);
    final String model = "kind (Hugo 13)";
    final ParserRule kindRule = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class).getKindRule();
    final XtextResource resource = this.createResource();
    resource.setEntryPoint(kindRule);
    StringInputStream _stringInputStream = new StringInputStream(model);
    resource.load(_stringInputStream, CollectionLiterals.<Object, Object>emptyMap());
    Assert.assertTrue(resource.getErrors().isEmpty());
    Assert.assertEquals(kindRule, NodeModelUtils.getEntryParserRule(resource.getParseResult().getRootNode()));
    final String originalNodeModel = NodeModelUtils.compactDump(resource.getParseResult().getRootNode(), false);
    resource.update(0, model.length(), ((" " + model) + " "));
    final String reparsedNodeModel = NodeModelUtils.compactDump(resource.getParseResult().getRootNode(), false);
    Assert.assertEquals(originalNodeModel, reparsedNodeModel);
    final ParserRule erwachsenerRule = this.<ReferenceGrammarTestLanguageGrammarAccess>get(ReferenceGrammarTestLanguageGrammarAccess.class).getErwachsenerRule();
    resource.setEntryPoint(erwachsenerRule);
    resource.update(0, model.length(), "erwachsener (Peter 30)");
    Assert.assertEquals(erwachsenerRule, NodeModelUtils.getEntryParserRule(resource.getParseResult().getRootNode()));
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:25,代码来源:SetEntryPointOnXtextResourceTest.java


示例14: testTreeIteratorForSyntheticNodes_Backwards

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Test public void testTreeIteratorForSyntheticNodes_Backwards() throws Exception {
	EObject object = getModel("d - e / e * d");
	ICompositeNode root = NodeModelUtils.getNode(object).getRootNode();
	INode firstChild = root.getFirstChild();
	INode firstGrandChild = ((ICompositeNode) firstChild).getFirstChild();
	INode sibling = firstGrandChild.getNextSibling().getNextSibling().getNextSibling();
	INode siblingChild = ((ICompositeNode) sibling).getFirstChild();
	INode siblingGrandChild = ((ICompositeNode) siblingChild).getFirstChild();
	INode synthetic = ((ICompositeNode) siblingGrandChild).getFirstChild();
	assertTrue(synthetic instanceof SyntheticCompositeNode);
	INode expectedFirstChild = ((ICompositeNode)synthetic).getFirstChild();
	while(expectedFirstChild instanceof ICompositeNode)
		expectedFirstChild = ((ICompositeNode)expectedFirstChild).getFirstChild();
	INode actualFirstChild = null;
	for(INode child: synthetic.getAsTreeIterable().reverse())
		actualFirstChild = child;
	assertEquals(expectedFirstChild, actualFirstChild);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:TreeIteratorTest.java


示例15: append

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Override
public TreeAppendable append(JvmType type) {
	if(type.eIsProxy()) {
		String fragment = ((InternalEObject)type).eProxyURI().fragment();
		Triple<EObject, EReference, INode> unresolvedLink = encoder.decode(getState().getResource(), fragment);
		if(unresolvedLink != null) {
			INode linkNode = unresolvedLink.getThird();
			if(linkNode != null) {
				append(NodeModelUtils.getTokenText(linkNode));
				return this;
			}
		}
		append("unresolved type");
		return this;
	}
	return super.append(type);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:ErrorTreeAppendable.java


示例16: apply

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void apply(final IModificationContext context) throws BadLocationException {
  final IXtextDocument xtextDocument = context.getXtextDocument();
  xtextDocument.readOnly(new IUnitOfWork.Void<XtextResource>() {
    @Override
    public void process(final XtextResource state) throws Exception { // NOPMD
      final EObject target = EcoreUtil2.getContainerOfType(state.getEObject(issue.getUriToProblem().fragment()), type);
      if (type.isInstance(target)) {
        int offset = NodeModelUtils.findActualNodeFor(target).getOffset();
        int lineOfOffset = xtextDocument.getLineOfOffset(offset);
        int lineOffset = xtextDocument.getLineOffset(lineOfOffset);
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i < (offset - lineOffset); i++) {
          buffer.append(' ');
        }
        xtextDocument.replace(offset, 0, NLS.bind(autodocumentation, buffer.toString()));
      }
    }
  });
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:22,代码来源:CheckQuickfixProvider.java


示例17: testErrorMarkers

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Test public void testErrorMarkers() throws Exception {
	with(ReferenceGrammarTestLanguageStandaloneSetup.class);
	// model contains an error due to missing ) at idx 23
	String model = "spielplatz 1 {kind (k 1}"; 
	XtextResource resource = getResourceFromStringAndExpect(model, 1);
	assertEquals(1, resource.getErrors().size());
	assertEquals(1, Iterables.size(resource.getParseResult().getSyntaxErrors()));
	ICompositeNode rootNode = resource.getParseResult().getRootNode();
	ILeafNode leaf = NodeModelUtils.findLeafNodeAtOffset(rootNode, model.length() - 1);
	assertTrue(leaf.getSyntaxErrorMessage() != null);
	// resource.update(23, 0, ")");
	// assertTrue(resource.getParseResult().getParseErrors().isEmpty());
	IParseResult reparse = reparse(resource.getParseResult(), 23, 0, ")");
	rootNode = reparse.getRootNode();
	String expectedFixedModel = "spielplatz 1 {kind (k 1)}";
	String fixedModel = rootNode.getText();
	assertEquals("serialized model as expected", expectedFixedModel, fixedModel);
	resource = getResourceFromString(fixedModel);
	assertEquals("full reparse is fine", 0, resource.getErrors().size());
	assertFalse("partial reparse is fine", reparse.hasSyntaxErrors());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:22,代码来源:PartialParserTest.java


示例18: filterKeyword

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
@Override
public boolean filterKeyword(final Keyword keyword, final ContentAssistContext context) {
  final String value = keyword.getValue();
  if (((value.length() > 1) && Character.isLetter(value.charAt(0)))) {
    if ((Objects.equal(value, "as") || Objects.equal(value, "instanceof"))) {
      final EObject previousModel = context.getPreviousModel();
      if ((previousModel instanceof XExpression)) {
        if (((context.getPrefix().length() == 0) && (NodeModelUtils.getNode(previousModel).getEndOffset() > context.getOffset()))) {
          return false;
        }
        final LightweightTypeReference type = this.typeResolver.resolveTypes(previousModel).getActualType(((XExpression)previousModel));
        if (((type == null) || type.isPrimitiveVoid())) {
          return false;
        }
      }
    }
    return true;
  }
  return false;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:21,代码来源:XbaseIdeContentProposalProvider.java


示例19: completeXFeatureCall

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
protected void completeXFeatureCall(final EObject model, final ContentAssistContext context, final IIdeContentProposalAcceptor acceptor) {
  if ((model != null)) {
    boolean _hasExpressionScope = this.typeResolver.resolveTypes(model).hasExpressionScope(model, IExpressionScope.Anchor.WITHIN);
    if (_hasExpressionScope) {
      return;
    }
  }
  if ((model instanceof XMemberFeatureCall)) {
    final ICompositeNode node = NodeModelUtils.getNode(model);
    boolean _isInMemberFeatureCall = this.isInMemberFeatureCall(model, node.getEndOffset(), context);
    if (_isInMemberFeatureCall) {
      return;
    }
  }
  this.createLocalVariableAndImplicitProposals(model, IExpressionScope.Anchor.AFTER, context, acceptor);
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:XbaseIdeContentProposalProvider.java


示例20: getSelectedElementUri

import org.eclipse.xtext.nodemodel.util.NodeModelUtils; //导入依赖的package包/类
/**
 * Gets the URI of the semantic element currently selected.
 *
 * @return URI or null
 */
public URI getSelectedElementUri() {
  if (selection instanceof IStructuredSelection) {
    if (((IStructuredSelection) selection).getFirstElement() instanceof InternalEObject) {
      // structured selection, e.g. GMFEditor
      return EcoreUtil.getURI((EObject) ((IStructuredSelection) selection).getFirstElement());
    } else if (((IStructuredSelection) selection).getFirstElement() instanceof EObjectNode) {
      // selection in outline
      return ((EObjectNode) ((IStructuredSelection) selection).getFirstElement()).getEObjectURI();
    }
  } else {
    ILeafNode node = nodeAtTextSelection();
    EObject semanticObject = NodeModelUtils.findActualSemanticObjectFor(node);
    if (semanticObject != null) {
      return EcoreUtil.getURI(semanticObject);
    }
  }
  return null;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:24,代码来源:XtextElementSelectionListener.java



注:本文中的org.eclipse.xtext.nodemodel.util.NodeModelUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FMLServerAboutToStartEvent类代码示例发布时间:2022-05-21
下一篇:
Java JavaScript类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap