public void testPointerSpecType() {
   myFixture.configureByText(
       "foo.go", "package main; type a struct{};" + "func main() {q1, q2:=&a{};q<caret>}");
   myFixture.completeBasic();
   LookupElement first = ArrayUtil.getFirstElement(myFixture.getLookupElements());
   assertNotNull(first);
   LookupElementPresentation presentation = new LookupElementPresentation();
   first.renderElement(presentation);
   assertEquals("*main.a", presentation.getTypeText());
 }
Exemplo n.º 2
0
 private static void addAttributesBefore(XmlTag tag, List<Pair<String, String>> attr2value) {
   XmlAttribute firstAttribute = ArrayUtil.getFirstElement(tag.getAttributes());
   XmlElementFactory factory = XmlElementFactory.getInstance(tag.getProject());
   for (Pair<String, String> pair : attr2value) {
     XmlAttribute xmlAttribute = factory.createXmlAttribute(pair.first, "");
     if (firstAttribute != null) {
       tag.addBefore(xmlAttribute, firstAttribute);
     } else {
       tag.add(xmlAttribute);
     }
   }
 }
  @Nullable
  private static PsiDirectory tryNotNullizeDirectory(
      @NotNull Project project, @Nullable PsiDirectory defaultTargetDirectory) {
    if (defaultTargetDirectory == null) {
      VirtualFile root =
          ArrayUtil.getFirstElement(ProjectRootManager.getInstance(project).getContentRoots());
      if (root == null) root = project.getBaseDir();
      if (root == null) root = VfsUtil.getUserHomeDir();
      defaultTargetDirectory =
          root != null ? PsiManager.getInstance(project).findDirectory(root) : null;

      if (defaultTargetDirectory == null) {
        LOG.warn("No directory found for project: " + project.getName() + ", root: " + root);
      }
    }
    return defaultTargetDirectory;
  }
 @Nullable
 private static Module getSingleModule(Project project) {
   return ArrayUtil.getFirstElement(ModuleManager.getInstance(project).getModules());
 }
 @Nullable
 public static AndroidMavenProvider getMavenProvider() {
   return ArrayUtil.getFirstElement(AndroidMavenProvider.EP_NAME.getExtensions());
 }
Exemplo n.º 6
0
 public PsiReference getReference() {
   return ArrayUtil.getFirstElement(getReferences());
 }