1 19 20 package org.netbeans.modules.java.parser; 21 22 import org.openide.nodes.Node; 23 import org.openide.src.*; 24 25 import org.netbeans.modules.java.bridge.BindingFactory; 26 import org.netbeans.modules.java.bridge.LangModel; 27 import org.netbeans.modules.java.bridge.WrapperFactory; 28 import org.netbeans.modules.java.codegen.DocumentBinding; 29 30 35 public class LangEnvironmentImpl implements LangModel.Env { 36 DocumentBinding binding; 37 WrapperFactory wrapper; 38 LangModel model; 39 40 public LangEnvironmentImpl(DocumentBinding docBinding) { 41 this.binding = docBinding; 42 this.wrapper = DefaultWrapper.getInstance(); 43 } 44 45 49 public void setModel(LangModel model) { 50 this.model = model; 51 } 52 53 56 public BindingFactory getBindingFactory() { 57 return binding; 58 } 59 60 63 public WrapperFactory getWrapperFactory() { 64 return wrapper; 65 } 66 67 70 public void complete(Element scope, int informationKind) { 71 } 72 73 79 public Type resolveType(Element context, Type original) { 80 if (original.isPrimitive()) 81 return original; 82 Type t = original; 83 int depth = 0; 84 while (t.isArray()) { 85 t = t.getElementType(); 86 depth++; 87 } 88 if (t.isPrimitive()) 89 return original; 90 91 Identifier id = t.getTypeIdentifier(); 92 Identifier resolved = resolveTypeIdent(context, id); 93 if (resolved == id) 94 return original; 95 96 t = Type.createClass(resolved); 98 while (depth > 0) { 99 t = Type.createArray(t); 100 } 101 return t; 102 } 103 104 111 public Identifier resolveTypeIdent(Element context, Identifier original) { 112 if (model.isSameContext(context, original)) 113 return original; 114 return model.createLocalIdentifier(context, original.getFullName(), 115 original.getSourceName(), Identifier.NOT_YET_RESOLVED); 116 } 117 118 public Node.Cookie findCookie(Element el, Class c) { 119 return null; 120 } 121 } 122 | Popular Tags |