public PsiElement resolve() { return new FakePsiElement() { public PsiElement getParent() { return myElement; } @Override public String getName() { return myText; } @Override public void navigate(boolean requestFocus) { BrowserUtil.launchBrowser(myText); } }; }
@Nullable private static String getMavenElementDescription(PsiElement e, DescKind kind, boolean html) { e = getMavenElement(e); if (e == null) return null; if (e instanceof FakePsiElement) { return ((FakePsiElement)e).getPresentableText(); } boolean property = MavenDomUtil.isMavenProperty(e); String type = property ? "Property" : "Model Property"; if (kind == DescKind.TYPE) return type; String name = buildPropertyName(e, property); if (kind == DescKind.NAME) return name; if (kind == DescKind.TYPE_NAME_VALUE) { String br = html ? "<br>" : "\n "; String[] bold = html ? new String[]{"<b>", "</b>"} : new String[]{"", ""}; String valueSuffix = ""; if (e instanceof XmlTag) { valueSuffix = ": " + bold[0] + ((XmlTag)e).getValue().getTrimmedText() + bold[1]; } return type + br + name + valueSuffix; } MavenLog.LOG.error("unexpected desc kind: " + kind); return null; }
@Override public void processElementsWithName(@NotNull String name, @NotNull final Processor<NavigationItem> processor, @NotNull FindSymbolParameters parameters) { StubIndex.getInstance().processElements(UnityScriptIndexKeys.FILE_BY_NAME_INDEX, name, parameters.getProject(), parameters.getSearchScope(), parameters.getIdFilter(), JSFile.class, new Processor<JSFile>() { @Override public boolean process(final JSFile file) { return processor.process(new FakePsiElement() { @Override public String getName() { return FileUtil.getNameWithoutExtension(file.getName()); } @Nullable @Override public Icon getIcon(boolean open) { IconDescriptor descriptor = new IconDescriptor(AllIcons.Nodes.Class); descriptor.addLayerIcon(Unity3dIcons.Js); descriptor.setRightIcon(AllIcons.Nodes.C_public); return descriptor.toIcon(); } @Override public PsiElement getParent() { return file; } }); } }); }