本文整理汇总了Java中com.intellij.openapi.ui.popup.JBPopup.show方法的典型用法代码示例。如果您正苦于以下问题:Java JBPopup.show方法的具体用法?Java JBPopup.show怎么用?Java JBPopup.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.ui.popup.JBPopup
的用法示例。
在下文中一共展示了JBPopup.show方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: navigate
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void navigate(MouseEvent e, PsiElement nameIdentifier) {
final PsiElement listOwner = nameIdentifier.getParent();
final PsiFile containingFile = listOwner.getContainingFile();
final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(listOwner);
if (virtualFile != null && containingFile != null) {
final Project project = listOwner.getProject();
final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
if (editor != null) {
editor.getCaretModel().moveToOffset(nameIdentifier.getTextOffset());
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file != null && virtualFile.equals(file.getVirtualFile())) {
final JBPopup popup = createActionGroupPopup(containingFile, project, editor);
if (popup != null) {
popup.show(new RelativePoint(e));
}
}
}
}
}
示例2: show
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
protected void show(AnActionEvent e, JPanel result, JBPopup popup, InputEvent inputEvent) {
if (inputEvent instanceof MouseEvent) {
int width = result.getPreferredSize().width;
MouseEvent inputEvent1 = (MouseEvent)inputEvent;
Point point1 = new Point(inputEvent1.getX() - width / 2, inputEvent1.getY());
RelativePoint point = new RelativePoint(inputEvent1.getComponent(), point1);
popup.show(point);
} else {
popup.showInBestPositionFor(e.getDataContext());
}
}
示例3: openTargets
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
public static void openTargets(MouseEvent e,
NavigatablePsiElement[] targets,
String title,
final String findUsagesTitle,
ListCellRenderer listRenderer,
@Nullable ListBackgroundUpdaterTask listUpdaterTask) {
JBPopup popup = navigateOrCreatePopup(targets, title, findUsagesTitle, listRenderer, listUpdaterTask);
if (popup != null) popup.show(new RelativePoint(e));
}
示例4: showPopup
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
private void showPopup(AnActionButton button, JBPopup popup) {
final RelativePoint point = button.getPreferredPopupPoint();
if (point != null) {
popup.show(point);
} else {
popup.showInCenterOf(myDecorator.getActionsPanel());
}
}
示例5: showPopupIfNeedTo
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
private static boolean showPopupIfNeedTo(@NotNull JBPopup popup, @NotNull RelativePoint popupPosition) {
if (!popup.isDisposed() && !popup.isVisible()) {
popup.show(popupPosition);
return true;
}
else {
return false;
}
}
示例6: navigate
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void navigate(@Nullable final MouseEvent event, @Nullable final PsiElement elt) {
final List<PsiElement> list;
DumbService dumbService = elt != null ? DumbService.getInstance(elt.getProject()) : null;
if (dumbService != null) dumbService.setAlternativeResolveEnabled(true);
try {
list = getTargetElements();
}
finally {
if (dumbService != null) dumbService.setAlternativeResolveEnabled(false);
}
if (list.isEmpty()) {
if (myEmptyText != null) {
if (event != null) {
final JComponent label = HintUtil.createErrorLabel(myEmptyText);
label.setBorder(IdeBorderFactory.createEmptyBorder(2, 7, 2, 7));
JBPopupFactory.getInstance().createBalloonBuilder(label)
.setFadeoutTime(3000)
.setFillColor(HintUtil.ERROR_COLOR)
.createBalloon()
.show(new RelativePoint(event), Balloon.Position.above);
}
}
return;
}
if (list.size() == 1) {
PsiNavigateUtil.navigate(list.iterator().next());
}
else {
if (event != null) {
final JBPopup popup = NavigationUtil.getPsiElementPopup(PsiUtilCore.toPsiElementArray(list), myCellRenderer.compute(), myPopupTitle);
popup.show(new RelativePoint(event));
}
}
}
示例7: actionPerformed
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
int selectedRow = myAttributesTable.getSelectedRow();
int selectedColumn = myAttributesTable.getSelectedColumn();
Object selectedItem = myAttributesTable.getValueAt(selectedRow, selectedColumn);
if (selectedItem == null || !(selectedItem instanceof EditedStyleItem)) {
// We can not display javadoc for this item.
return;
}
EditedStyleItem item = (EditedStyleItem)selectedItem;
Project project = e.getProject();
DocumentationManager documentationManager = DocumentationManager.getInstance(project);
final DocumentationComponent docComponent = new DocumentationComponent(documentationManager);
String tooltip = ThemeEditorUtils.generateToolTipText(item.getItemResourceValue(), myContext.getCurrentThemeModule(), myContext.getConfiguration());
docComponent.setText(tooltip, e.getData(CommonDataKeys.PSI_FILE), true);
JBPopup hint = JBPopupFactory.getInstance().createComponentPopupBuilder(docComponent, docComponent).setProject(project)
.setDimensionServiceKey(project, DocumentationManager.JAVADOC_LOCATION_AND_SIZE, false).setResizable(true).setMovable(true)
.setRequestFocus(true).setTitle(item.getName()).setCancelCallback(new Computable<Boolean>() {
@Override
public Boolean compute() {
Disposer.dispose(docComponent);
return Boolean.TRUE;
}
}).createPopup();
docComponent.setHint(hint);
Disposer.register(hint, docComponent);
hint.show(new RelativePoint(myAttributesTable.getParent(), ORIGIN));
}
示例8: navigate
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void navigate(MouseEvent e, PsiField field) {
final ArrayList<PsiElement> relatedItems = new ArrayList<PsiElement>();
collectTargets(field, relatedItems, Function.ID, false);
if (relatedItems.size() == 1) {
NavigationUtil.activateFileWithPsiElement(relatedItems.get(0));
return;
}
final JBPopup popup = NavigationUtil
.getPsiElementPopup(relatedItems.toArray(new PsiElement[relatedItems.size()]), "<html>Choose component with fx:id <b>" + field.getName() + "<b></html>");
popup.show(new RelativePoint(e));
}
示例9: showPopup
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
public void showPopup(JBPopup popup) {
popup.show(myPeer.getPreferredPopupPoint());
}
示例10: showItemPopup
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void showItemPopup(JBPopup hint) {
final Rectangle bounds = getCurrentItemBounds();
hint.show(new RelativePoint(getComponent(), new Point(bounds.x + bounds.width, bounds.y)));
}
示例11: showPopupUnderComponent
import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
public static void showPopupUnderComponent(final JBPopup popup, final RadComponent selectedComponent) {
// popup.showUnderneathOf() doesn't work on invisible components
Rectangle rc = selectedComponent.getBounds();
Point pnt = new Point(rc.x, rc.y + rc.height);
popup.show(new RelativePoint(selectedComponent.getDelegee().getParent(), pnt));
}