Package dtool.ast.definitions

Examples of dtool.ast.definitions.DefUnit


  }
 
  @Override
  public boolean match(ASTNode node, ISourceModule sourceModule, Path filePath) {
    if(matchDeclarations && node instanceof DefUnit) {
      DefUnit definition = (DefUnit) node;
      matchDefUnit(definition, sourceModule, filePath);
    }
   
    if(matchReferences && node instanceof NamedReference) {
      NamedReference ref = (NamedReference) node;
View Full Code Here


    if(defUnits == null)
      return;
   
    for (Iterator<INamedElement> iter = defUnits.iterator(); iter.hasNext();) {
      INamedElement targetDefElement = iter.next();
      DefUnit targetDefUnit = targetDefElement.resolveDefUnit();
     
      try {
        IMember targetModelElement = DeeModelEngine.findCorrespondingModelElement(targetDefUnit,
          sourceModule.getScriptProject());
View Full Code Here

 
  public static IMember searchForModelElement(DefUnit defUnit, ISourceModule sourceModule, boolean returnNonExisting)
      throws ModelException {
    assertNotNull(sourceModule);
   
    DefUnit parentDefUnit = NodeUtil.getOuterDefUnit(defUnit);
   
    if(parentDefUnit == null) {
      return sourceModule.getType(defUnit.getName());
    } else {
      IMember parentElement = searchForModelElement(parentDefUnit, sourceModule, returnNonExisting);
View Full Code Here

    }
    throw assertFail();
  }
 
  public void addMatch(ASTNode node, int accLevel, ISourceModule sourceModule) {
    DefUnit defUnit = (node instanceof DefUnit) ? (DefUnit) node : NodeUtil.getOuterDefUnit(node);
    IModelElement enclosingType;
    try {
      enclosingType = DeeModelEngine.searchForModelElement(defUnit, sourceModule, true);
      assertNotNull(enclosingType);
    } catch (ModelException e) {
View Full Code Here

   
    Module deeModule = DToolClient.getDefaultModuleCache().getExistingParsedModuleNode(filePath);
    ASTNode node = ASTNodeFinder.findElement(deeModule, offset);
   
    if(node instanceof DefSymbol) {
      DefUnit defUnit = ((DefSymbol) node).getDefUnit();
      try {
        IMember modelElement = DeeModelEngine.findCorrespondingModelElement(defUnit, sourceModule);
        return modelElement == null ? null : new IModelElement[] { modelElement };
      } catch (ModelException e) {
        return null;
      }
    }
   
    if(!(node instanceof Reference)) {
      return new IModelElement[0];
    }
    Reference ref = (Reference) node;
   
    IModuleResolver moduleResolver = DToolClient_Bad.getResolverFor(filePath);
    Collection<INamedElement> defElements = ref.findTargetDefElements(moduleResolver, false);
    // We assume namespace Parent is the same
    if(defElements == null) {
      return new IModelElement[0];
    }
   
    ArrayList<IModelElement> list = new ArrayList<IModelElement>();
    for (INamedElement defElement : defElements) {
      DefUnit defUnit = defElement.resolveDefUnit();
      IMember modelElement = getModelElement(defUnit, sourceModule);
      if(modelElement != null) {
        list.add(modelElement);
      }
    }
View Full Code Here

TOP

Related Classes of dtool.ast.definitions.DefUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.