本文整理汇总了Java中com.intellij.openapi.ui.popup.JBPopupListener类的典型用法代码示例。如果您正苦于以下问题:Java JBPopupListener类的具体用法?Java JBPopupListener怎么用?Java JBPopupListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JBPopupListener类属于com.intellij.openapi.ui.popup包,在下文中一共展示了JBPopupListener类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPopup
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
/**
* Create and show popup
*/
private void createPopup() {
if (myPopup != null) {
return;
}
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myChooserPanel, myChooser).setModalContext(false).setFocusable(false)
.setResizable(true).setCancelOnClickOutside(false).setMinSize(new Dimension(200, 200))
.setDimensionServiceKey(myProject, "GotoFile_FileTypePopup", false).createPopup();
myPopup.addListener(new JBPopupListener.Adapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
myPopup = null;
}
});
myPopup.showUnderneathOf(myToolbar.getComponent());
}
示例2: createPopup
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
/**
* Create and show popup
*/
private void createPopup() {
if (myPopup != null) {
return;
}
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myChooserPanel, myChooser).setModalContext(false).setFocusable(false)
.setResizable(true).setCancelOnClickOutside(false).setMinSize(new Dimension(200, 200))
.setDimensionServiceKey(myProject, "GotoFile_FileTypePopup", false).createPopup();
myPopup.addListener(new JBPopupListener.Adapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
myPopup = null;
}
});
myPopup.showUnderneathOf(myToolbar.getComponent());
}
示例3: hideAndDispose
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
private void hideAndDispose(final boolean ok) {
if (myDisposed) return;
myDisposed = true;
hideComboBoxPopups();
final Runnable disposeRunnable = new Runnable() {
@Override
public void run() {
myFadedOut = true;
for (JBPopupListener each : myListeners) {
each.onClosed(new LightweightWindowEvent(BalloonImpl.this, ok));
}
Disposer.dispose(BalloonImpl.this);
onDisposed();
}
};
Toolkit.getDefaultToolkit().removeAWTEventListener(myAwtActivityListener);
if (myLayeredPane != null) {
myLayeredPane.removeComponentListener(myComponentListener);
Disposer.register(ApplicationManager.getApplication(), this); // to be safe if Application suddenly exits and animation wouldn't have a chance to complete
runAnimation(false, myLayeredPane, new Runnable() {
@Override
public void run() {
disposeRunnable.run();
}
});
}
else {
disposeRunnable.run();
}
myVisible = false;
myTracker = null;
}
示例4: hideAndDispose
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
private void hideAndDispose(final boolean ok) {
if (myDisposed) return;
myDisposed = true;
final Runnable disposeRunnable = new Runnable() {
public void run() {
myFadedOut = true;
for (JBPopupListener each : myListeners) {
each.onClosed(new LightweightWindowEvent(BalloonImpl.this, ok));
}
Disposer.dispose(BalloonImpl.this);
onDisposed();
}
};
Toolkit.getDefaultToolkit().removeAWTEventListener(myAwtActivityListener);
if (myLayeredPane != null) {
myLayeredPane.removeComponentListener(myComponentListener);
runAnimation(false, myLayeredPane, new Runnable() {
@Override
public void run() {
disposeRunnable.run();
}
});
} else {
disposeRunnable.run();
}
myVisible = false;
myTracker = null;
}
示例5: FindPopupWithProgress
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
public FindPopupWithProgress(@NotNull final Project project,
@NotNull Collection<String> variants,
@NotNull Function<String, Future> function) {
myFunction = function;
myTextField = new TextFieldWithProgress(project, variants) {
@Override
public void onOk() {
if (myFuture == null) {
final Future future = myFunction.fun(getText().trim());
myFuture = future;
showProgress();
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
future.get();
okPopup();
}
catch (CancellationException ex) {
cancelPopup();
}
catch (InterruptedException ex) {
cancelPopup();
}
catch (ExecutionException ex) {
LOG.error(ex);
cancelPopup();
}
}
});
}
}
};
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myTextField, myTextField.getPreferableFocusComponent())
.setCancelOnClickOutside(true).setCancelOnWindowDeactivation(true).setCancelKeyEnabled(true).setRequestFocus(true).createPopup();
myPopup.addListener(new JBPopupListener.Adapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (!event.isOk()) {
if (myFuture != null) {
myFuture.cancel(true);
}
}
myFuture = null;
myTextField.hideProgress();
}
});
final JBTextField field = new JBTextField(20);
final Dimension size = field.getPreferredSize();
final Insets insets = myTextField.getBorder().getBorderInsets(myTextField);
size.height += 6 + insets.top + insets.bottom;
size.width += 4 + insets.left + insets.right;
myPopup.setSize(size);
}
示例6: addListener
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
@Override
public void addListener(@NotNull JBPopupListener listener) {
myListeners.add(listener);
}
示例7: addListener
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
public void addListener(JBPopupListener listener) {
}
示例8: SuggestionList
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
/**
* @param listener popup listener (will be called back when popup closed)
*/
public SuggestionList(@SuppressWarnings("NullableProblems") @NotNull final JBPopupListener listener) {
myListener = listener;
}
示例9: addListener
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
public void addListener(JBPopupListener listener) {
myListeners.add(listener);
}
示例10: GoToHashOrRefPopup
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
public GoToHashOrRefPopup(@Nonnull final Project project,
@Nonnull VcsLogRefs variants,
Collection<VirtualFile> roots,
@Nonnull Function<String, Future> onSelectedHash,
@Nonnull Function<VcsRef, Future> onSelectedRef,
@Nonnull VcsLogColorManager colorManager,
@Nonnull Comparator<VcsRef> comparator) {
myOnSelectedHash = onSelectedHash;
myOnSelectedRef = onSelectedRef;
myTextField =
new TextFieldWithProgress(project, new VcsRefCompletionProvider(project, variants, roots, colorManager, comparator)) {
@Override
public void onOk() {
if (myFuture == null) {
final Future future = ((mySelectedRef == null || (!mySelectedRef.getName().equals(getText().trim())))
? myOnSelectedHash.fun(getText().trim())
: myOnSelectedRef.fun(mySelectedRef));
myFuture = future;
showProgress();
ApplicationManager.getApplication().executeOnPooledThread(() -> {
try {
future.get();
okPopup();
}
catch (CancellationException ex) {
cancelPopup();
}
catch (InterruptedException ex) {
cancelPopup();
}
catch (ExecutionException ex) {
LOG.error(ex);
cancelPopup();
}
});
}
}
};
myTextField.setAlignmentX(Component.LEFT_ALIGNMENT);
JBLabel label = new JBLabel("Enter hash or branch/tag name:");
label.setFont(UIUtil.getLabelFont().deriveFont(Font.BOLD));
label.setAlignmentX(Component.LEFT_ALIGNMENT);
JPanel panel = new JPanel();
BoxLayout layout = new BoxLayout(panel, BoxLayout.PAGE_AXIS);
panel.setLayout(layout);
panel.add(label);
panel.add(myTextField);
panel.setBorder(new EmptyBorder(2, 2, 2, 2));
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField.getPreferableFocusComponent())
.setCancelOnClickOutside(true).setCancelOnWindowDeactivation(true).setCancelKeyEnabled(true).setRequestFocus(true).createPopup();
myPopup.addListener(new JBPopupListener.Adapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (!event.isOk()) {
if (myFuture != null) {
myFuture.cancel(true);
}
}
myFuture = null;
myTextField.hideProgress();
}
});
}
示例11: hideAndDispose
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
private void hideAndDispose(final boolean ok) {
if (myDisposed) return;
if (mySmartFadeoutPaused) {
mySmartFadeoutPaused = false;
return;
}
if (myTraceDispose) {
Logger.getInstance("#com.intellij.ui.BalloonImpl").error("Dispose balloon before showing", new Throwable());
}
myDisposed = true;
hideComboBoxPopups();
final Runnable disposeRunnable = () -> {
myFadedOut = true;
if (myRequestFocus) {
if (myOriginalFocusOwner != null) {
myFocusManager.requestFocus(myOriginalFocusOwner, false);
}
}
for (JBPopupListener each : myListeners) {
each.onClosed(new LightweightWindowEvent(this, ok));
}
Disposer.dispose(this);
onDisposed();
};
Toolkit.getDefaultToolkit().removeAWTEventListener(myAwtActivityListener);
if (myLayeredPane != null) {
myLayeredPane.removeComponentListener(myComponentListener);
runAnimation(false, myLayeredPane, disposeRunnable);
}
else {
disposeRunnable.run();
}
myVisible = false;
myTracker = null;
}
示例12: addListener
import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
@Override
public void addListener(@Nonnull JBPopupListener listener) {
myListeners.add(listener);
}