use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class EditorHeaderComponent method uiSettingsChanged.
@Override
public void uiSettingsChanged(UISettings uiSettings) {
boolean topBorderRequired = uiSettings.getEditorTabPlacement() != SwingConstants.TOP && (uiSettings.getShowNavigationBar() || uiSettings.getShowMainToolbar());
setBorder(new CustomLineBorder(JBColor.border(), topBorderRequired ? 1 : 0, 0, 1, 0));
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class AbstractExpandableItemsHandler method createToolTipImage.
@Nullable
private Point createToolTipImage(@NotNull KeyType key) {
UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, true);
Pair<Component, Rectangle> rendererAndBounds = getCellRendererAndBounds(key);
UIUtil.putClientProperty(myComponent, EXPANDED_RENDERER, null);
if (rendererAndBounds == null)
return null;
JComponent renderer = ObjectUtils.tryCast(rendererAndBounds.first, JComponent.class);
if (renderer == null)
return null;
if (UIUtil.isClientPropertyTrue(renderer, RENDERER_DISABLED))
return null;
if (UIUtil.isClientPropertyTrue(rendererAndBounds.getFirst(), USE_RENDERER_BOUNDS)) {
rendererAndBounds.getSecond().translate(renderer.getX(), renderer.getY());
rendererAndBounds.getSecond().setSize(renderer.getSize());
}
myKeyItemBounds = rendererAndBounds.second;
Rectangle cellBounds = myKeyItemBounds;
Rectangle visibleRect = getVisibleRect(key);
if (cellBounds.y < visibleRect.y)
return null;
int cellMaxY = cellBounds.y + cellBounds.height;
int visMaxY = visibleRect.y + visibleRect.height;
if (cellMaxY > visMaxY)
return null;
int cellMaxX = cellBounds.x + cellBounds.width;
int visMaxX = visibleRect.x + visibleRect.width;
Point location = new Point(visMaxX, cellBounds.y);
SwingUtilities.convertPointToScreen(location, myComponent);
Rectangle screen = ScreenUtil.getScreenRectangle(location);
int borderWidth = isPaintBorder() ? 1 : 0;
int width = Math.min(screen.width + screen.x - location.x - borderWidth, cellMaxX - visMaxX);
int height = cellBounds.height;
if (width <= 0 || height <= 0)
return null;
Dimension size = getImageSize(width, height);
myImage = UIUtil.createImage(myComponent, size.width, size.height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = myImage.createGraphics();
g.setClip(null);
doFillBackground(height, width, g);
g.translate(cellBounds.x - visMaxX, 0);
doPaintTooltipImage(renderer, cellBounds, g, key);
CustomLineBorder border = null;
if (borderWidth > 0) {
border = new CustomLineBorder(getBorderColor(), borderWidth, 0, borderWidth, borderWidth);
Insets insets = border.getBorderInsets(myTipComponent);
location.y -= insets.top;
JBInsets.addTo(size, insets);
}
g.dispose();
myRendererPane.remove(renderer);
myTipComponent.setBorder(border);
myTipComponent.setPreferredSize(size);
return location;
}
use of com.intellij.ui.border.CustomLineBorder in project android by JetBrains.
the class GradleVersionRecommendedUpdateDialog method createSouthPanel.
@Override
@NotNull
protected JComponent createSouthPanel() {
Action[] actions = createActions();
List<JButton> buttons = Lists.newArrayList();
JPanel panel = new JPanel(new BorderLayout());
if (actions.length > 0) {
JPanel buttonsPanel = createButtons(actions, buttons);
panel.add(buttonsPanel, BorderLayout.CENTER);
myButtons = buttons.toArray(new JButton[buttons.size()]);
}
if (getStyle() == DialogStyle.COMPACT) {
Border line = new CustomLineBorder(OnePixelDivider.BACKGROUND, 1, 0, 0, 0);
panel.setBorder(new CompoundBorder(line, empty(8, 12)));
} else {
panel.setBorder(emptyTop(8));
}
return panel;
}
use of com.intellij.ui.border.CustomLineBorder in project android by JetBrains.
the class RecommendedPluginVersionUpdateDialog method createSouthPanel.
@Override
@NotNull
protected JComponent createSouthPanel() {
Action[] actions = createActions();
List<JButton> buttons = Lists.newArrayList();
JPanel panel = new JPanel(new BorderLayout());
if (actions.length > 0) {
JPanel buttonsPanel = createButtons(actions, buttons);
panel.add(buttonsPanel, BorderLayout.CENTER);
myButtons = buttons.toArray(new JButton[buttons.size()]);
}
if (getStyle() == DialogStyle.COMPACT) {
Border line = new CustomLineBorder(OnePixelDivider.BACKGROUND, 1, 0, 0, 0);
panel.setBorder(new CompoundBorder(line, empty(8, 12)));
} else {
panel.setBorder(emptyTop(8));
}
return panel;
}
use of com.intellij.ui.border.CustomLineBorder in project intellij-community by JetBrains.
the class LibraryRootsComponent method init.
private void init(AbstractTreeStructure treeStructure) {
myTree = new Tree(new DefaultTreeModel(new DefaultMutableTreeNode()));
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
new LibraryRootsTreeSpeedSearch(myTree);
myTree.setCellRenderer(new LibraryTreeRenderer());
myTreeBuilder = new LibraryTableTreeBuilder(myTree, (DefaultTreeModel) myTree.getModel(), treeStructure);
myTreePanel.setLayout(new BorderLayout());
ToolbarDecorator toolbarDecorator = ToolbarDecorator.createDecorator(myTree).disableUpDownActions().setRemoveActionName(ProjectBundle.message("library.remove.action")).disableRemoveAction();
toolbarDecorator.setPanelBorder(new CustomLineBorder(1, 0, 0, 0));
final List<AttachRootButtonDescriptor> popupItems = new ArrayList<>();
for (AttachRootButtonDescriptor descriptor : myDescriptor.createAttachButtons()) {
Icon icon = descriptor.getToolbarIcon();
if (icon != null) {
AttachItemAction action = new AttachItemAction(descriptor, descriptor.getButtonText(), icon);
toolbarDecorator.addExtraAction(AnActionButton.fromAction(action));
} else {
popupItems.add(descriptor);
}
}
myAddExcludedRootActionButton = new AddExcludedRootActionButton();
toolbarDecorator.addExtraAction(myAddExcludedRootActionButton);
toolbarDecorator.addExtraAction(new AnActionButton("Remove", IconUtil.getRemoveIcon()) {
@Override
public void actionPerformed(AnActionEvent e) {
final Object[] selectedElements = getSelectedElements();
if (selectedElements.length == 0) {
return;
}
ApplicationManager.getApplication().runWriteAction(() -> {
for (Object selectedElement : selectedElements) {
if (selectedElement instanceof ItemElement) {
final ItemElement itemElement = (ItemElement) selectedElement;
getLibraryEditor().removeRoot(itemElement.getUrl(), itemElement.getRootType());
} else if (selectedElement instanceof OrderRootTypeElement) {
final OrderRootType rootType = ((OrderRootTypeElement) selectedElement).getOrderRootType();
final String[] urls = getLibraryEditor().getUrls(rootType);
for (String url : urls) {
getLibraryEditor().removeRoot(url, rootType);
}
} else if (selectedElement instanceof ExcludedRootElement) {
getLibraryEditor().removeExcludedRoot(((ExcludedRootElement) selectedElement).getUrl());
}
}
});
libraryChanged(true);
}
@Override
public void updateButton(AnActionEvent e) {
super.updateButton(e);
Object[] elements = getSelectedElements();
Presentation presentation = e.getPresentation();
if (ContainerUtil.and(elements, new FilteringIterator.InstanceOf<>(ExcludedRootElement.class))) {
presentation.setText("Cancel Exclusion");
} else {
presentation.setText(getTemplatePresentation().getText());
}
}
@Override
public ShortcutSet getShortcut() {
return CommonShortcuts.getDelete();
}
});
toolbarDecorator.setAddAction(new AnActionButtonRunnable() {
@Override
public void run(AnActionButton button) {
if (popupItems.isEmpty()) {
new AttachFilesAction(myDescriptor.getAttachFilesActionName()).actionPerformed(null);
return;
}
List<AnAction> actions = new ArrayList<>();
actions.add(new AttachFilesAction(myDescriptor.getAttachFilesActionName()));
for (AttachRootButtonDescriptor descriptor : popupItems) {
actions.add(new AttachItemAction(descriptor, descriptor.getButtonText(), null));
}
final DefaultActionGroup group = new DefaultActionGroup(actions);
JBPopupFactory.getInstance().createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(button.getContextComponent()), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).show(button.getPreferredPopupPoint());
}
});
myTreePanel.add(toolbarDecorator.createPanel(), BorderLayout.CENTER);
Disposer.register(this, myTreeBuilder);
}
Aggregations