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


Java JBPopupFactory類代碼示例

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


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

示例1: actionPerformed

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
public void actionPerformed(final AnActionEvent event) {
    final Project project = event.getProject();
    if (project == null) {
        return;
    }

    final ListPopupImpl popup = (ListPopupImpl) JBPopupFactory.getInstance()
            .createActionGroupPopup(TITLE, new PopupGroup(), event.getDataContext(),
                    JBPopupFactory.ActionSelectionAid.NUMBERING, true, event.getPlace());
    JBPopupHelper.disableSpeedSearch(popup);
    JBPopupHelper.registerShiftActions(popup, TITLE, SHIFT_TITLE);
    JBPopupHelper.registerCtrlActions(popup, TITLE, CTRL_TITLE);

    popup.setAdText(AD_TEXT);
    popup.showCenteredInCurrentWindow(project);
}
 
開發者ID:FWDekker,項目名稱:intellij-randomness,代碼行數:18,代碼來源:PopupAction.java

示例2: createList

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
/**
 * create ListPop
 *
 * @param title
 * @param data
 * @param listener
 */
public void createList(String title, String[] data, OnItemClickListener listener) {
    DefaultActionGroup group = new DefaultActionGroup();
    if (data != null && data.length > 0) {
        for (int i = 0; i < data.length; i++) {
            if (!Utils.isEmpty(data[i])) {
                if (data[i].contains("-")) {
                    group.add(new ListItemAction(i, data[i], listener));
                } else {
                    group.addSeparator(data[i]);
                }
            }
        }
    }
    listPopup = JBPopupFactory.getInstance().createActionGroupPopup(title, group,
            anActionEvent.getDataContext(), aid, true, null, -1, null, "unknown");
    show();
}
 
開發者ID:pengwei1024,項目名稱:AndroidSourceViewer,代碼行數:25,代碼來源:PopListView.java

示例3: handleBadRequest

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
private void handleBadRequest(final HybrisHttpResult httpResult, final Project project) {
    if (httpResult.getStatusCode() != SC_OK) {
        final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);

        if (httpResult.getStatusCode() == SC_NOT_FOUND || httpResult.getStatusCode() == SC_MOVED_TEMPORARILY) {
            JBPopupFactory.getInstance().createHtmlTextBalloonBuilder(
                "Hybris Host URL '" + httpResult.getErrorMessage() + "' was incorrect. Please, check your settings.",
                MessageType.ERROR,
                null
            ).setFadeoutTime(FADEOUT_TIME)
                          .createBalloon().show(
                RelativePoint.getCenterOf(statusBar.getComponent()),
                Balloon.Position.atRight
            );
        }
    }
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:18,代碼來源:ExecuteHybrisConsole.java

示例4: showComponent

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
public void showComponent(RelativePoint point) {
  myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(this, this)
    .setRequestFocus(true)
    .setCancelOnOtherWindowOpen(true)
    .setCancelOnClickOutside(true)
    .setShowBorder(true)
    .createPopup();

  Disposer.register(ApplicationManager.getApplication(), new Disposable() {
    @Override
    public void dispose() {
      Disposer.dispose(myPopup);
    }
  });

  myPopup.show(point);
}
 
開發者ID:medvector,項目名稱:educational-plugin,代碼行數:18,代碼來源:StudyStepicUserWidget.java

示例5: run

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
public void run(AnActionButton button) {
    // 獲取選中節點
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode == null) {
        return;
    }
    List<AnAction> actions = getMultipleActions(selectedNode);
    if (actions == null || actions.isEmpty()) {
        return;
    }
    // 顯示新增按鈕
    final DefaultActionGroup group = new DefaultActionGroup(actions);
    JBPopupFactory.getInstance()
            .createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(button.getContextComponent()),
                    JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).show(button.getPreferredPopupPoint());
}
 
開發者ID:hykes,項目名稱:CodeGen,代碼行數:18,代碼來源:TemplateAddAction.java

