@Nonnull JBPopup createPopup() { JPanel panel = new JPanel(new BorderLayout()); panel.add(myTextField, BorderLayout.CENTER); ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField) .setCancelOnClickOutside(true) .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish") .setRequestFocus(true) .setResizable(true) .setMayBeParent(true); final JBPopup popup = builder.createPopup(); popup.setMinimumSize(new JBDimension(200, 90)); AnAction okAction = new DumbAwareAction() { @Override public void actionPerformed(@Nonnull AnActionEvent e) { unregisterCustomShortcutSet(popup.getContent()); popup.closeOk(e.getInputEvent()); } }; okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent()); return popup; }
public NewRecentProjectPanel(Disposable parentDisposable) { super(parentDisposable); setBorder(null); setBackground(WelcomeScreenConstants.getProjectsBackground()); JScrollPane scrollPane = UIUtil.findComponentOfType(this, JScrollPane.class); if (scrollPane != null) { scrollPane.setBackground(WelcomeScreenConstants.getProjectsBackground()); JBDimension size = JBUI.size(300, 460); scrollPane.setSize(size); scrollPane.setMinimumSize(size); scrollPane.setPreferredSize(size); } ListWithFilter panel = UIUtil.findComponentOfType(this, ListWithFilter.class); if (panel != null) { panel.setBackground(WelcomeScreenConstants.getProjectsBackground()); } }
public static JPanel createIssueCountLabel(int issueCount, int rowHeight) { JPanel issueCountPanel = new JBPanel(new BorderLayout()).withBackground(UIUtil.getTableBackground()); JLabel issueCountLabel = new JBLabel(); issueCountPanel.add(issueCountLabel, BorderLayout.EAST); setIssueCountPanel(issueCount, issueCountPanel); issueCountLabel.setAlignmentX(Component.RIGHT_ALIGNMENT); issueCountLabel.setMinimumSize(new JBDimension(issueCountLabel.getMinimumSize().width, rowHeight)); issueCountLabel.setMaximumSize(new JBDimension(issueCountLabel.getMaximumSize().width, rowHeight)); issueCountPanel.setMinimumSize(new JBDimension(issueCountPanel.getMinimumSize().width, rowHeight)); issueCountPanel.setMaximumSize(new JBDimension(issueCountPanel.getMaximumSize().width, rowHeight)); return issueCountPanel; }
@Override protected Dimension getThumbSize() { if (isPlainThumb()) { return new Dimension(JBUI.scale(20), JBUI.scale(20)); } return slider.getOrientation() == JSlider.HORIZONTAL ? new JBDimension(12, 20) : new JBDimension(20, 12); }
private BalloonLayoutConfiguration(@Nonnull Dimension iconOffset, int topSpaceHeight, int titleContentSpaceHeight, int contentActionsSpaceHeight, int titleActionsSpaceHeight, int bottomSpaceHeight) { this(JBUI.scale(32), iconOffset, topSpaceHeight, titleContentSpaceHeight, contentActionsSpaceHeight, titleActionsSpaceHeight, bottomSpaceHeight, JBUI.scale(16), new JBDimension(8, 6), JBUI.scale(7), JBUI.scale(5), JBUI.scale(15)); }
private static ActionButton createButton(AnAction action) { Presentation presentation = action.getTemplatePresentation(); Dimension d = new JBDimension(16, 16); ActionButton button = new ActionButton(action, presentation, ActionPlaces.UNKNOWN, d) { @Override protected DataContext getDataContext() { return DataManager.getInstance().getDataContext(this); } }; //TODO [VISTALL] unsupported button.setLook(new InplaceActionButtonLook()); button.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); button.updateIcon(); return button; }
public InstancesWindow(@NotNull XDebugSession session, @NotNull InstancesProvider provider, @NotNull String className) { super(session.getProject(), false); myProject = session.getProject(); myDebugProcess = (DebugProcessImpl) DebuggerManager.getInstance(myProject).getDebugProcess(session.getDebugProcess().getProcessHandler()); myInstancesProvider = provider; myClassName = className; addWarningMessage(null); session.addSessionListener(new XDebugSessionListener() { @Override public void sessionStopped() { ApplicationManager.getApplication().invokeLater(() -> close(OK_EXIT_CODE)); } }, myDisposable); setModal(false); myInstancesView = new MyInstancesView(session); myInstancesView.setPreferredSize(new JBDimension(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT)); init(); JRootPane root = myInstancesView.getRootPane(); root.setDefaultButton(myInstancesView.myFilterButton); }
public void setMinimumButtonSize(@NotNull Dimension size) { myMinimumButtonSize = JBDimension.create(size); }
public void setPreferredSize(boolean orientation) { final Dimension size = new JBDimension(orientation ? 150 : 450 , -1); myProgressPanel.setMaximumSize(size); myProgressPanel.setMinimumSize(size); myProgressPanel.setPreferredSize(size); }
private static Dimension parseSize(final String value) { final java.util.List<String> numbers = StringUtil.split(value, ","); return new JBDimension(Integer.parseInt(numbers.get(0)), Integer.parseInt(numbers.get(1))).asUIResource(); }
public void setMinimumButtonSize(@Nonnull Dimension size) { myMinimumButtonSize = JBDimension.create(size); }
@Nonnull private static BalloonLayoutConfiguration twoLines() { return new BalloonLayoutConfiguration(new JBDimension(10, 11), JBUI.scale(11), JBUI.scale(5), JBUI.scale(5), JBUI.scale(5), JBUI.scale(14)); }
@Nonnull private static BalloonLayoutConfiguration treeLines() { return new BalloonLayoutConfiguration(new JBDimension(10, 7), JBUI.scale(7), JBUI.scale(3), JBUI.scale(7), 0, JBUI.scale(8)); }
@Override public Dimension getPreferredSize() { return new JBDimension(DEFAULT_WIDTH, DEFAULT_HEIGHT); }
public ClassesTable(@NotNull InstancesTracker tracker, @NotNull ClassesFilteredView parent, boolean onlyWithDiff, boolean onlyWithInstances, boolean onlyTracked) { setModel(myModel); myOnlyWithDiff = onlyWithDiff; myOnlyWithInstances = onlyWithInstances; myOnlyTracked = onlyTracked; myInstancesTracker = tracker; myParent = parent; final TableColumnModel columnModel = getColumnModel(); TableColumn classesColumn = columnModel.getColumn(DiffViewTableModel.CLASSNAME_COLUMN_INDEX); TableColumn countColumn = columnModel.getColumn(DiffViewTableModel.COUNT_COLUMN_INDEX); TableColumn diffColumn = columnModel.getColumn(DiffViewTableModel.DIFF_COLUMN_INDEX); setAutoResizeMode(AUTO_RESIZE_SUBSEQUENT_COLUMNS); classesColumn.setPreferredWidth(JBUI.scale(CLASSES_COLUMN_PREFERRED_WIDTH)); countColumn.setMinWidth(JBUI.scale(COUNT_COLUMN_MIN_WIDTH)); diffColumn.setMinWidth(JBUI.scale(DIFF_COLUMN_MIN_WIDTH)); setShowGrid(false); setIntercellSpacing(new JBDimension(0, 0)); setDefaultRenderer(ReferenceType.class, new MyClassColumnRenderer()); setDefaultRenderer(Long.class, new MyCountColumnRenderer()); setDefaultRenderer(DiffValue.class, new MyDiffColumnRenderer()); TableRowSorter<DiffViewTableModel> sorter = new TableRowSorter<>(myModel); sorter.setRowFilter(new RowFilter<DiffViewTableModel, Integer>() { @Override public boolean include(Entry<? extends DiffViewTableModel, ? extends Integer> entry) { int ix = entry.getIdentifier(); ReferenceType ref = myItems.get(ix); DiffValue diff = myCounts.getOrDefault(ref, UNKNOWN_VALUE); boolean isFilteringOptionsRefused = myOnlyWithDiff && diff.diff() == 0 || myOnlyWithInstances && !diff.hasInstance() || myOnlyTracked && myParent.getStrategy(ref) == null; return !(isFilteringOptionsRefused) && myMatcher.matches(ref.name()); } }); List<RowSorter.SortKey> myDefaultSortingKeys = Arrays.asList(new RowSorter.SortKey(DiffViewTableModel.DIFF_COLUMN_INDEX, SortOrder.DESCENDING), new RowSorter.SortKey(DiffViewTableModel .COUNT_COLUMN_INDEX, SortOrder.DESCENDING), new RowSorter.SortKey(DiffViewTableModel.CLASSNAME_COLUMN_INDEX, SortOrder.ASCENDING)); sorter.setSortKeys(myDefaultSortingKeys); setRowSorter(sorter); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); myCountProvider = new ReferenceCountProvider() { @Override public int getTotalCount(@NotNull ReferenceType ref) { return (int) myCounts.get(ref).myCurrentCount; } @Override public int getDiffCount(@NotNull ReferenceType ref) { return (int) myCounts.get(ref).diff(); } @Override public int getNewInstancesCount(@NotNull ReferenceType ref) { TrackerForNewInstances strategy = myParent.getStrategy(ref); return strategy == null || !strategy.isReady() ? -1 : strategy.getCount(); } }; }