List of usage examples for com.intellij.openapi.ui.popup ListPopup isDisposed
boolean isDisposed();
From source file:com.intellij.debugger.ui.DebuggerEditorImpl.java
License:Apache License
public DebuggerEditorImpl(Project project, PsiElement context, String recentsId, final CodeFragmentFactory factory) { myProject = project;// w w w. j av a 2 s . c o m myContext = context; myRecentsId = recentsId; PsiManager.getInstance(project).addPsiTreeChangeListener(myPsiListener); setFactory(factory); myInitialFactory = true; setFocusable(false); myChooseFactory.setToolTipText("Click to change the language"); myChooseFactory.setBorder(new EmptyBorder(0, 3, 0, 3)); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { ListPopup oldPopup = SoftReference.dereference(myPopup); if (oldPopup != null && !oldPopup.isDisposed()) { oldPopup.cancel(); myPopup = null; return true; } if (myContext == null) { return true; } ListPopup popup = createLanguagePopup(); popup.showUnderneathOf(myChooseFactory); myPopup = new WeakReference<ListPopup>(popup); return true; } }.installOn(myChooseFactory); }
From source file:com.intellij.xdebugger.impl.ui.XDebuggerEditorBase.java
License:Apache License
protected XDebuggerEditorBase(final Project project, @NotNull XDebuggerEditorsProvider debuggerEditorsProvider, @NotNull EvaluationMode mode, @Nullable @NonNls String historyId, final @Nullable XSourcePosition sourcePosition) { myProject = project;//from w w w . j av a 2s. c o m myDebuggerEditorsProvider = debuggerEditorsProvider; myMode = mode; myHistoryId = historyId; mySourcePosition = sourcePosition; myChooseFactory.setToolTipText("Click to change the language"); myChooseFactory.setBorder(new EmptyBorder(0, 3, 0, 3)); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { ListPopup oldPopup = SoftReference.dereference(myPopup); if (oldPopup != null && !oldPopup.isDisposed()) { oldPopup.cancel(); myPopup = null; return true; } ListPopup popup = createLanguagePopup(); popup.showUnderneathOf(myChooseFactory); myPopup = new WeakReference<ListPopup>(popup); return true; } }.installOn(myChooseFactory); }