本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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());
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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());
}
示例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));
}
示例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));
}
示例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);
}
}
示例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);
}
}