Package org.eclipse.dltk.core

Examples of org.eclipse.dltk.core.ISourceModule


  }
 
  @Test
  public void testMismatchedModuleName() throws Exception { testMismatchedModuleName$(); }
  public void testMismatchedModuleName$() throws Exception {
    ISourceModule incorrectNameMod = getSourceModule(TR_SAMPLE_SRC1, "moduleDeclIncorrectName.d");
    assertEquals(incorrectNameMod.getElementName(), "moduleDeclIncorrectName.d");
   
    checkElementExists(incorrectNameMod, incorrectNameMod.getType("actualModuleName_DifferentFromFileName"),
        EArcheType.Module, "module actualModuleName_DifferentFromFileName;");
  }
View Full Code Here


    assertTrue((defElementDescriptor.elementFlags & falseFlags) == 0);

  }
 
  public IType getModuleElement(String sourceFolder, String moduleName) {
    ISourceModule srcModule = getSourceModule(sourceFolder, moduleName+".d");
    IType moduleElement = srcModule.getType(moduleName);
    assertTrue(moduleElement.exists());
    return moduleElement;
  }
View Full Code Here

  public void searchTypeRefs() throws Exception { searchTypeRefs$(); }
  public void searchTypeRefs$() throws Exception {
    IMember element = getElement(searchProj, "srcB", "", "sampledefs").getType("Class");
    SearchRequestorResultCollector collector = testSearchForElementReferences(element);
   
    ISourceModule module = getModule(searchProj, "srcB", "", "sampledefs_refs");
   
    checkMarkers(collector, module, "/*sampledefs.Class*/");
  }
 
View Full Code Here

  public void searchVarRefs() throws Exception { searchVarRefs$(); }
  public void searchVarRefs$() throws Exception {
    IMember element = getElement(searchProj, "srcB", "", "sampledefs").getType("Class").getField("fieldA");
    SearchRequestorResultCollector collector = testSearchForElementReferences(element);
   
    ISourceModule module = getModule(searchProj, "srcB", "", "sampledefs_refs");
   
    checkMarkers(collector, module, "/*sampledefs.Class.fieldA*/");
  }
 
View Full Code Here

  public void searchMethodRefs() throws Exception { searchMethodRefs$(); }
  public void searchMethodRefs$() throws Exception {
    IMember element = getElement(searchProj, "srcB", "", "sampledefs").getType("Class").getMethod("methodB");
    SearchRequestorResultCollector collector = testSearchForElementReferences(element);
    //printIndexDebugInfo(searchProj.getProject())
    ISourceModule module = getModule(searchProj, "srcB", "", "sampledefs_refs");
   
    checkMarkers(collector, module, "/*sampledefs.Class.methodB*/");
  }
 
