本文整理汇总了Java中com.intellij.codeInsight.navigation.NavigationGutterIconBuilder.createLineMarkerInfo方法的典型用法代码示例。如果您正苦于以下问题:Java NavigationGutterIconBuilder.createLineMarkerInfo方法的具体用法?Java NavigationGutterIconBuilder.createLineMarkerInfo怎么用?Java NavigationGutterIconBuilder.createLineMarkerInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.navigation.NavigationGutterIconBuilder
的用法示例。
在下文中一共展示了NavigationGutterIconBuilder.createLineMarkerInfo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRelatedFiles
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
@Nullable
private LineMarkerInfo getRelatedFiles(@NotNull PsiFile file, @NotNull String controllerName, @NotNull PsiElement element) {
if (!(element instanceof Method)) {
return null;
}
Method method = (Method)element;
if (!method.getAccess().isPublic()) {
return null;
}
String methodName = method.getName();
PsiDirectory appDir = PsiUtil.getAppDirectoryFromFile(file);
String templatePath = String.format("View/%s/%s.ctp", controllerName, methodName);
VirtualFile relativeFile = VfsUtil.findRelativeFile(appDir, templatePath);
if (relativeFile == null) {
return null;
}
PsiFile targetFile = PsiUtil.convertVirtualFileToPsiFile(method.getProject(), relativeFile);
if (targetFile == null) {
return null;
}
PsiElement targetElement = targetFile.getFirstChild();
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(CakeIcons.LOGO).setTarget(targetElement);
return builder.createLineMarkerInfo(method);
}
示例2: getSingleLineMarker
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
public static RelatedItemLineMarkerInfo<PsiElement> getSingleLineMarker(SmartyFile smartyFile, Collection<LineMarkerInfo> lineMarkerInfos, GotoRelatedItem gotoRelatedItem) {
// hell: find any possible small icon
Icon icon = null;
if(gotoRelatedItem instanceof RelatedPopupGotoLineMarker.PopupGotoRelatedItem) {
icon = ((RelatedPopupGotoLineMarker.PopupGotoRelatedItem) gotoRelatedItem).getSmallIcon();
}
if(icon == null) {
icon = OxidPluginIcons.OXID_LINEMARKER;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(icon).
setTargets(gotoRelatedItem.getElement());
String customName = gotoRelatedItem.getCustomName();
if(customName != null) {
builder.setTooltipText(customName);
}
return builder.createLineMarkerInfo(smartyFile);
}
示例3: getSingleLineMarker
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
public static RelatedItemLineMarkerInfo<PsiElement> getSingleLineMarker(SmartyFile smartyFile, Collection<LineMarkerInfo> lineMarkerInfos, GotoRelatedItem gotoRelatedItem) {
// hell: find any possible small icon
Icon icon = null;
if(gotoRelatedItem instanceof RelatedPopupGotoLineMarker.PopupGotoRelatedItem) {
icon = ((RelatedPopupGotoLineMarker.PopupGotoRelatedItem) gotoRelatedItem).getSmallIcon();
}
if(icon == null) {
icon = ShopwarePluginIcons.SHOPWARE_LINEMARKER;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(icon).
setTargets(gotoRelatedItem.getElement());
String customName = gotoRelatedItem.getCustomName();
if(customName != null) {
builder.setTooltipText(customName);
}
return builder.createLineMarkerInfo(smartyFile);
}
示例4: getFileImplementsLineMarker
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
@Nullable
public static RelatedItemLineMarkerInfo<PsiElement> getFileImplementsLineMarker(@NotNull PsiFile psiFile) {
final Project project = psiFile.getProject();
VirtualFile virtualFile = psiFile.getVirtualFile();
if(virtualFile == null) {
return null;
}
String bundleLocateName = FileResourceUtil.getBundleLocateName(project, virtualFile);
if(bundleLocateName == null) {
return null;
}
if(FileResourceUtil.getFileResourceRefers(project, bundleLocateName).size() == 0) {
return null;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(PhpIcons.IMPLEMENTS).
setTargets(new FileResourceUtil.FileResourceNotNullLazyValue(project, bundleLocateName)).
setTooltipText("Navigate to resource");
return builder.createLineMarkerInfo(psiFile);
}
示例5: attachIncludes
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
private LineMarkerInfo attachIncludes(@NotNull TwigFile twigFile) {
Collection<String> templateNames = TwigUtil.getTemplateNamesForFile(twigFile);
boolean found = false;
for(String templateName: templateNames) {
Project project = twigFile.getProject();
Collection<VirtualFile> containingFiles = FileBasedIndex.getInstance().getContainingFiles(
TwigIncludeStubIndex.KEY, templateName, GlobalSearchScope.getScopeRestrictedByFileTypes(GlobalSearchScope.allScope(project), TwigFileType.INSTANCE)
);
// stop on first target, we load them lazily afterwards
if(containingFiles.size() > 0) {
found = true;
break;
}
}
if(!found) {
return null;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(PhpIcons.IMPLEMENTED)
.setTargets(new MyTemplateIncludeLazyValue(twigFile, templateNames))
.setTooltipText("Navigate to includes")
.setCellRenderer(new MyFileReferencePsiElementListCellRenderer());
return builder.createLineMarkerInfo(twigFile);
}
示例6: attachBlockImplements
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
@Nullable
private LineMarkerInfo attachBlockImplements(@NotNull PsiElement psiElement, @NotNull FileImplementsLazyLoader implementsLazyLoader) {
if(!TwigBlockUtil.hasBlockImplementations(psiElement, implementsLazyLoader)) {
return null;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(PhpIcons.IMPLEMENTED)
.setTargets(new BlockImplementationLazyValue(psiElement))
.setTooltipText("Implementations")
.setCellRenderer(new MyBlockListCellRenderer());
return builder.createLineMarkerInfo(psiElement);
}
示例7: attachBlockOverwrites
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
@Nullable
private LineMarkerInfo attachBlockOverwrites(@NotNull PsiElement psiElement, @NotNull FileOverwritesLazyLoader loader) {
if(!TwigBlockUtil.hasBlockOverwrites(psiElement, loader)) {
return null;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(PhpIcons.OVERRIDES)
.setTargets(new BlockOverwriteLazyValue(psiElement))
.setTooltipText("Overwrites")
.setCellRenderer(new MyBlockListCellRenderer());
return builder.createLineMarkerInfo(psiElement);
}
示例8: getFileImplementsLineMarkerInFolderScope
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
/**
* On route annotations we can have folder scope so: "@FooBundle/Controller/foo.php" can be equal "@FooBundle/Controller/"
*/
@Nullable
public static RelatedItemLineMarkerInfo<PsiElement> getFileImplementsLineMarkerInFolderScope(@NotNull PsiFile psiFile) {
VirtualFile virtualFile = psiFile.getVirtualFile();
if(virtualFile == null) {
return null;
}
final Project project = psiFile.getProject();
String bundleLocateName = FileResourceUtil.getBundleLocateName(project, virtualFile);
if(bundleLocateName == null) {
return null;
}
Set<String> names = new HashSet<>();
names.add(bundleLocateName);
// strip filename
int i = bundleLocateName.lastIndexOf("/");
if(i > 0) {
names.add(bundleLocateName.substring(0, i));
}
int targets = 0;
for (String name : names) {
targets += FileResourceUtil.getFileResourceRefers(project, name).size();
}
if(targets == 0) {
return null;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(PhpIcons.IMPLEMENTS).
setTargets(new FileResourceUtil.FileResourceNotNullLazyValue(project, names)).
setTooltipText("Navigate to resource");
return builder.createLineMarkerInfo(psiFile);
}
示例9: collect
import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; //导入方法依赖的package包/类
@Nullable
public LineMarkerInfo collect(PsiElement psiElement) {
if(!Symfony2ProjectComponent.isEnabled(psiElement) || psiElement.getNode().getElementType() != PhpTokenTypes.IDENTIFIER) {
return null;
}
PsiElement method = psiElement.getParent();
if(!(method instanceof Method) || !((Method) method).getAccess().isPublic()) {
return null;
}
List<GotoRelatedItem> gotoRelatedItems = getGotoRelatedItems((Method) method);
if(gotoRelatedItems.size() == 0) {
return null;
}
// only one item dont need popover
if(gotoRelatedItems.size() == 1) {
GotoRelatedItem gotoRelatedItem = gotoRelatedItems.get(0);
// hell: find any possible small icon
Icon icon = null;
if(gotoRelatedItem instanceof RelatedPopupGotoLineMarker.PopupGotoRelatedItem) {
icon = ((RelatedPopupGotoLineMarker.PopupGotoRelatedItem) gotoRelatedItem).getSmallIcon();
}
if(icon == null) {
icon = Symfony2Icons.SYMFONY_LINE_MARKER;
}
NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(icon).
setTargets(gotoRelatedItems.get(0).getElement());
String customName = gotoRelatedItems.get(0).getCustomName();
if(customName != null) {
builder.setTooltipText(customName);
}
return builder.createLineMarkerInfo(psiElement);
}
return new LineMarkerInfo<>(
psiElement,
psiElement.getTextRange(),
Symfony2Icons.SYMFONY_LINE_MARKER,
6,
new ConstantFunction<>("Related Files"),
new RelatedPopupGotoLineMarker.NavigationHandler(gotoRelatedItems),
GutterIconRenderer.Alignment.RIGHT
);
}