當前位置: 首頁>>代碼示例>>Java>>正文


Java JBPopupFactory.getInstance方法代碼示例

本文整理匯總了Java中com.intellij.openapi.ui.popup.JBPopupFactory.getInstance方法的典型用法代碼示例。如果您正苦於以下問題:Java JBPopupFactory.getInstance方法的具體用法?Java JBPopupFactory.getInstance怎麽用?Java JBPopupFactory.getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.openapi.ui.popup.JBPopupFactory的用法示例。


在下文中一共展示了JBPopupFactory.getInstance方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: showBalloonForComponent

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
public static void showBalloonForComponent(@NotNull Component component, @NotNull final String message, final MessageType type,
                                           final boolean atTop, @Nullable final Disposable disposable) {
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  if (popupFactory == null) return;
  BalloonBuilder balloonBuilder = popupFactory.createHtmlTextBalloonBuilder(message, type, null);
  balloonBuilder.setDisposable(disposable == null ? ApplicationManager.getApplication() : disposable);
  Balloon balloon = balloonBuilder.createBalloon();
  Dimension size = component.getSize();
  Balloon.Position position;
  int x;
  int y;
  if (size == null) {
    x = y = 0;
    position = Balloon.Position.above;
  }
  else {
    x = Math.min(10, size.width / 2);
    y = size.height;
    position = Balloon.Position.below;
  }
  balloon.show(new RelativePoint(component, new Point(x, y)), position);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:PopupUtil.java

示例2: actionPerformed

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  List<String> fileNames = findTestDataFiles(dataContext);
  if (fileNames == null || fileNames.isEmpty()) {
    String testData = guessTestData(dataContext);
    if (testData == null) {
      String message = "Cannot find testdata files for class";
      final Notification notification = new Notification("testdata", "Found no testdata files", message, NotificationType.INFORMATION);
      Notifications.Bus.notify(notification, project);
      return;
    }
    fileNames = Collections.singletonList(testData);
  }

  final Editor editor = e.getData(CommonDataKeys.EDITOR);
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  final RelativePoint point = editor != null ? popupFactory.guessBestPopupLocation(editor) : popupFactory.guessBestPopupLocation(dataContext);

  TestDataNavigationHandler.navigate(point, fileNames, project);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:NavigateToTestDataAction.java

示例3: actionPerformed

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
public void actionPerformed(AnActionEvent e) {
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  final ListPopupStep popupStep = popupFactory.createActionsStep(myGroup, e.getDataContext(), false, false,
                                                                 myGroup.getTemplatePresentation().getText(), myToolbarComponent, false,
                                                                 0, false);
  popupFactory.createListPopup(popupStep).showUnderneathOf(myToolbarComponent);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:GroupToolbarAction.java

示例4: actionPerformed

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
public void actionPerformed(AnActionEvent e) {
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  final ListPopupStep step = popupFactory.createActionsStep(myActionGroup, e.getDataContext(), false, false,
                                                            myActionGroup.getTemplatePresentation().getText(), myTree, true,
                                                            myPreselection != null ? myPreselection.getDefaultIndex() : 0, true);
  final ListPopup listPopup = popupFactory.createListPopup(step);
  listPopup.setHandleAutoSelectionBeforeShow(true);
  if (e instanceof AnActionButton.AnActionEventWrapper) {
    ((AnActionButton.AnActionEventWrapper)e).showPopup(listPopup);
  } else {
    listPopup.showUnderneathOf(myNorthPanel);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:MasterDetailsComponent.java

示例5: notifyCustomRegionsUnavailable

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
private static void notifyCustomRegionsUnavailable(@NotNull Editor editor, @NotNull Project project) {
  final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
  Balloon balloon = popupFactory
    .createHtmlTextBalloonBuilder(IdeBundle.message("goto.custom.region.message.unavailable"), MessageType.INFO, null)
    .setFadeoutTime(2000)
    .setHideOnClickOutside(true)
    .setHideOnKeyOutside(true)
    .createBalloon();
  Disposer.register(project, balloon);
  balloon.show(popupFactory.guessBestPopupLocation(editor), Balloon.Position.below);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:GotoCustomRegionAction.java

示例6: actionPerformed

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
  final DefaultActionGroup actionGroup = prepareActionGroup(selection);
  final JComponent selectedComponent = selection.get(0).getDelegee();
  final DataContext context = DataManager.getInstance().getDataContext(selectedComponent);
  final JBPopupFactory factory = JBPopupFactory.getInstance();
  final ListPopup popup = factory.createActionGroupPopup(UIDesignerBundle.message("create.listener.title"), actionGroup, context,
                                                         JBPopupFactory.ActionSelectionAid.NUMBERING, true);

  FormEditingUtil.showPopupUnderComponent(popup, selection.get(0));
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:CreateListenerAction.java

示例7: showNavigatePopup

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
public static void showNavigatePopup(final RadComponent component, final boolean showIfEmpty) {
  final DefaultActionGroup actionGroup = prepareActionGroup(component);
  if (actionGroup != null && actionGroup.getChildrenCount() == 0 && showIfEmpty) {
    actionGroup.add(new MyNavigateAction(UIDesignerBundle.message("navigate.to.listener.empty"), null));
  }
  if (actionGroup != null && actionGroup.getChildrenCount() > 0) {
    final DataContext context = DataManager.getInstance().getDataContext(component.getDelegee());
    final JBPopupFactory factory = JBPopupFactory.getInstance();
    final ListPopup popup = factory.createActionGroupPopup(UIDesignerBundle.message("navigate.to.listener.title"), actionGroup, context,
                                                           JBPopupFactory.ActionSelectionAid.NUMBERING, true);
    FormEditingUtil.showPopupUnderComponent(popup, component);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ListenerNavigateButton.java

示例8: doAddAction

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入方法依賴的package包/類
void doAddAction(AnActionButton button) {
    if (isUnknown()) {
      return;
    }

    final JBPopupFactory popupFactory = JBPopupFactory.getInstance();
    final BeforeRunTaskProvider<BeforeRunTask>[] providers = Extensions.getExtensions(BeforeRunTaskProvider.EXTENSION_POINT_NAME,
                                                                                      myRunConfiguration.getProject());
  Set<Key> activeProviderKeys = getActiveProviderKeys();

  DefaultActionGroup actionGroup = new DefaultActionGroup(null, false);
    for (final BeforeRunTaskProvider<BeforeRunTask> provider : providers) {
      if (provider.createTask(myRunConfiguration) == null)
        continue;
      if (activeProviderKeys.contains(provider.getId()) && provider.isSingleton())
        continue;
      AnAction providerAction = new AnAction(provider.getName(), null, provider.getIcon()) {
        @Override
        public void actionPerformed(AnActionEvent e) {
          BeforeRunTask task = provider.createTask(myRunConfiguration);
          if (task != null) {
            provider.configureTask(myRunConfiguration, task);
            if (!provider.canExecuteTask(myRunConfiguration, task))
              return;
          } else {
            return;
          }
          task.setEnabled(true);

          Set<RunConfiguration> configurationSet = new HashSet<RunConfiguration>();
          getAllRunBeforeRuns(task, configurationSet);
          if (configurationSet.contains(myRunConfiguration)) {
            JOptionPane.showMessageDialog(BeforeRunStepsPanel.this,
                                          ExecutionBundle.message("before.launch.panel.cyclic_dependency_warning",
                                                                  myRunConfiguration.getName(),
                                                                  provider.getDescription(task)),
                                          ExecutionBundle.message("warning.common.title"),JOptionPane.WARNING_MESSAGE);
            return;
          }
          addTask(task);
          myListener.fireStepsBeforeRunChanged();
        }
      };
      actionGroup.add(providerAction);
    }
    final ListPopup popup =
      popupFactory.createActionGroupPopup(ExecutionBundle.message("add.new.run.configuration.acrtion.name"), actionGroup,
                                          SimpleDataContext.getProjectContext(myRunConfiguration.getProject()), false, false, false, null,
                                          -1, Conditions.<AnAction>alwaysTrue());
    popup.show(button.getPreferredPopupPoint());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:52,代碼來源:BeforeRunStepsPanel.java


注:本文中的com.intellij.openapi.ui.popup.JBPopupFactory.getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。