Java Code Examples for com.intellij.codeInsight.lookup.LookupElementPresentation#setTypeText()

The following examples show how to use com.intellij.codeInsight.lookup.LookupElementPresentation#setTypeText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoctrineModelFieldLookupElement.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    super.renderElement(presentation);

    presentation.setItemTextBold(withBoldness);
    presentation.setIcon(Symfony2Icons.DOCTRINE);
    presentation.setTypeGrayed(true);

    if(this.doctrineModelField.getTypeName() != null) {
        presentation.setTypeText(this.doctrineModelField.getTypeName());
    }

    if(this.doctrineModelField.getRelationType() != null) {
        presentation.setTailText(String.format("(%s)", this.doctrineModelField.getRelationType()), true);
    }

    if(this.doctrineModelField.getRelation() != null) {
        presentation.setTypeText(this.doctrineModelField.getRelation());
        presentation.setIcon(PhpIcons.CLASS_ICON);
    }

}
 
Example 2
Source File: JsonParseUtil.java    From idea-php-toolbox with MIT License 6 votes vote down vote up
public static void decorateLookupElement(@NotNull LookupElementPresentation lookupElement, @NotNull JsonRawLookupElement jsonLookup) {

        if(jsonLookup.getTailText() != null) {
            lookupElement.setTailText(jsonLookup.getTailText(), true);
        }

        if(jsonLookup.getTypeText() != null) {
            lookupElement.setTypeText(jsonLookup.getTypeText());
            lookupElement.setTypeGrayed(true);
        }

        String iconString = jsonLookup.getIcon();
        if(iconString != null) {
            Icon icon = getLookupIconOnString(iconString);
            if(icon != null) {
                lookupElement.setIcon(icon);
            }
        }

    }
 
Example 3
Source File: DoctrineEntityLookupElement.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {

        if(this.useClassNameAsLookupString) {
            presentation.setItemText(className.getPresentableFQN());
            presentation.setTypeText(getLookupString());
        } else {
            presentation.setItemText(getLookupString());
            presentation.setTypeText(className.getPresentableFQN());
        }

        presentation.setTypeGrayed(true);
        if(isWeak) {
            // @TODO: remove weak
            presentation.setIcon(getWeakIcon());
        } else {
            presentation.setIcon(getIcon());
        }


    }
 
Example 4
Source File: RouteLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(route.getController());
    presentation.setTypeGrayed(true);
    presentation.setIcon(!this.isWeak ? Symfony2Icons.ROUTE : Symfony2Icons.ROUTE_WEAK);

    formatTail(presentation);
}
 
Example 5
Source File: Suggestion.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
public void renderElement(LookupElement element, LookupElementPresentation presentation) {
  Suggestion suggestion = (Suggestion) element.getObject();
  if (suggestion.icon != null) {
    presentation.setIcon(suggestion.icon);
  }

  presentation.setStrikeout(suggestion.deprecationLevel != null);
  if (suggestion.deprecationLevel != null) {
    if (suggestion.deprecationLevel == SpringConfigurationMetadataDeprecationLevel.error) {
      presentation.setItemTextForeground(RED);
    } else {
      presentation.setItemTextForeground(YELLOW);
    }
  }

  String lookupString = element.getLookupString();
  presentation.setItemText(lookupString);
  if (!lookupString.equals(suggestion.suggestionToDisplay)) {
    presentation.setItemTextBold(true);
  }

  String shortDescription;
  if (suggestion.defaultValue != null) {
    shortDescription = shortenTextWithEllipsis(suggestion.defaultValue, 60, 0, true);
    TextAttributes attrs =
        EditorColorsManager.getInstance().getGlobalScheme().getAttributes(SCALAR_TEXT);
    presentation.setTailText("=" + shortDescription, attrs.getForegroundColor());
  }

  if (suggestion.description != null) {
    presentation
        .appendTailText(" (" + getFirstSentenceWithoutDot(suggestion.description) + ")",
            true);
  }

  if (suggestion.shortType != null) {
    presentation.setTypeText(suggestion.shortType);
  }
}
 
Example 6
Source File: ExistLangFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(title);
    ImageIcon icon = new ImageIcon(this.getClass().getResource("/com/yiistorm/images/yii.png"));
    presentation.setIcon(icon);
    presentation.setTypeText(createTitle);
    presentation.setTypeGrayed(false);
}
 
