本文整理汇总了Java中com.intellij.openapi.ui.popup.LightweightWindowEvent类的典型用法代码示例。如果您正苦于以下问题:Java LightweightWindowEvent类的具体用法?Java LightweightWindowEvent怎么用?Java LightweightWindowEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LightweightWindowEvent类属于com.intellij.openapi.ui.popup包,在下文中一共展示了LightweightWindowEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: projectOpened
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void projectOpened() {
ApplicationManager.getApplication().invokeLater((DumbAwareRunnable)() -> ApplicationManager.getApplication().runWriteAction(
(DumbAwareRunnable)() -> {
if (PropertiesComponent.getInstance().getBoolean(ourShowPopup, true)) {
final String content = "<html>If you'd like to learn more about PyCharm Edu, " +
"click <a href=\"https://www.jetbrains.com/pycharm-edu/quickstart/\">here</a> to watch a tutorial</html>";
final Notification notification = new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION,
new NotificationListener.UrlOpeningListener(true));
StartupManager.getInstance(myProject).registerPostStartupActivity(() -> Notifications.Bus.notify(notification));
Balloon balloon = notification.getBalloon();
if (balloon != null) {
balloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
notification.expire();
}
});
}
notification.whenExpired(() -> PropertiesComponent.getInstance().setValue(ourShowPopup, false, true));
}
}));
}
示例2: createPopup
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的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: onClosed
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void onClosed(LightweightWindowEvent event) {
for (final UserTest userTest : myStudyTaskManager.getUserTests(myTask)) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
if (userTest.isEditable()) {
File inputFile = new File(userTest.getInput());
File outputFile = new File(userTest.getOutput());
flushBuffer(userTest.getInputBuffer(), inputFile);
flushBuffer(userTest.getOutputBuffer(), outputFile);
}
}
});
}
}
示例4: trackDimensions
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
private void trackDimensions(@Nullable String dimensionKey) {
Window popupWindow = getPopupWindow();
if (popupWindow == null) return;
ComponentListener windowListener = new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
if (myShown) {
processOnSizeChanged();
}
}
};
popupWindow.addComponentListener(windowListener);
addPopupListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
popupWindow.removeComponentListener(windowListener);
if (dimensionKey != null && myUserSizeChanged) {
WindowStateService.getInstance(myProject).putSizeFor(myProject, dimensionKey, myPrevSize);
}
}
});
}
示例5: createPopup
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的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());
}
示例6: onClosed
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void onClosed(LightweightWindowEvent event) {
for (final UserTest userTest : myStudyTaskManager.getUserTests(myTask)) {
ApplicationManager.getApplication().runWriteAction(() -> {
if (userTest.isEditable()) {
File inputFile = new File(userTest.getInput());
File outputFile = new File(userTest.getOutput());
flushBuffer(userTest.getInputBuffer(), inputFile);
flushBuffer(userTest.getOutputBuffer(), outputFile);
}
});
}
}
示例7: setBalloon
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
public void setBalloon(@NotNull final Balloon balloon) {
hideBalloon();
myBalloonRef = new WeakReference<Balloon>(balloon);
balloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (SoftReference.dereference(myBalloonRef) == balloon) {
myBalloonRef = null;
}
}
});
}
示例8: actionPerformed
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) {
return;
}
Filter filter = myFilterModel.getFilter();
final MultilinePopupBuilder popupBuilder = new MultilinePopupBuilder(project, myVariants, getPopupText(getTextValues(filter)),
supportsNegativeValues());
JBPopup popup = popupBuilder.createPopup();
popup.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (event.isOk()) {
Collection<String> selectedValues = popupBuilder.getSelectedValues();
if (selectedValues.isEmpty()) {
myFilterModel.setFilter(null);
}
else {
myFilterModel.setFilter(createFilter(selectedValues));
rememberValuesInSettings(selectedValues);
}
}
}
});
popup.showUnderneathOf(MultipleValueFilterPopupComponent.this);
}
示例9: hideAndDispose
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的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;
}
示例10: FramelessNotificationPopup
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
public FramelessNotificationPopup(final JComponent owner, final JComponent content, Color backgroud, boolean useDefaultPreferredSize, final ActionListener listener) {
myBackgroud = backgroud;
myUseDefaultPreferredSize = useDefaultPreferredSize;
myContent = new ContentComponent(content);
myActionListener = listener;
myFadeInTimer = UIUtil.createNamedTimer("Frameless fade in",10, myFadeTracker);
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myContent, null)
.setRequestFocus(false)
.setResizable(false)
.setMovable(true)
.setLocateWithinScreenBounds(false)
.setAlpha(0.2f).addListener(new JBPopupAdapter() {
public void onClosed(LightweightWindowEvent event) {
if (myFadeInTimer.isRunning()) {
myFadeInTimer.stop();
}
myFadeInTimer.removeActionListener(myFadeTracker);
}
})
.createPopup();
final Point p = RelativePoint.getSouthEastOf(owner).getScreenPoint();
Rectangle screen = ScreenUtil.getScreenRectangle(p.x, p.y);
final Point initial = new Point(screen.x + screen.width - myContent.getPreferredSize().width - 50,
screen.y + screen.height - 5);
myPopup.showInScreenCoordinates(owner, initial);
myFadeInTimer.setRepeats(true);
myFadeInTimer.start();
}
示例11: createBalloon
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@NotNull
@Override
public Balloon createBalloon() {
final BalloonImpl result = new BalloonImpl(
myContent, myBorder, myBorderInsets, myFill, myHideOnMouseOutside, myHideOnKeyOutside, myHideOnAction, myShowCallout, myCloseButtonEnabled,
myFadeoutTime, myHideOnFrameResize, myHideOnLinkClick, myClickHandler, myCloseOnClick, myAnimationCycle, myCalloutShift,
myPositionChangeXShift, myPositionChangeYShift, myDialogMode, myTitle, myContentInsets, myShadow, mySmallVariant, myBlockClicks,
myLayer);
if (myStorage != null && myAnchor != null) {
List<Balloon> balloons = myStorage.get(myAnchor);
if (balloons == null) {
myStorage.put(myAnchor, balloons = new ArrayList<Balloon>());
Disposer.register(myAnchor, new Disposable() {
@Override
public void dispose() {
List<Balloon> toDispose = myStorage.remove(myAnchor);
if (toDispose != null) {
for (Balloon balloon : toDispose) {
if (!balloon.isDisposed()) {
Disposer.dispose(balloon);
}
}
}
}
});
}
balloons.add(result);
result.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (!result.isDisposed()) {
Disposer.dispose(result);
}
}
});
}
return result;
}
示例12: showBalloon
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
private void showBalloon() {
if (myBalloon != null) {
Disposer.dispose(myBalloon);
return;
}
myBalloon = JBPopupFactory.getInstance().createBalloonBuilder(myBalloonComponent)
.setAnimationCycle(200)
.setCloseButtonEnabled(true)
.setHideOnAction(false)
.setHideOnClickOutside(false)
.setHideOnFrameResize(false)
.setHideOnKeyOutside(false)
.setSmallVariant(true)
.setShadow(true)
.createBalloon();
Disposer.register(myBalloon, new Disposable() {
@Override
public void dispose() {
myBalloon = null;
}
});
myBalloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
if (myBalloon != null) {
Disposer.dispose(myBalloon);
}
}
});
myBalloon.show(new PositionTracker<Balloon>(myIcon) {
@Override
public RelativePoint recalculateLocation(Balloon object) {
return new RelativePoint(myIcon, new Point(myIcon.getSize().width / 2, 4));
}
}, Balloon.Position.above);
}
示例13: onClosed
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void onClosed(LightweightWindowEvent event) {
super.onClosed(event);
if (myOnClose != null) {
myOnClose.run();
}
}
示例14: beforeShown
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void beforeShown(final LightweightWindowEvent windowEvent) {
final Lookup activeLookup = LookupManager.getInstance(myProject).getActiveLookup();
if (activeLookup != null) {
activeLookup.addLookupListener(new LookupAdapter() {
@Override
public void currentItemChanged(LookupEvent event) {
if (windowEvent.asPopup().isVisible()) { //was not canceled yet
final LookupElement item = event.getItem();
if (item != null) {
PsiElement targetElement = CompletionUtil.getTargetElement(item);
if (targetElement == null) {
targetElement = DocumentationManager.getInstance(myProject).getElementFromLookup(activeLookup.getEditor(), activeLookup.getPsiFile());
}
updatePopup(targetElement); //open next
}
} else {
activeLookup.removeLookupListener(this);
}
}
});
}
else {
final Component focusedComponent = WindowManagerEx.getInstanceEx().getFocusedComponent(myProject);
boolean fromQuickSearch = focusedComponent != null && focusedComponent.getParent() instanceof ChooseByNameBase.JPanelProvider;
if (fromQuickSearch) {
ChooseByNameBase.JPanelProvider panelProvider = (ChooseByNameBase.JPanelProvider)focusedComponent.getParent();
panelProvider.registerHint(windowEvent.asPopup());
}
else if (focusedComponent instanceof JComponent) {
HintUpdateSupply supply = HintUpdateSupply.getSupply((JComponent)focusedComponent);
if (supply != null) supply.registerHint(windowEvent.asPopup());
}
}
}
示例15: projectOpened
import com.intellij.openapi.ui.popup.LightweightWindowEvent; //导入依赖的package包/类
@Override
public void projectOpened() {
ApplicationManager.getApplication().invokeLater(new DumbAwareRunnable() {
@Override
public void run() {
ApplicationManager.getApplication().runWriteAction(new DumbAwareRunnable() {
@Override
public void run() {
if (PropertiesComponent.getInstance().getBoolean(ourShowPopup, true)) {
final String content = "<html>If you'd like to learn more about PyCharm Edu, " +
"click <a href=\"https://www.jetbrains.com/pycharm-edu/quickstart/\">here</a> to watch a tutorial</html>";
final Notification notification = new Notification("Watch Tutorials!", "", content, NotificationType.INFORMATION,
new NotificationListener.UrlOpeningListener(true));
Notifications.Bus.notify(notification);
Balloon balloon = notification.getBalloon();
if (balloon != null) {
balloon.addListener(new JBPopupAdapter() {
@Override
public void onClosed(LightweightWindowEvent event) {
notification.expire();
}
});
}
notification.whenExpired(new Runnable() {
@Override
public void run() {
PropertiesComponent.getInstance().setValue(ourShowPopup, false, true);
}
});
}
}
});
}
});
}