示例6: generateProject

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
public void generateProject(@NotNull Project project, @NotNull VirtualFile baseDir, @NotNull GravProjectSettings settings, @NotNull Module module) {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
    VirtualFile vf = LocalFileSystem.getInstance().findFileByIoFile(new File(settings.gravInstallationPath));
    if (vf == null || !GravSdkType.isValidGravSDK(vf)) {
        JBPopupFactory.getInstance()
                .createHtmlTextBalloonBuilder("Project couldn't be created because Grav Installation isn't valid", MessageType.ERROR, null)
                .setFadeoutTime(3500)
                .createBalloon()
                .show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);
    } else {
        storage.setDefaultGravDownloadPath(settings.gravInstallationPath);
        PropertiesComponent.getInstance().setValue(LAST_USED_GRAV_HOME, new File(settings.gravInstallationPath).getAbsolutePath());
        GravProjectGeneratorUtil projectGenerator = new GravProjectGeneratorUtil();
        projectGenerator.generateProject(project, baseDir, settings, module);
        try {
            List<String> includePath = new ArrayList<>();
            includePath.add(baseDir.getPath());
            PhpIncludePathManager.getInstance(project).setIncludePath(includePath);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:25,代碼來源:GravProjectGenerator.java

示例7: moduleCreated

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
    public void moduleCreated(@NotNull Module module) {
        StatusBar statusBar = WindowManager.getInstance().getStatusBar(project);
        String msg = String.format("Please wait while module for project %s is created", project.getName());
        settings = GravProjectSettings.getInstance(project);

        JBPopupFactory.getInstance()
                .createHtmlTextBalloonBuilder(msg, MessageType.WARNING, null)
                .setFadeoutTime(4000)
                .createBalloon()
                .show(RelativePoint.getSouthEastOf(statusBar.getComponent()), Balloon.Position.above);

        VirtualFile[] roots1 = ModuleRootManager.getInstance(module).getContentRoots();
        if (roots1.length != 0) {
            final VirtualFile src = roots1[0];
            settings.withSrcDirectory = withSrcDirectory;
            settings.gravInstallationPath = getGravInstallPath().getPath();
//            settings.withSrcDirectory =
            GravProjectGeneratorUtil generatorUtil = new GravProjectGeneratorUtil();
            generatorUtil.generateProject(project, src, settings, module);
        }
    }
 
開發者ID:PioBeat,項目名稱:GravSupport,代碼行數:23,代碼來源:GravModuleBuilder.java

示例8: invoke

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
public void invoke(@NotNull final Project project, final Editor editor, @NotNull final PsiElement psiElement) throws IncorrectOperationException {

    JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<String>("Chosen", "Document", "Sample") {

        @Override
        public PopupStep onChosen(String selectedValue, boolean finalChoice) {

            if ("Document".equals(selectedValue)) {
                openDocument(psiElement.getText());
            } else if ("Sample".equals(selectedValue)) {
                openSample(project, editor);
            }

            return super.onChosen(selectedValue, finalChoice);
        }
    }).showInBestPositionFor(editor);
}
 
開發者ID:misakuo,項目名稱:weex-language-support,代碼行數:19,代碼來源:DocumentIntention.java

示例9: openSample

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
private void openSample(Project project, Editor editor) {

        EditorTextField field = new EditorTextField(editor.getDocument(), project, WeexFileType.INSTANCE, true, false) {
            @Override
            protected EditorEx createEditor() {
                EditorEx editor1 = super.createEditor();
                editor1.setVerticalScrollbarVisible(true);
                editor1.setHorizontalScrollbarVisible(true);
                return editor1;

            }
        };

        field.setFont(editor.getContentComponent().getFont());

        JBPopup jbPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(field, null)
                .createPopup();

        jbPopup.setSize(new Dimension(500, 500));
        jbPopup.showInBestPositionFor(editor);
    }
 
開發者ID:misakuo,項目名稱:weex-language-support,代碼行數:22,代碼來源:DocumentIntention.java

示例10: installGtmWidget

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
private void installGtmWidget() {
    StatusBar statusBar = WindowManager.getInstance().getStatusBar(myProject);
    if (statusBar != null) {
        statusBar.addWidget(myStatusWidget, myProject);
        myStatusWidget.installed();
        if (!GTMRecord.initGtmExePath()) {
            JBPopupFactory.getInstance()
                    .createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmNotFound, ERROR, null)
                    .setFadeoutTime(30000)
                    .createBalloon()
                    .show(RelativePoint.getSouthEastOf(statusBar.getComponent()),
                            Balloon.Position.atRight);
            return;
        }
        if (!GTMRecord.checkVersion()) {
            JBPopupFactory.getInstance()
                    .createHtmlTextBalloonBuilder(GTMConfig.getInstance().gtmVerOutdated, WARNING, null)
                    .setFadeoutTime(30000)
                    .createBalloon()
                    .show(RelativePoint.getSouthEastOf(statusBar.getComponent()),
                            Balloon.Position.atRight);
        }
    }
}
 
開發者ID:git-time-metric,項目名稱:gtm-jetbrains-plugin,代碼行數:25,代碼來源:GTMProject.java

示例11: actionPerformed

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
public void actionPerformed(AnActionEvent e) {

    ActionManager am = ActionManager.getInstance();
    DefaultActionGroup actionGroup = (DefaultActionGroup) am.getAction(LaunchSearchActionRegistration.COMPONENT_GROUP);

    // https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Popups
    // https://github.com/linux-china/idea-string-manipulation/blob/master/src/main/java/osmedile/intellij/stringmanip/PopupChoiceAction.java#L23
    JBPopupFactory
            .getInstance()
            .createActionGroupPopup("OnlineSearch",
                                    actionGroup,
                                    e.getDataContext(),
                                    JBPopupFactory.ActionSelectionAid.NUMBERING,
                                    false)
            .showInBestPositionFor(e.getDataContext());
}
 
