List of usage examples for com.intellij.openapi.ui.popup ActiveIcon getRegular
public Icon getRegular()
From source file:com.intellij.ui.popup.AbstractPopup.java
License:Apache License
AbstractPopup init(Project project, @NotNull JComponent component, @Nullable JComponent preferredFocusedComponent, boolean requestFocus, boolean focusable, boolean movable, String dimensionServiceKey, boolean resizable, @Nullable String caption, @Nullable Computable<Boolean> callback, boolean cancelOnClickOutside, @Nullable Set<JBPopupListener> listeners, boolean useDimServiceForXYLocation, ActiveComponent commandButton, @Nullable IconButton cancelButton, @Nullable MouseChecker cancelOnMouseOutCallback, boolean cancelOnWindow, @Nullable ActiveIcon titleIcon, boolean cancelKeyEnabled, boolean locateByContent, boolean placeWithinScreenBounds, @Nullable Dimension minSize, float alpha, @Nullable MaskProvider maskProvider, boolean inStack, boolean modalContext, @Nullable Component[] focusOwners, @Nullable String adText, int adTextAlignment, boolean headerAlwaysFocusable, @NotNull List<Pair<ActionListener, KeyStroke>> keyboardActions, Component settingsButtons, @Nullable final Processor<JBPopup> pinCallback, boolean mayBeParent, boolean showShadow, boolean showBorder, boolean cancelOnWindowDeactivation, @Nullable BooleanFunction<KeyEvent> keyEventHandler) { if (requestFocus && !focusable) { assert false : "Incorrect argument combination: requestFocus=true focusable=false"; }/*from w w w .j a v a 2 s. c om*/ myActivityKey = new UiActivity.Focus("Popup:" + this); myProject = project; myComponent = component; myPopupBorder = showBorder ? PopupBorder.Factory.create(true, showShadow) : PopupBorder.Factory.createEmpty(); myShadowed = showShadow; myContent = createContentPanel(resizable, myPopupBorder, isToDrawMacCorner() && resizable); myMayBeParent = mayBeParent; myCancelOnWindowDeactivation = cancelOnWindowDeactivation; myContent.add(component, BorderLayout.CENTER); if (adText != null) { setAdText(adText, adTextAlignment); } myCancelKeyEnabled = cancelKeyEnabled; myLocateByContent = locateByContent; myLocateWithinScreen = placeWithinScreenBounds; myAlpha = alpha; myMaskProvider = maskProvider; myInStack = inStack; myModalContext = modalContext; myFocusOwners = focusOwners; myHeaderAlwaysFocusable = headerAlwaysFocusable; myMovable = movable; ActiveIcon actualIcon = titleIcon == null ? new ActiveIcon(EmptyIcon.ICON_0) : titleIcon; myHeaderPanel = new JPanel(new BorderLayout()); if (caption != null) { if (!caption.isEmpty()) { myCaption = new TitlePanel(actualIcon.getRegular(), actualIcon.getInactive()); ((TitlePanel) myCaption).setText(caption); } else { myCaption = new CaptionPanel(); } if (pinCallback != null) { myCaption.setButtonComponent(new InplaceButton(new IconButton("Pin", AllIcons.General.AutohideOff, AllIcons.General.AutohideOff, AllIcons.General.AutohideOffInactive), new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { pinCallback.process(AbstractPopup.this); } })); } else if (cancelButton != null) { myCaption.setButtonComponent(new InplaceButton(cancelButton, new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { cancel(); } })); } else if (commandButton != null) { myCaption.setButtonComponent(commandButton); } } else { myCaption = new CaptionPanel(); myCaption.setBorder(null); myCaption.setPreferredSize(JBUI.emptySize()); } setWindowActive(myHeaderAlwaysFocusable); myHeaderPanel.add(myCaption, BorderLayout.NORTH); myContent.add(myHeaderPanel, BorderLayout.NORTH); myForcedHeavyweight = true; myResizable = resizable; myPreferredFocusedComponent = preferredFocusedComponent; myRequestFocus = requestFocus; myFocusable = focusable; myDimensionServiceKey = dimensionServiceKey; myCallBack = callback; myCancelOnClickOutside = cancelOnClickOutside; myCancelOnMouseOutCallback = cancelOnMouseOutCallback; myListeners = listeners == null ? new HashSet<JBPopupListener>() : listeners; myUseDimServiceForXYLocation = useDimServiceForXYLocation; myCancelOnWindow = cancelOnWindow; myMinSize = minSize; for (Pair<ActionListener, KeyStroke> pair : keyboardActions) { myContent.registerKeyboardAction(pair.getFirst(), pair.getSecond(), JComponent.WHEN_IN_FOCUSED_WINDOW); } if (settingsButtons != null) { myCaption.addSettingsComponent(settingsButtons); } myKeyEventHandler = keyEventHandler; debugState("popup initialized", State.NEW); myState = State.INIT; return this; }