mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix completion popup crop to dialog size for single line editors (see copy class dialog as example)
This commit is contained in:
+6
@@ -90,6 +90,12 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement
|
||||
myFreezeSemaphore = freezeSemaphore;
|
||||
|
||||
myLookup = (LookupImpl)LookupManager.getInstance(editor.getProject()).createLookup(editor, LookupElement.EMPTY_ARRAY, "", new CompletionLookupArranger(parameters));
|
||||
if (editor.isOneLineMode()) {
|
||||
myLookup.setForceShowAsPopup(true);
|
||||
myLookup.setCancelOnClickOutside(true);
|
||||
myLookup.setCancelOnOtherWindowOpen(true);
|
||||
myLookup.setResizable(false);
|
||||
}
|
||||
|
||||
myLookup.addLookupListener(new LookupAdapter() {
|
||||
public void itemSelected(LookupEvent event) {
|
||||
|
||||
@@ -48,6 +48,9 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
|
||||
|
||||
private boolean myForceShowAsPopup = false;
|
||||
private String myTitle = null;
|
||||
private boolean myCancelOnClickOutside;
|
||||
private boolean myCancelOnOtherWindowOpen;
|
||||
private boolean myResizable;
|
||||
|
||||
public LightweightHint(@NotNull final JComponent component) {
|
||||
myComponent = component;
|
||||
@@ -74,6 +77,18 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
|
||||
mySelectingHint = selectingHint;
|
||||
}
|
||||
|
||||
public void setCancelOnClickOutside(final boolean b) {
|
||||
myCancelOnClickOutside = b;
|
||||
}
|
||||
|
||||
public void setCancelOnOtherWindowOpen(final boolean b) {
|
||||
myCancelOnOtherWindowOpen = b;
|
||||
}
|
||||
|
||||
public void setResizable(final boolean b) {
|
||||
myResizable = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the hint in the layered pane. Coordinates <code>x</code> and <code>y</code>
|
||||
* are in <code>parentComponent</code> coordinate system. Note that the component
|
||||
@@ -105,13 +120,13 @@ public class LightweightHint extends UserDataHolderBase implements Hint {
|
||||
myIsRealPopup = true;
|
||||
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myComponent, null)
|
||||
.setRequestFocus(false)
|
||||
.setResizable(myForceShowAsPopup)
|
||||
.setMovable(myForceShowAsPopup)
|
||||
.setResizable(myResizable)
|
||||
.setMovable(myTitle != null)
|
||||
.setTitle(myTitle)
|
||||
.setShowShadow(false)
|
||||
.setCancelKeyEnabled(false)
|
||||
.setCancelOnClickOutside(false)
|
||||
.setCancelOnOtherWindowOpen(false)
|
||||
.setCancelOnClickOutside(myCancelOnClickOutside)
|
||||
.setCancelOnOtherWindowOpen(myCancelOnOtherWindowOpen)
|
||||
.createPopup();
|
||||
|
||||
beforeShow();
|
||||
|
||||
@@ -197,7 +197,7 @@ public class AbstractPopup implements JBPopup {
|
||||
myPopupBorder = PopupBorder.Factory.create(true);
|
||||
myShadowed = showShadow;
|
||||
myPaintShadow = showShadow && !SystemInfo.isMac && !movable && !resizable && Registry.is("ide.popup.dropShadow");
|
||||
myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner());
|
||||
myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner() && resizable);
|
||||
myMayBeParent = mayBeParent;
|
||||
|
||||
myContent.add(component, BorderLayout.CENTER);
|
||||
|
||||
Reference in New Issue
Block a user