開發者ID:maddouri,項目名稱:IntelliJ-OnlineSearch,代碼行數:18,代碼來源:ShowSearchEnginesAction.java

示例12: showIncomingChatInvitation

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
public void showIncomingChatInvitation(@NotNull IncomingAnswer incomingTip, @NotNull IncomingTipNotification notification) {
    IIncomingTipPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertIncomingTipPopup(incomingTip);
    IncomingTipPopup popup = new IncomingTipPopup(popupModel);
    DataService.putData(popup, TrackingKeys.Location, new Locations.TipAnswerNotification(incomingTip.getSolution().getId()));

    BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
    balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
    balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
    balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
    balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
    balloonBuilder.setShadow(true);
    IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
    RelativePoint pointToShowPopup = null;
    if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
    Balloon balloon = balloonBuilder.createBalloon();
    data.put(popup, incomingTip);
    notifications.put(popup, notification);
    balloons.put(popup, balloon);
    balloon.show(pointToShowPopup, Balloon.Position.atLeft);

    TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
 
開發者ID:samebug,項目名稱:samebug-idea-plugin,代碼行數:23,代碼來源:IncomingTipPopupController.java

示例13: showIncomingHelpRequest

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
public void showIncomingHelpRequest(@NotNull IncomingHelpRequest helpRequest, @NotNull IncomingHelpRequestNotification notification) {
    IHelpRequestPopup.Model popupModel = IdeaSamebugPlugin.getInstance().conversionService.convertHelpRequestPopup(helpRequest);
    HelpRequestPopup popup = new HelpRequestPopup(popupModel);
    DataService.putData(popup, TrackingKeys.Location, new Locations.HelpRequestNotification(helpRequest.getMatch().getHelpRequest().getId()));
    DataService.putData(popup, TrackingKeys.WriteTipTransaction, Funnels.newTransactionId());
    HelpRequestPopupListener helpRequestPopupListener = new HelpRequestPopupListener(this);
    ListenerService.putListenerToComponent(popup, IHelpRequestPopup.Listener.class, helpRequestPopupListener);

    BalloonBuilder balloonBuilder = JBPopupFactory.getInstance().createBalloonBuilder(popup);
    balloonBuilder.setFillColor(ColorService.forCurrentTheme(ColorService.Background));
    balloonBuilder.setContentInsets(new Insets(40, 0, 40, 0));
    balloonBuilder.setBorderInsets(new Insets(0, 0, 0, 0));
    balloonBuilder.setBorderColor(ColorService.forCurrentTheme(ColorService.Background));
    balloonBuilder.setShadow(true);
    IdeFrame window = (IdeFrame) NotificationsManagerImpl.findWindowForBalloon(myProject);
    RelativePoint pointToShowPopup = null;
    if (window != null) pointToShowPopup = RelativePoint.getSouthEastOf(window.getComponent());
    Balloon balloon = balloonBuilder.createBalloon();
    data.put(popup, helpRequest);
    notifications.put(popup, notification);
    balloons.put(popup, balloon);
    balloon.show(pointToShowPopup, Balloon.Position.atLeft);

    TrackingService.trace(SwingRawEvent.notificationShow(popup));
}
 
開發者ID:samebug,項目名稱:samebug-idea-plugin,代碼行數:26,代碼來源:HelpRequestPopupController.java

示例14: selectTargets

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
protected void selectTargets(List<PsiLiteralExpression> targets, final Consumer<List<PsiLiteralExpression>> selectionConsumer) {
  if (targets.size() == 1) {
    selectionConsumer.consume(targets);
  } else {
    JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<PsiLiteralExpression>("Choose Inspections to Highlight Suppressed Problems from", targets){
      @Override
      public PopupStep onChosen(PsiLiteralExpression selectedValue, boolean finalChoice) {
        selectionConsumer.consume(Collections.singletonList(selectedValue));
        return FINAL_CHOICE;
      }

      @NotNull
      @Override
      public String getTextFor(PsiLiteralExpression value) {
        final Object o = value.getValue();
        LOG.assertTrue(o instanceof String);
        return (String)o;
      }
    }).showInBestPositionFor(myEditor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:HighlightSuppressedWarningsHandler.java

示例15: invoke

import com.intellij.openapi.ui.popup.JBPopupFactory; //導入依賴的package包/類
@Override
public void invoke(@NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
  final List<String> fqns = getPossibleFqns(myRef);
  myEditorComponent = editor.getComponent();
  if (fqns.size() > 1) {
    final JBList listOfFqns = new JBList(fqns);
    JBPopupFactory.getInstance()
      .createListPopupBuilder(listOfFqns)
      .setTitle("Select Qualified Name")
      .setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
          final Object value = listOfFqns.getSelectedValue();
          if (value instanceof String) {
            findJarsForFqn(((String)value), editor);
          }
        }
      }).createPopup().showInBestPositionFor(editor);
  }
  else if (fqns.size() == 1) {
    findJarsForFqn(fqns.get(0), editor);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:FindJarFix.java


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