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


Java JBPopupListener类代码示例

本文整理汇总了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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ChooseByNameFilter.java

示例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());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:ChooseByNameFilter.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:BalloonImpl.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:BalloonImpl.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:FindPopupWithProgress.java

示例6: addListener

import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
@Override
public void addListener(@NotNull JBPopupListener listener) {
  myListeners.add(listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:BalloonImpl.java

示例7: addListener

import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
public void addListener(JBPopupListener listener) {
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:NotificationPopup.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:SuggestionList.java

示例9: addListener

import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
public void addListener(JBPopupListener listener) {
  myListeners.add(listener);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:BalloonImpl.java

示例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();
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:67,代码来源:GoToHashOrRefPopup.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:45,代码来源:BalloonImpl.java

示例12: addListener

import com.intellij.openapi.ui.popup.JBPopupListener; //导入依赖的package包/类
@Override
public void addListener(@Nonnull JBPopupListener listener) {
  myListeners.add(listener);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:BalloonImpl.java


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