private IType getNativeType(String typeName) { IJstType arrayJstType = CodeassistUtils.findNativeJstType(typeName); assertNotNull(arrayJstType); IType arrayType = CodeassistUtils.findNativeSourceType(arrayJstType); assertNotNull(arrayType); return arrayType; }
/* * (non-Javadoc) * * @see org.eclipse.vjet.eclipse.internal.codeassist.select.translator.DefaultNodeTranslator#resolveBinding(org.eclipse.vjet.dsf.jst.IJstNode) */ @Override public IJstNode lookupBinding(IJstNode jstNode) { JstIdentifier identifier = (JstIdentifier) jstNode; // TODO should this part of binding? each client currently has to do this lookup. // see similiar logic in VjoCcObjLiteralAdvisor if (identifier.getParentNode() instanceof NV) { NV realParent = (NV) identifier.getParentNode(); String fieldName = realParent.getName(); ObjLiteral enclosingObjLiteral = (ObjLiteral) ((NV) realParent).getParentNode(); final IJstType olExprType = enclosingObjLiteral.getResultType(); if (olExprType != null && olExprType instanceof SynthOlType) { final SynthOlType enclosingObjLiteralType = (SynthOlType) olExprType; List<IJstType> olResolvedTypes = enclosingObjLiteralType.getResolvedOTypes(); if (olResolvedTypes == null) { return null; } for (IJstType iJstType : olResolvedTypes) { IJstProperty prop = iJstType.getProperty(fieldName); if (prop != null) { return prop; } } } } if (identifier.getJstBinding() == null) { return null; } if (isKeyWord(identifier)) { return null; } IJstNode binding = identifier.getJstBinding(); // check the identifer in local variable declarion site. if ((binding == null || binding instanceof IJstType) && CodeassistUtils.isLocalVarDeclaration(identifier)) { binding = identifier.getParentNode().getParentNode(); // JstVars } if (binding == null || binding == identifier) { return null; } return JstNodeDLTKElementResolver.lookupBinding(binding); }
public InputStream openInputStream(int options, IProgressMonitor monitor) throws CoreException { // TODO add extension point here so that multiple providers of view can // be used here String typeName = getTypeName(); IJstType type = TypeSpaceMgr.getInstance().getTypeSpace().getType(new TypeName(getGroupName(), typeName)); if (CodeassistUtils.isNativeGroup(getGroupName())) { if (type != null) { VjoGenerator gen = new VjoGenerator(new GeneratorCtx(CodeStyle.PRETTY)); gen.writeType(type); return new StringInputStream(gen.getGeneratedText()); } } return new StringInputStream( "/* Class : " + getTypeName() + "\n" + "see outline for more info \n*/"); }