• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StubBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.psi.StubBuilder的典型用法代码示例。如果您正苦于以下问题:Java StubBuilder类的具体用法?Java StubBuilder怎么用?Java StubBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StubBuilder类属于com.intellij.psi包,在下文中一共展示了StubBuilder类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doTest

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
public void doTest() throws Exception {
  final List<String> data = TestUtils.readInput(getTestDataPath() + "/" + getTestName(true) + ".test");
  String fileText = data.get(0);

  PsiFile psiFile = TestUtils.createPseudoPhysicalGroovyFile(getProject(), fileText);

  ASTNode node = psiFile.getNode();
  Assert.assertNotNull(node);
  IElementType type = node.getElementType();
  Assert.assertTrue(type instanceof IStubFileElementType);

  IStubFileElementType stubFileType = (IStubFileElementType) type;
  StubBuilder builder = stubFileType.getBuilder();
  StubElement element = builder.buildStubTree(psiFile);
  StringBuffer buffer = new StringBuffer();
  getStubsTreeImpl(element, buffer, "");
  String stubTree = buffer.toString().trim();
  assertEquals(data.get(1), stubTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StubsTest.java


示例2: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder()
{
	return new DefaultStubBuilder()
	{
		@NotNull
		@Override
		protected StubElement createStubForFile(@NotNull PsiFile file)
		{
			if(file instanceof CSharpFileImpl)
			{
				return new CSharpFileStub((CSharpFileImpl) file);
			}
			return super.createStubForFile(file);
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:18,代码来源:CSharpFileStubElementType.java


示例3: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder()
{
	return new DefaultStubBuilder()
	{
		@NotNull
		@Override
		protected StubElement createStubForFile(@NotNull PsiFile file)
		{
			if(file instanceof MsilFile)
			{
				return new MsilFileStub((MsilFile) file);
			}
			return super.createStubForFile(file);
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:18,代码来源:MsilFileStubElementType.java


示例4: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder()
{
	return new DefaultStubBuilder()
	{
		@NotNull
		@Override
		protected StubElement createStubForFile(@NotNull PsiFile file)
		{
			if(file instanceof JSFile)
			{
				return new JSFileStubImpl((JSFile) file, file.getName());
			}
			return super.createStubForFile(file);
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:18,代码来源:JSFileElementType.java


示例5: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
    return new DefaultStubBuilder() {
        @NotNull
        @Override
        protected StubElement createStubForFile(@NotNull PsiFile file) {
            if (file instanceof RmlFile) {
                return new RmlFileStub((RmlFile) file);
            }
            return super.createStubForFile(file);
        }
    };
}
 
开发者ID:reasonml-editor,项目名称:reasonml-idea-plugin,代码行数:14,代码来源:RmlFileStubElementType.java


示例6: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
  return new DefaultStubBuilder() {
    @Override
    protected StubElement createStubForFile(@NotNull PsiFile file) {
      return new FileStub((SoyFile) file);
    }
  };
}
 
开发者ID:google,项目名称:bamboo-soy,代码行数:10,代码来源:FileStub.java


示例7: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
    return new DefaultStubBuilder() {
        @NotNull
        @Override
        protected StubElement createStubForFile(@NotNull PsiFile file) {
            return new FusionFileStub((FusionFile) file);
        }
    };
}
 
开发者ID:cvette,项目名称:intellij-neos,代码行数:11,代码来源:FusionFileStub.java


示例8: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
    return new DefaultStubBuilder() {
        @Override
        protected StubElement createStubForFile(@NotNull PsiFile file) {
            return new FileStub((ProtoPsiFileRoot) file);
        }
    };
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:10,代码来源:FileStub.java


示例9: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
  return new DefaultStubBuilder() {
    @NotNull
    @Override
    protected StubElement createStubForFile(@NotNull final PsiFile file) {
      if (file instanceof GroovyFile) {
        return new GrFileStub((GroovyFile)file);
      }

      return super.createStubForFile(file);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GrStubFileElementType.java


示例10: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
  return new DefaultStubBuilder() {
    @NotNull
    @Override
    protected StubElement createStubForFile(@NotNull PsiFile file) {
      if (file instanceof SchemaFile) {
        SchemaFile schemaFile = (SchemaFile) file;
        Qn namespace = NamespaceManager.getNamespace(schemaFile);
        return new SchemaFileStubImpl(schemaFile, StringRef.fromNullableString(namespace == null ? null : namespace.toString()));
      } else return super.createStubForFile(file);
    }
  };
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:15,代码来源:SchemaFileElementType.java


示例11: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
    return new DefaultStubBuilder() {
        @NotNull
        @Override
        protected StubElement createStubForFile(@NotNull PsiFile file) {
            if (file instanceof HaskellFile) {
                return new HaskellFileStub((HaskellFile)file);
            }
            return super.createStubForFile(file);
        }
    };
}
 
开发者ID:carymrobbins,项目名称:intellij-haskforce,代码行数:14,代码来源:HaskellFileStubElementType.java


示例12: skipNode

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static boolean skipNode(@NotNull StubBuilder builder, @NotNull ASTNode parent, @NotNull ASTNode node) {
  if (builder instanceof DefaultStubBuilder) {
    return ((DefaultStubBuilder)builder).skipChildProcessingWhenBuildingStubs(parent, node);
  }
  else if (builder instanceof LightStubBuilder) {
    return ((LightStubBuilder)builder).skipChildProcessingWhenBuildingStubs(parent, node);
  }
  else {
    return builder.skipChildProcessingWhenBuildingStubs(parent, node.getElementType());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:TreeUtil.java


示例13: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
public StubBuilder getBuilder() {
  return new DefaultStubBuilder() {
    protected StubElement createStubForFile(@NotNull final PsiFile file) {
      if (file instanceof GroovyFile) {
        return new GrFileStub((GroovyFile)file);
      }

      return super.createStubForFile(file);
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:GrStubFileElementType.java


示例14: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
    return new LuaFileStubBuilder();
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:5,代码来源:LuaStubFileElementType.java


示例15: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
public StubBuilder getBuilder() {
  return new DefaultStubBuilder();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:IStubFileElementType.java


示例16: buildStubTree

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Nullable
public static Stub buildStubTree(final FileContent inputData) {
  Stub data = inputData.getUserData(stubElementKey);
  if (data != null) return data;

  //noinspection SynchronizationOnLocalVariableOrMethodParameter
  synchronized (inputData) {
    data = inputData.getUserData(stubElementKey);
    if (data != null) return data;

    final FileType fileType = inputData.getFileType();

    final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
    if (builder != null) {
      data = builder.buildStubTree(inputData);
      if (data instanceof PsiFileStubImpl && !((PsiFileStubImpl)data).rootsAreSet()) {
        ((PsiFileStubImpl)data).setStubRoots(new PsiFileStub[]{(PsiFileStubImpl)data});
      }
    }
    else {
      CharSequence contentAsText = inputData.getContentAsText();
      FileContentImpl fileContent = (FileContentImpl)inputData;
      PsiFile psi = fileContent.getPsiFileForPsiDependentIndex();
      final FileViewProvider viewProvider = psi.getViewProvider();
      psi = viewProvider.getStubBindingRoot();
      psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, contentAsText);

      // if we load AST, it should be easily gc-able. See PsiFileImpl.createTreeElementPointer()
      psi.getManager().startBatchFilesProcessingMode();

      try {
        IStubFileElementType stubFileElementType = ((PsiFileImpl)psi).getElementTypeForStubBuilder();
        if (stubFileElementType != null) {
          final StubBuilder stubBuilder = stubFileElementType.getBuilder();
          if (stubBuilder instanceof LightStubBuilder) {
            LightStubBuilder.FORCED_AST.set(fileContent.getLighterASTForPsiDependentIndex());
          }
          data = stubBuilder.buildStubTree(psi);

          final List<Pair<IStubFileElementType, PsiFile>> stubbedRoots = getStubbedRoots(viewProvider);
          final List<PsiFileStub> stubs = new ArrayList<PsiFileStub>(stubbedRoots.size());
          stubs.add((PsiFileStub)data);

          for (Pair<IStubFileElementType, PsiFile> stubbedRoot : stubbedRoots) {
            final PsiFile secondaryPsi = stubbedRoot.second;
            if (psi == secondaryPsi) continue;
            final StubBuilder stubbedRootBuilder = stubbedRoot.first.getBuilder();
            if (stubbedRootBuilder instanceof LightStubBuilder) {
              LightStubBuilder.FORCED_AST.set(new TreeBackedLighterAST(secondaryPsi.getNode()));
            }
            final StubElement element = stubbedRootBuilder.buildStubTree(secondaryPsi);
            if (element instanceof PsiFileStub) {
              stubs.add((PsiFileStub)element);
            }
          }
          final PsiFileStub[] stubsArray = stubs.toArray(new PsiFileStub[stubs.size()]);
          for (PsiFileStub stub : stubsArray) {
            if (stub instanceof PsiFileStubImpl) {
              ((PsiFileStubImpl)stub).setStubRoots(stubsArray);
            }
          }
        }
      }
      finally {
        psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, null);
        psi.getManager().finishBatchFilesProcessingMode();
      }
    }

    inputData.putUserData(stubElementKey, data);
    return data;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:74,代码来源:StubTreeBuilder.java


示例17: getBuilder

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Override
public StubBuilder getBuilder() {
  return new PyFileStubBuilder();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PyFileElementType.java


示例18: buildStubTree

import com.intellij.psi.StubBuilder; //导入依赖的package包/类
@Nullable
@RequiredReadAction
public static Stub buildStubTree(final FileContent inputData) {
  Stub data = inputData.getUserData(stubElementKey);
  if (data != null) return data;

  //noinspection SynchronizationOnLocalVariableOrMethodParameter
  synchronized (inputData) {
    data = inputData.getUserData(stubElementKey);
    if (data != null) return data;

    final FileType fileType = inputData.getFileType();

    final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
    if (builder != null) {
      data = builder.buildStubTree(inputData);
      if (data instanceof PsiFileStubImpl && !((PsiFileStubImpl)data).rootsAreSet()) {
        ((PsiFileStubImpl)data).setStubRoots(new PsiFileStub[]{(PsiFileStubImpl)data});
      }
    }
    else {
      CharSequence contentAsText = inputData.getContentAsText();
      FileContentImpl fileContent = (FileContentImpl)inputData;
      PsiFile psi = fileContent.getPsiFileForPsiDependentIndex();
      final FileViewProvider viewProvider = psi.getViewProvider();
      psi = viewProvider.getStubBindingRoot();
      psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, contentAsText);

      // if we load AST, it should be easily gc-able. See PsiFileImpl.createTreeElementPointer()
      psi.getManager().startBatchFilesProcessingMode();

      try {
        IStubFileElementType stubFileElementType = ((PsiFileImpl)psi).getElementTypeForStubBuilder();
        if (stubFileElementType != null) {
          final StubBuilder stubBuilder = stubFileElementType.getBuilder();
          if (stubBuilder instanceof LightStubBuilder) {
            LightStubBuilder.FORCED_AST.set(fileContent.getLighterASTForPsiDependentIndex());
          }
          data = stubBuilder.buildStubTree(psi);

          final List<Pair<IStubFileElementType, PsiFile>> stubbedRoots = getStubbedRoots(viewProvider);
          final List<PsiFileStub> stubs = new ArrayList<PsiFileStub>(stubbedRoots.size());
          stubs.add((PsiFileStub)data);

          for (Pair<IStubFileElementType, PsiFile> stubbedRoot : stubbedRoots) {
            final PsiFile secondaryPsi = stubbedRoot.second;
            if (psi == secondaryPsi) continue;
            final StubBuilder stubbedRootBuilder = stubbedRoot.first.getBuilder();
            if (stubbedRootBuilder instanceof LightStubBuilder) {
              LightStubBuilder.FORCED_AST.set(new TreeBackedLighterAST(secondaryPsi.getNode()));
            }
            final StubElement element = stubbedRootBuilder.buildStubTree(secondaryPsi);
            if (element instanceof PsiFileStub) {
              stubs.add((PsiFileStub)element);
            }
          }
          final PsiFileStub[] stubsArray = stubs.toArray(new PsiFileStub[stubs.size()]);
          for (PsiFileStub stub : stubsArray) {
            if (stub instanceof PsiFileStubImpl) {
              ((PsiFileStubImpl)stub).setStubRoots(stubsArray);
            }
          }
        }
      }
      finally {
        psi.putUserData(IndexingDataKeys.FILE_TEXT_CONTENT_KEY, null);
        psi.getManager().finishBatchFilesProcessingMode();
      }
    }

    inputData.putUserData(stubElementKey, data);
    return data;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:75,代码来源:StubTreeBuilder.java



注:本文中的com.intellij.psi.StubBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TypedRegion类代码示例发布时间:2022-05-21
下一篇:
Java Controller类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap