当前位置: 首页>>代码示例>>Java>>正文


Java JBPopup.show方法代码示例

本文整理汇总了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));
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExternalAnnotationsLineMarkerProvider.java

示例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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SliderSelectorAction.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PsiElementListNavigator.java

示例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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ProjectStartupConfigurable.java

示例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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ShowUsagesAction.java

示例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));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:NavigationGutterIconRenderer.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ShowJavadocAction.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaFxRelatedItemLineMarkerProvider.java

示例9: showPopup

import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
public void showPopup(JBPopup popup) {
  popup.show(myPeer.getPreferredPopupPoint());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:AnActionButton.java

示例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)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:LookupImpl.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:FormEditingUtil.java


注:本文中的com.intellij.openapi.ui.popup.JBPopup.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。