public void update() { if (!isShowing()) { if (myPopup.getSpeedSearch().isHoldingFilter()) { setVisible(true); final CaptionPanel title = myPopup.getTitle(); final Point titleScreenPoint = title.getLocationOnScreen(); setLocation(new Point(titleScreenPoint.x + title.getSize().width / 4, titleScreenPoint.y - title.getSize().height / 2)); updateTextAndBounds(); } } else { if (!myPopup.getSpeedSearch().isHoldingFilter()) { setVisible(false); } else { updateTextAndBounds(); } } }
private static void patchDialogs() throws Exception { if (!MTConfig.getInstance().isMaterialTheme()) { return; } Color color = UIManager.getColor("Dialog.titleColor"); if (color == null) { color = Gray._55; } StaticPatcher.setFinalStatic(CaptionPanel.class, "CNT_ACTIVE_BORDER_COLOR", new JBColor(color, color)); StaticPatcher.setFinalStatic(CaptionPanel.class, "BND_ACTIVE_COLOR", new JBColor(color, color)); StaticPatcher.setFinalStatic(CaptionPanel.class, "CNT_ACTIVE_COLOR", new JBColor(color, color)); }
/** * For better dialog titles (since I have no idea how to know when dialogs appear, I can't attach events so I'm directly hacking * the source code). I hate doing this. */ public static void hackTitleLabel() { // Hack method try { final ClassPool cp = new ClassPool(true); cp.insertClassPath(new ClassClassPath(CaptionPanel.class)); final CtClass ctClass = cp.get("com.intellij.ui.TitlePanel"); final CtConstructor declaredConstructor = ctClass.getDeclaredConstructor(new CtClass[] { cp.get("javax.swing.Icon"), cp.get("javax.swing" + ".Icon")}); declaredConstructor.instrument(new ExprEditor() { @Override public void edit(final MethodCall m) throws CannotCompileException { if (m.getMethodName().equals("empty")) { // Replace insets m.replace("{ $1 = 10; $2 = 10; $3 = 10; $4 = 10; $_ = $proceed($$); }"); } else if (m.getMethodName().equals("setHorizontalAlignment")) { // Set title at the left m.replace("{ $1 = javax.swing.SwingConstants.LEFT; $_ = $proceed($$); }"); } else if (m.getMethodName().equals("setBorder")) { // Bigger heading m.replace("{ $_ = $proceed($$); myLabel.setFont(myLabel.getFont().deriveFont(1, com.intellij.util.ui.JBUI.scale(16.0f))); }"); } } }); ctClass.toClass(); } catch (final Exception e) { e.printStackTrace(); } }
public FramesPanel(Project project, DebuggerStateManager stateManager) { super(project, stateManager); myStateManager = stateManager; setLayout(new BorderLayout()); myThreadsCombo = new ComboBoxWithWidePopup(); myThreadsCombo.setRenderer(new DebuggerComboBoxRenderer(myThreadsCombo.getRenderer())); myThreadsListener = new ThreadsListener(); myThreadsCombo.addItemListener(myThreadsListener); myFramesList = new FramesList(project); myFramesListener = new FramesListener(); myFramesList.addListSelectionListener(myFramesListener); myFramesList.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent e) { int index = myFramesList.locationToIndex(e.getPoint()); if (index >= 0 && myFramesList.isSelectedIndex(index)) { processListValue(myFramesList.getModel().getElementAt(index)); } } }); registerThreadsPopupMenu(myFramesList); setBorder(null); final ActionToolbar toolbar = createToolbar(); Wrapper threads = new Wrapper(); CustomLineBorder border = new CustomLineBorder(CaptionPanel.CNT_ACTIVE_BORDER_COLOR, 0, 0, 1, 0); threads.setBorder(border); threads.add(toolbar.getComponent(), BorderLayout.EAST); threads.add(myThreadsCombo, BorderLayout.CENTER); add(threads, BorderLayout.NORTH); add(ScrollPaneFactory.createScrollPane(myFramesList), BorderLayout.CENTER); }