Example 7
Source File: SymfonyBundleFileLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(this.bundleFile.getSymfonyBundle().getName());
    presentation.setTypeGrayed(true);
    presentation.setIcon(IconUtil.getIcon(this.bundleFile.getVirtualFile(), 0, this.bundleFile.getProject()));

}
 
Example 8
Source File: AssetLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {

    String typeText = "Web";
    if(assetFile.getAssetPosition().equals(AssetEnum.Position.Bundle)) {
        typeText = "Bundle";
    }

    presentation.setItemText(assetFile.toString());
    presentation.setTypeText(typeText);
    presentation.setIcon(IconUtil.getIcon(assetFile.getFile(), 0, project));

}
 
Example 9
Source File: ExistFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(title);
    ImageIcon icon = new ImageIcon(this.getClass().getResource("/com/yiistorm/images/yii.png"));
    presentation.setIcon(icon);
    presentation.setTypeText(createTitle);
    presentation.setTypeGrayed(false);
}
 
Example 10
Source File: NewFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(this.lookupString);
    presentation.setIcon(PlatformIcons.ADD_ICON);
    presentation.setTypeText(createTitle);
    presentation.setTailText(".php");
    presentation.setTypeGrayed(false);
}
 
Example 11
Source File: ServiceStringLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeGrayed(true);

    String className = getClassName(containerService);
    if(className != null) {
        presentation.setTypeText(StringUtils.strip(className, "\\"));
    }

    // private or non container services
    if(className == null || containerService.isWeak()) {
        presentation.setIcon(Symfony2Icons.SERVICE_OPACITY);
    } else {
        presentation.setIcon(Symfony2Icons.SERVICE);
    }

    if(this.containerService.isPrivate()) {
        presentation.setIcon(Symfony2Icons.SERVICE_PRIVATE_OPACITY);
    }

    presentation.setItemTextBold(this.boldText);
    if(this.boldText) {
        presentation.setTypeGrayed(false);
        presentation.setItemTextUnderlined(true);
    }

    if(containerService.getService() != null) {
        presentation.setStrikeout(containerService.getService().isDeprecated());
    }
}
 
Example 12
Source File: PostfixTemplateLookupElement.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
  super.renderElement(presentation);
  if (sudden) {
    presentation.setTailText(" " + UIUtil.rightArrow() + " " + myTemplate.getExample());
  }
  else {
    presentation.setTypeText(myTemplate.getExample());
    presentation.setTypeGrayed(true);
  }
}
 
Example 13
Source File: NewArrayValueLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(insertString);
    presentation.setIcon(PlatformIcons.ADD_ICON);
    presentation.setTypeText(createTitle);
    presentation.setTailText(".php");
    presentation.setTypeGrayed(false);
}
 
Example 14
Source File: GLSLCompletionContributor.java    From glsl4idea with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    super.renderElement(presentation);
    presentation.setIcon(GLSLSupportLoader.GLSL.getIcon());

    if (type != null) {
        presentation.setTypeText(this.type.getTypename());
    }
}
 
Example 15
Source File: ContainerLookupElement.java    From silex-idea-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {

        presentation.setItemText(getLookupString());
        presentation.setTypeText("Pimple");
        presentation.setIcon(Icons.Container);
    }
 
Example 16
Source File: ConfigComponentLookupElement.java    From yiistorm with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(title);
    presentation.setIcon(icon);
    presentation.setTypeText("application component");
    presentation.setTypeGrayed(false);
}
 
Example 17
Source File: DoctrineTypeLookup.java    From idea-php-symfony2-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setIcon(Symfony2Icons.DOCTRINE);
    presentation.setTypeText("Doctrine");
    presentation.setTypeGrayed(true);
}
 
Example 18
Source File: ServiceLookupElement.java    From silex-idea-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {

        presentation.setItemText(getLookupString());
        presentation.setTypeText(service.getClassName().substring(1));
        presentation.setIcon(Icons.Service);
    }
 
Example 19
Source File: TemplateLookupRenderer.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void renderElement(final LookupItem item, final Template element, final LookupElementPresentation presentation) {
  presentation.setItemText(element.getKey());
  presentation.setTypeText(element.getDescription());
}
 
Example 20
Source File: SpecLookupElement.java    From litho with Apache License 2.0 4 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
  super.renderElement(presentation);
  presentation.setTypeText("Litho");
  presentation.setTypeGrayed(true);
}