本文整理汇总了Java中com.intellij.ide.util.PsiElementListCellRenderer类的典型用法代码示例。如果您正苦于以下问题:Java PsiElementListCellRenderer类的具体用法?Java PsiElementListCellRenderer怎么用?Java PsiElementListCellRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiElementListCellRenderer类属于com.intellij.ide.util包,在下文中一共展示了PsiElementListCellRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Override
public PsiElementListCellRenderer getRenderer(@NotNull final PsiElement element, @NotNull GotoTargetHandler.GotoData gotoData) {
if (element instanceof PsiMethod) {
return new MethodCellRenderer(gotoData.hasDifferentNames());
}
else if (element instanceof PsiClass) {
return new PsiClassListCellRenderer();
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaGotoTargetRendererProvider.java
示例2: chooseTargetClass
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
private void chooseTargetClass(List<PsiClass> classes, final Editor editor) {
final PsiClass firstClass = classes.get(0);
final Project project = firstClass.getProject();
final JList list = new JBList(classes);
PsiElementListCellRenderer renderer = new PsiClassListCellRenderer();
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(renderer);
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
renderer.installSpeedSearch(builder);
final PsiClass preselection = AnonymousTargetClassPreselectionUtil.getPreselection(classes, firstClass);
if (preselection != null) {
list.setSelectedValue(preselection, true);
}
Runnable runnable = new Runnable() {
@Override
public void run() {
int index = list.getSelectedIndex();
if (index < 0) return;
final PsiClass aClass = (PsiClass) list.getSelectedValue();
AnonymousTargetClassPreselectionUtil.rememberSelection(aClass, firstClass);
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
doInvoke(project, aClass);
}
}, getText(), null);
}
};
builder.
setTitle(QuickFixBundle.message("target.class.chooser.title")).
setItemChoosenCallback(runnable).
createPopup().
showInBestPositionFor(editor);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:CreateFromUsageBaseFix.java
示例3: getRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
private static PsiElementListCellRenderer getRenderer(Object value,
Map<Object, PsiElementListCellRenderer> targetsWithRenderers,
GotoData gotoData) {
PsiElementListCellRenderer renderer = targetsWithRenderers.get(value);
if (renderer == null) {
renderer = gotoData.getRenderer(value);
}
if (renderer != null) {
return renderer;
}
else {
return ourDefaultTargetElementRenderer;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GotoTargetHandler.java
示例4: createRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@NotNull
public static PsiElementListCellRenderer createRenderer(@NotNull GotoData gotoData, @NotNull PsiElement eachTarget) {
PsiElementListCellRenderer renderer = null;
for (GotoTargetRendererProvider eachProvider : Extensions.getExtensions(GotoTargetRendererProvider.EP_NAME)) {
renderer = eachProvider.getRenderer(eachTarget, gotoData);
if (renderer != null) break;
}
if (renderer == null) {
renderer = ourDefaultTargetElementRenderer;
}
return renderer;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GotoTargetHandler.java
示例5: getPsiElementPopup
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@NotNull
public static JBPopup getPsiElementPopup(@NotNull PsiElement[] elements,
@NotNull final PsiElementListCellRenderer<PsiElement> renderer,
final String title) {
return getPsiElementPopup(elements, renderer, title, new PsiElementProcessor<PsiElement>() {
@Override
public boolean execute(@NotNull final PsiElement element) {
Navigatable descriptor = EditSourceUtil.getDescriptor(element);
if (descriptor != null && descriptor.canNavigate()) {
descriptor.navigate(true);
}
return true;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:NavigationUtil.java
示例6: createGutterIconRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
private MyNavigationGutterIconRenderer createGutterIconRenderer(@NotNull final Project project) {
checkBuilt();
NotNullLazyValue<List<SmartPsiElementPointer>> pointers = createPointersThunk(myLazy, project, evaluateAndForget(myTargets),
myConverter);
final boolean empty = isEmpty();
if (myTooltipText == null && !myLazy) {
final SortedSet<String> names = new TreeSet<String>();
for (T t : myTargets.getValue()) {
final String text = myNamer.fun(t);
if (text != null) {
names.add(MessageFormat.format(PATTERN, text));
}
}
@NonNls StringBuilder sb = new StringBuilder("<html><body>");
if (myTooltipTitle != null) {
sb.append(myTooltipTitle).append("<br>");
}
for (String name : names) {
sb.append(name).append("<br>");
}
sb.append("</body></html>");
myTooltipText = sb.toString();
}
Computable<PsiElementListCellRenderer> renderer =
myCellRenderer == null ? new Computable<PsiElementListCellRenderer>() {
@Override
public PsiElementListCellRenderer compute() {
return new DefaultPsiElementCellRenderer();
}
} : myCellRenderer;
return new MyNavigationGutterIconRenderer(this, myAlignment, myIcon, myTooltipText, pointers, renderer, empty);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:NavigationGutterIconBuilder.java
示例7: MyNavigationGutterIconRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
public MyNavigationGutterIconRenderer(@NotNull NavigationGutterIconBuilder builder,
final Alignment alignment,
final Icon icon,
@Nullable final String tooltipText,
@NotNull NotNullLazyValue<List<SmartPsiElementPointer>> pointers,
Computable<PsiElementListCellRenderer> cellRenderer,
boolean empty) {
super(builder.myPopupTitle, builder.myEmptyText, cellRenderer, pointers);
myAlignment = alignment;
myIcon = icon;
myTooltipText = tooltipText;
myEmpty = empty;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:NavigationGutterIconBuilder.java
示例8: NavigationGutterIconRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
protected NavigationGutterIconRenderer(final String popupTitle, final String emptyText, @NotNull Computable<PsiElementListCellRenderer> cellRenderer,
@NotNull NotNullLazyValue<List<SmartPsiElementPointer>> pointers) {
myPopupTitle = popupTitle;
myEmptyText = emptyText;
myCellRenderer = cellRenderer;
myPointers = pointers;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:NavigationGutterIconRenderer.java
示例9: getRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Override
public PsiElementListCellRenderer getRenderer(@NotNull PsiElement element, @NotNull GotoTargetHandler.GotoData gotoData) {
if (element instanceof XmlTagImpl) {
if (SchemaDefinitionsSearch.isTypeElement((XmlTagImpl)element)) {
return new MyRenderer("");
} else if (SchemaDefinitionsSearch.isElementWithSomeEmbeddedType((XmlTagImpl)element)) {
return new MyRenderer("xsd:element: ");
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:GotoXmlSchemaTypeRendererProvider.java
示例10: chooseClass
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
private void chooseClass(List<PsiClass> classes, Editor editor) {
final Project project = classes.get(0).getProject();
final JList list = new JBList(classes);
PsiElementListCellRenderer renderer = new PsiClassListCellRenderer();
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(renderer);
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
renderer.installSpeedSearch(builder);
Runnable runnable = new Runnable() {
@Override
public void run() {
int index = list.getSelectedIndex();
if (index < 0) return;
final PsiClass aClass = (PsiClass)list.getSelectedValue();
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
invokeImpl(project, aClass);
}
});
}
}, getText(), null);
}
};
builder.
setTitle(QuickFixBundle.message("target.class.chooser.title")).
setItemChoosenCallback(runnable).
createPopup().
showInBestPositionFor(editor);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:GrCreateFromUsageBaseFix.java
示例11: getRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Override
public PsiElementListCellRenderer getRenderer(final PsiElement element, GotoTargetHandler.GotoData gotoData) {
if (element instanceof PsiMethod) {
return new MethodCellRenderer(gotoData.hasDifferentNames());
}
else if (element instanceof PsiClass) {
return new PsiClassListCellRenderer();
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:JavaGotoTargetRendererProvider.java
示例12: chooseTargetClass
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
private void chooseTargetClass(List<PsiClass> classes, final Editor editor) {
final Project project = classes.get(0).getProject();
final JList list = new JBList(classes);
PsiElementListCellRenderer renderer = new PsiClassListCellRenderer();
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
list.setCellRenderer(renderer);
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
renderer.installSpeedSearch(builder);
Runnable runnable = new Runnable() {
@Override
public void run() {
int index = list.getSelectedIndex();
if (index < 0) return;
final PsiClass aClass = (PsiClass) list.getSelectedValue();
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
doInvoke(project, aClass);
}
}, getText(), null);
}
};
builder.
setTitle(QuickFixBundle.message("target.class.chooser.title")).
setItemChoosenCallback(runnable).
createPopup().
showInBestPositionFor(editor);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:CreateFromUsageBaseFix.java
示例13: createRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
protected static PsiElementListCellRenderer createRenderer(GotoData gotoData, PsiElement eachTarget) {
PsiElementListCellRenderer renderer = null;
for (GotoTargetRendererProvider eachProvider : Extensions.getExtensions(GotoTargetRendererProvider.EP_NAME)) {
renderer = eachProvider.getRenderer(eachTarget, gotoData);
if (renderer != null) break;
}
if (renderer == null) {
renderer = ourDefaultTargetElementRenderer;
}
return renderer;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:GotoTargetHandler.java
示例14: getRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Override
public PsiElementListCellRenderer getRenderer(PsiElement element, GotoTargetHandler.GotoData gotoData) {
if (element instanceof XmlTagImpl) {
if (SchemaDefinitionsSearch.isTypeElement((XmlTagImpl)element)) {
return new MyRenderer("");
} else if (SchemaDefinitionsSearch.isElementWithSomeEmbeddedType((XmlTagImpl)element)) {
return new MyRenderer("xsd:element: ");
}
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:GotoXmlSchemaTypeRendererProvider.java
示例15: getRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Nonnull
private PsiElementListCellRenderer getRenderer(Object value,
Map<Object, PsiElementListCellRenderer> targetsWithRenderers,
GotoData gotoData) {
PsiElementListCellRenderer renderer = targetsWithRenderers.get(value);
if (renderer == null) {
renderer = gotoData.getRenderer(value);
}
return renderer != null ? renderer : myDefaultTargetElementRenderer;
}
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:GotoTargetHandler.java
示例16: createRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
public static PsiElementListCellRenderer createRenderer(@Nonnull GotoData gotoData, @Nonnull PsiElement eachTarget) {
PsiElementListCellRenderer renderer = null;
for (GotoTargetRendererProvider eachProvider : Extensions.getExtensions(GotoTargetRendererProvider.EP_NAME)) {
renderer = eachProvider.getRenderer(eachTarget, gotoData);
if (renderer != null) break;
}
return renderer;
}
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:GotoTargetHandler.java
示例17: getPsiElementPopup
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Nonnull
public static JBPopup getPsiElementPopup(@Nonnull PsiElement[] elements, @Nonnull final PsiElementListCellRenderer<PsiElement> renderer, final String title) {
return getPsiElementPopup(elements, renderer, title, new PsiElementProcessor<PsiElement>() {
@Override
public boolean execute(@Nonnull final PsiElement element) {
Navigatable descriptor = EditSourceUtil.getDescriptor(element);
if (descriptor != null && descriptor.canNavigate()) {
descriptor.navigate(true);
}
return true;
}
});
}
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:NavigationUtil.java
示例18: MyNavigationGutterIconRenderer
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
public MyNavigationGutterIconRenderer(@Nonnull NavigationGutterIconBuilder builder,
final Alignment alignment,
final Icon icon,
@Nullable final String tooltipText,
@Nonnull NotNullLazyValue<List<SmartPsiElementPointer>> pointers,
Computable<PsiElementListCellRenderer> cellRenderer,
boolean empty) {
super(builder.myPopupTitle, builder.myEmptyText, cellRenderer, pointers);
myAlignment = alignment;
myIcon = icon;
myTooltipText = tooltipText;
myEmpty = empty;
}
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:NavigationGutterIconBuilder.java
示例19: calcElementRender
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
@Nullable
private static PsiElementListCellRenderer<PsiElement> calcElementRender(@Nullable GotoDeclarationHandler declarationHandler, @Nonnull PsiElement[] elements) {
if(declarationHandler instanceof GotoDeclarationHandlerEx) {
return ((GotoDeclarationHandlerEx)declarationHandler).createRender(elements);
}
return null;
}
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:GotoDeclarationAction.java
示例20: chooseAmbiguousTarget
import com.intellij.ide.util.PsiElementListCellRenderer; //导入依赖的package包/类
private static void chooseAmbiguousTarget(final Editor editor, int offset, PsiElement[] elements, @Nullable PsiElementListCellRenderer<PsiElement> render) {
PsiElementProcessor<PsiElement> navigateProcessor = new PsiElementProcessor<PsiElement>() {
@Override
public boolean execute(@Nonnull final PsiElement element) {
gotoTargetElement(element);
return true;
}
};
boolean found = chooseAmbiguousTarget(editor, offset, navigateProcessor, CodeInsightBundle.message("declaration.navigation.title"), elements, render);
if (!found) {
HintManager.getInstance().showErrorHint(editor, "Cannot find declaration to go to");
}
}
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:GotoDeclarationAction.java
注:本文中的com.intellij.ide.util.PsiElementListCellRenderer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论