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


Java JBPopup.showCenteredInCurrentWindow方法代码示例

本文整理汇总了Java中com.intellij.openapi.ui.popup.JBPopup.showCenteredInCurrentWindow方法的典型用法代码示例。如果您正苦于以下问题:Java JBPopup.showCenteredInCurrentWindow方法的具体用法?Java JBPopup.showCenteredInCurrentWindow怎么用?Java JBPopup.showCenteredInCurrentWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.ui.popup.JBPopup的用法示例。


在下文中一共展示了JBPopup.showCenteredInCurrentWindow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  Disposable disposable = Disposer.newDisposable();
  NewRecentProjectPanel panel = new NewRecentProjectPanel(disposable);
  JList list = UIUtil.findComponentOfType(panel, JList.class);
  JBPopup popup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, list)
    .setTitle("Recent Projects")
    .setFocusable(true)
    .setRequestFocus(true)
    .setMayBeParent(true)
    .setMovable(true)
    .createPopup();
  Disposer.register(popup, disposable);
  Project project = e.getRequiredData(CommonDataKeys.PROJECT);
  popup.showCenteredInCurrentWindow(project);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ManageRecentProjectsAction.java

示例2: invoke

import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void invoke(@NotNull final Project project, @Nullable final Editor editor, PsiFile file) {
  if (myModules.size() == 1) {
    addDependencyOnModule(project, editor, ContainerUtil.getFirstItem(myModules));
  }
  else {
    final JBList list = new JBList(myModules);
    list.setCellRenderer(new ModuleListCellRenderer());
    final JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list)
      .setTitle("Choose Module to Add Dependency on")
      .setMovable(false)
      .setResizable(false)
      .setRequestFocus(true)
      .setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
          final Object value = list.getSelectedValue();
          if (value instanceof Module) {
            addDependencyOnModule(project, editor, (Module)value);
          }
        }
      }).createPopup();
    if (editor != null) {
      popup.showInBestPositionFor(editor);
    } else {
      popup.showCenteredInCurrentWindow(project);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:AddModuleDependencyFix.java

示例3: onSuccess

import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void onSuccess() {
  if (myProject.isDisposed() || ! myProject.isOpen()) return;

  if (myDescription != null) {
    NotificationPanel panel = new NotificationPanel();
    panel.setText(createMessage(myDescription, selectedFile));
    final JBPopup message = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, panel.getLabel()).createPopup();
    if (vcsContext.getEditor() != null) {
      message.showInBestPositionFor(vcsContext.getEditor());
    } else {
      message.showCenteredInCurrentWindow(vcsContext.getProject());
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ShowBaseRevisionAction.java

示例4: performForContext

import com.intellij.openapi.ui.popup.JBPopup; //导入方法依赖的package包/类
@Override
public void performForContext(@NotNull DataContext dataContext, final boolean invokedByShortcut) {
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  final PsiFile file = CommonDataKeys.PSI_FILE.getData(dataContext);

  if (project == null) return;

  PsiDocumentManager.getInstance(project).commitAllDocuments();
  final Editor editor = getEditor(dataContext);

  PsiElement element = getElement(project, file, editor, CommonDataKeys.PSI_ELEMENT.getData(dataContext));

  if (element == null && file == null) return;
  PsiFile containingFile = element != null ? element.getContainingFile() : file;
  if (containingFile == null || !containingFile.getViewProvider().isPhysical()) return;


  if (editor != null) {
    PsiReference ref = TargetElementUtil.findReference(editor, editor.getCaretModel().getOffset());
    if (element == null && ref != null) {
      element = TargetElementUtil.getInstance().adjustReference(ref);
    }
  }

  final NavigatablePsiElement[] superElements = (NavigatablePsiElement[])findSuperElements(element);
  if (superElements.length == 0) return;

  final boolean isMethod = superElements[0] instanceof PsiMethod;
  final JBPopup popup = PsiElementListNavigator.navigateOrCreatePopup(superElements, "Choose super " + (isMethod ? "method" : "class or interface"), "Super " + (isMethod ? "methods" : "classes/interfaces"),
                                                                     isMethod ? new MethodCellRenderer(false) : new PsiClassListCellRenderer(), null, new Consumer<Object[]>() {
    @Override
    public void consume(Object[] objects) {
      showSiblings(invokedByShortcut, project, editor, file, editor != null, (PsiElement)objects[0]);
    }
  });
  if (popup != null) {
    if (editor != null) {
      popup.showInBestPositionFor(editor);
    } else {
      popup.showCenteredInCurrentWindow(project);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:ShowSiblingsAction.java


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