com.intellij.psi.impl.source.tree.java.PsiJavaTokenImpl Java Examples
The following examples show how to use
com.intellij.psi.impl.source.tree.java.PsiJavaTokenImpl.
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: SimpleLineMarkerProvider.java From intellij-sdk-docs with Apache License 2.0 | 6 votes |
@Override protected void collectNavigationMarkers( @NotNull PsiElement element, @NotNull Collection< ? super RelatedItemLineMarkerInfo > result ) { // This must be an element with a literal expression as a parent if ( !(element instanceof PsiJavaTokenImpl) || !(element.getParent() instanceof PsiLiteralExpression) ) return; // The literal expression must start with the Simple language literal expression PsiLiteralExpression literalExpression = (PsiLiteralExpression) element.getParent(); String value = literalExpression.getValue() instanceof String ? (String) literalExpression.getValue() : null; if ( ( value == null ) || !value.startsWith( SimpleAnnotator.SIMPLE_PREFIX_STR + SimpleAnnotator.SIMPLE_SEPARATOR_STR ) ) return; // Get the Simple language property usage Project project = element.getProject(); String possibleProperties = value.substring( SimpleAnnotator.SIMPLE_PREFIX_STR.length()+ SimpleAnnotator.SIMPLE_SEPARATOR_STR.length() ); final List<SimpleProperty> properties = SimpleUtil.findProperties( project, possibleProperties ); if ( properties.size() > 0 ) { // Add the property to a collection of line marker info NavigationGutterIconBuilder< PsiElement > builder = NavigationGutterIconBuilder.create( SimpleIcons.FILE ) .setTargets( properties ) .setTooltipText( "Navigate to Simple language property" ); result.add( builder.createLineMarkerInfo( element ) ); } }