View Full Code Here

    for (Integer markerOffset : offsets) {
      boolean matchFound = false;
      for (Iterator<SearchMatch> iterator = collector.matches.iterator(); iterator.hasNext(); ) {
        SearchMatch match = iterator.next();
       
        ISourceModule matchModule = assertInstance(match.getElement(), IMember.class).getSourceModule();
        if(DeeSearchEngineTestUtils.getSourceModuleFQName(matchModule).equals("sampledefs_refs")) {
          if(match.getOffset() == markerOffset) {
            // This marker offset is accounted for
            matchFound = true;
            iterator.remove();
View Full Code Here

  }
 
  @Test
  public void testTestData() throws Exception { testTestData$(); }
  public void testTestData$() throws Exception {
    ISourceModule srcModule = getModule(searchProj, "srcB", "", "search2");
    Path filePath = DLTKUtils.getFilePath(srcModule.getResource().getLocation());
    ParsedModule parseModule = DToolClient.getDefaultModuleCache().getParsedModuleOrNull(filePath);
    Module module = parseModule.module;
   
    DefUnit defUnit = MiscNodeUtils.getDefUniFromScope(module.getChildren(), "xxxTestUnboundRef");
    IModuleResolver mr = DToolClient.getDefault().getResolvedModule(filePath).getModuleResolver();
View Full Code Here

  }
 
  @Test
  public void testCompletionOnOutSrc() throws Exception { testCompletionOnOutSrc$(); }
  public void testCompletionOnOutSrc$() throws Exception {
    ISourceModule srcModule = SampleMainProject.getSourceModule(IOutsideBuildpathTestResources.TEST_OUTFILE);
   
    srcModule.becomeWorkingCopy(null, null);
    try {
      final int offset = srcModule.getSource().indexOf("Foo foo");
     
      class CompletionRequestorTestCheck extends CompletionRequestor {
        @Override
        public void accept(CompletionProposal proposal) {
          assertTrue(proposal.getCompletionLocation() == offset);
          assertTrue(proposal.getReplaceStart() == offset);
        }
      }
     
      DeeCompletionEngine completionEngine = new DeeCompletionEngine();
      completionEngine.setRequestor(new CompletionRequestorTestCheck());
      completionEngine.complete((IModuleSource) srcModule, offset, 0);
    } finally {
      srcModule.discardWorkingCopy();
    }
  }
View Full Code Here

            Module moduleNode = defUnit.getModuleNode();
            if(moduleNode == null) {
              continue; // consider this case more
            }
             
            ISourceModule defUnitSrcModule = findSourceModule(moduleNode, searchProj);
           
            ArrayList<Integer> nodeTreePath = DeeSearchEngineTestUtils.getNodeTreePath(defUnit);
            Pair<ISourceModule, ?> key = Pair.create(defUnitSrcModule, nodeTreePath);
           
            if(defUnitToReferencesMap.get(key) == null) {
              defUnitToReferencesMap.put(key, new HashSet<Reference>());
            }
           
            defUnitToReferencesMap.get(key).add(reference);
          }
        }
      }
    }.visitElementsAndNodes(getSrcFolder(searchProj, "srcA"), 10);
   
   
   
    for (Pair<ISourceModule, ?> key : defUnitToReferencesMap.keySet()) {
      ISourceModule sourceModule = key.getFirst();
      ArrayList<Integer> nodeTreePath = blindCast(key.getSecond());
     
      Path filePath = DLTKUtils.getFilePath(sourceModule);
     
      ParsedModule parseModule = DToolClient.getDefaultModuleCache().getParsedModuleOrNull(filePath);
      Module deeModule = parseModule == null ? null : parseModule.module;
      ASTNode node = DeeSearchEngineTestUtils.getNodeFromPath(deeModule, nodeTreePath);
     
      final DefUnit defUnit = (DefUnit) node;
      final HashSet<Reference> expectedReferences = defUnitToReferencesMap.get(key);
     
      IMember element = DeeModelEngine.findCorrespondingModelElement(defUnit, sourceModule);
//      if(element == null) {
//        // TODO: consider this case
//        continue;
//      }
     
      final String keyIdentifier = DeeSearchEngineTestUtils.getModelElementFQName(element);
     
      doTestSearchForElementReferences(element, new MatchChecker(){
        @Override
        public void checkMatch(SearchMatch match) throws CoreException {
          IMember refElement = assertInstance(match.getElement(), IMember.class);
          ISourceModule module = getSourceModule(refElement);
          checkKey(module, match.getOffset(), keyIdentifier);
         
          checkReferences(expectedReferences, match);
        }
       
        private void checkReferences(final HashSet<Reference> expectedReferences, SearchMatch referenceMatch) {
          // Search for referenceMatch in expectedReferences, then remove it
         
          for (Reference pair : expectedReferences) {
            Reference reference = pair;
           
            String refModuleName = reference.getModuleNode().getModuleFullyQualifiedName();
           
            IModelElement modelElement = downCast(referenceMatch.getElement());
            ISourceModule matchSrcModule = DeeSearchEngineTestUtils.getSourceModule(modelElement);
           
            String matchModuleName = DeeSearchEngineTestUtils.getSourceModuleFQName(matchSrcModule);
           
            if(areEqual(refModuleName, matchModuleName) &&
              reference.getOffset() == referenceMatch.getOffset() &&
View Full Code Here

    }
    // process all modules
    int remainingWork = resourceToModuleInfos.size();
    for (Iterator i = resourceToModuleInfos.entrySet().iterator(); i.hasNext();) {
      final Map.Entry entry = (Map.Entry) i.next();
      final ISourceModule module = (ISourceModule) entry.getKey();
      final ModuleInfo info = (ModuleInfo) entry.getValue();
      monitor.subTask(NLS.bind(Messages.RutaCheckBuilder_processing, module.getElementName(),
              Integer.toString(remainingWork)));
      codeModels.clear();
      --remainingWork;
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.core.ISourceModule

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.