Package org.eclipse.dltk.core

Examples of org.eclipse.dltk.core.ISourceModule


  }
 
  @Test
  public void testSampleModelElements() throws Exception { testSampleModelElements$(); }
  public void testSampleModelElements$() throws Exception {
    ISourceModule srcModule = getSourceModule(TR_SAMPLE_SRC1, "sampledefs.d");
    final String packageQualification = "";
   
    new SampleModelElementsVisitor(srcModule) {
      @Override
      public void visitAllModelElements(
View Full Code Here


      IProjectFragment projectFragment = scriptProj.getProjectFragment(scriptProj.getProject().getFolder("src"));
      assertNotNull(projectFragment);
      IScriptFolder scriptFolder = projectFragment.getScriptFolder("pack.sub");
      String[] ns = array("pack", "sub");
      assertNotNull(scriptFolder);
      ISourceModule sourceModule1 = scriptFolder.getSourceModule("sourceModule.d");
      assertNotNull(sourceModule1);

//      FakeMember.FakeType primitive_
//        = new FakeMember.FakeType(sourceModule1, "primitive", FLAG_KIND_STRUCT, ns);
     
View Full Code Here

    HashSet<String> modules = sr.findModules(moduleName);
    assertTrue(modules.contains(moduleName) == exists);
  }
 
  protected void testUpdatesToWorkingCopy() throws CoreException, IOException {
    ISourceModule sourceModule = testsProject.getSourceModule("source/basic_foo.d");
    IFile moduleFile = (IFile) sourceModule.getResource();
    sourceModule.discardWorkingCopy();
   
    String originalFileContents = "module wc_change0;";
    updateFileContents(moduleFile, originalFileContents);
   
    sourceModule.becomeWorkingCopy(new NullProblemRequestor(), new NullProgressMonitor());
    doCodeCompletion(moduleFile, 0, "wc_change0");
   
    sourceModule.getBuffer().setContents("module wc_change1;");
    assertEquals(readFileContents(moduleFile), originalFileContents);
   
    doCodeCompletion(moduleFile, 0, "wc_change1");
   
    sourceModule.getBuffer().setContents("module wc_change2;");
    doCodeCompletion(moduleFile, 0, "wc_change2");
   
    sourceModule.discardWorkingCopy();
    doCodeCompletion(moduleFile, 0, "wc_change0");
   
   
    sourceModule = testsProject.getSourceModule("source/basic_pack/foo.d");
    moduleFile = (IFile) sourceModule.getResource();
    doCodeCompletion(moduleFile, 0, "basic_pack/");
   
    // Test commitWorkingCopy
    sourceModule.becomeWorkingCopy(new NullProblemRequestor(), new NullProgressMonitor());
    sourceModule.getBuffer().setContents("module wc_commitWC_Test;");
    sourceModule.commitWorkingCopy(true, new NullProgressMonitor());
    doCodeCompletion(moduleFile, 0, "wc_commitWC_Test/");

    sourceModule.getBuffer().setContents("module wc_commitWC_Test2;");
    sourceModule.commitWorkingCopy(true, new NullProgressMonitor());
    sourceModule.discardWorkingCopy();
    doCodeCompletion(moduleFile, 0, "wc_commitWC_Test2/");
   
    // Test setContents of non-working copy - only valid if sourceModule in buildpath it seems
    if(sourceModule.exists()) {
      sourceModule.getBuffer().setContents("module wc_change3;");
      assertTrue(sourceModule.isWorkingCopy() == false);
      doCodeCompletion(moduleFile, 0, "wc_change3/");
    }
  }
View Full Code Here

  }
 
  // Note: we don't use this method to test code completion, we are test the Working Copies of the server.
  // Code completion is just being used as a convenient way to check the source contents of the server's WCs.
  protected void doCodeCompletion(IFile file, int offset, String... results) throws CoreException {
    ISourceModule sourceModule = DLTKCore.createSourceModuleFrom(file);
    CompletionSearchResult cc = client.runCodeCompletion(sourceModule, offset,
      MockCompilerInstalls.DEFAULT_DMD_INSTALL_EXE_PATH);
    new DefUnitResultsChecker(cc.getResults()).simpleCheckResults(results);
  }
View Full Code Here

    IScriptFolder scriptFolder = getSrcFolder(project, srcFolder).getScriptFolder(pkg);
    return scriptFolder.getSourceModule(module + ".d");
  }
 
  protected static IType getElement(IScriptProject scriptProject, String srcFolder, String pkg, String srcModule) {
    ISourceModule sourceModule = getModule(scriptProject, srcFolder, pkg, srcModule);
    return sourceModule.getType(srcModule);
    //return sourceModule;
  }
View Full Code Here

    final String keyIdentifier = DeeSearchEngineTestUtils.getModelElementFQName(element);
    final SearchRequestorResultCollector requestor = new SearchRequestorResultCollector(){
      @Override
      public void acceptSearchMatch(SearchMatch match) throws CoreException {
        IModelElement refElement = assertInstance(match.getElement(), IModelElement.class);
        ISourceModule module = getSourceModule(refElement);
        checkKey(module, match.getOffset(), keyIdentifier);
       
        if(matchChecker != null) {
          matchChecker.checkMatch(match);
        }
View Full Code Here

    return MiscUtil.createPath(location.toOSString());
  }
 
  @Deprecated
  public static Path getFilePath(IModuleSource moduleSource) throws InvalidPathExceptionX {
    ISourceModule sourceModule = tryCast(moduleSource.getModelElement(), ISourceModule.class);
    if(sourceModule != null) {
      return getFilePath(sourceModule);
    } else {
      return MiscUtil.createPath(moduleSource.getFileName());
    }
View Full Code Here

      return null;
   
    Module module = targetDefUnit.getModuleNode();
    // TODO: would be nice to have test for module == null path
    if(module != null) {
      ISourceModule targetSrcModule = SourceModuleFinder.findModuleUnit(module, scriptProject);
      // TODO: would be nice to have test for targetSrcModule == null path
      // TODO consider out of buildpath scenario
      if(targetSrcModule != null) {
        return findCorrespondingModelElement(targetDefUnit, targetSrcModule);
       
View Full Code Here

 
  public static Path getFilePath(PossibleMatch possibleMatch) {
    Path filePath = null;
   
    // Try alternative path location
    ISourceModule sourceModule = (ISourceModule) possibleMatch.getModelElement();
    filePath = DToolClient_Bad.getFilePathOrNull(sourceModule);
   
    if(filePath == null && possibleMatch.resource != null) {
      IPath location = possibleMatch.resource.getLocation();
      if(location != null) {
View Full Code Here

    if(possibleMatch.parsedUnit == null) {
      return;
    }
   
    DeeModuleDeclaration deeUnit = getDeeModuleDeclaration(possibleMatch.parsedUnit);
    ISourceModule sourceModule = (ISourceModule) possibleMatch.getModelElement();
    Path filePath = getFilePath(possibleMatch);
   
    this.currentPossibleMatch = possibleMatch; // required by addMatch
   
    // Stage 1: collect matches
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.