mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Changes for UI spec at IDEA-175743 (draft)
- Show "default" colum
This commit is contained in:
+23
-1
@@ -55,6 +55,7 @@ public class FileStatusColorsTable extends JBTable {
|
||||
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
setDefaultRenderer(Color.class, new MyColorCellRenderer());
|
||||
setDefaultRenderer(String.class, new MyStatusCellRenderer());
|
||||
setDefaultRenderer(Boolean.class, new MyDefaultStatusRenderer());
|
||||
setTableHeader(null);
|
||||
registerKeyboardAction(new ActionListener() {
|
||||
@Override
|
||||
@@ -76,9 +77,9 @@ public class FileStatusColorsTable extends JBTable {
|
||||
private void initPopup() {
|
||||
mySetColorMenu = new JBPopupMenu();
|
||||
mySetColorMenu.add(new JBMenuItem(new DropColorAction()));
|
||||
mySetColorMenu.add(new JBMenuItem(new ChooseColorAction()));
|
||||
myResetItem = new JBMenuItem(new ResetToDefaultAction());
|
||||
mySetColorMenu.add(myResetItem);
|
||||
mySetColorMenu.add(new JBMenuItem(new ChooseColorAction()));
|
||||
}
|
||||
|
||||
private class ChooseColorAction extends AbstractAction {
|
||||
@@ -254,6 +255,27 @@ public class FileStatusColorsTable extends JBTable {
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyDefaultStatusRenderer extends DefaultTableCellRenderer {
|
||||
private final JLabel myLabel = new JLabel();
|
||||
private final Color myLabelColor;
|
||||
|
||||
public MyDefaultStatusRenderer() {
|
||||
myLabel.setOpaque(true);
|
||||
myLabelColor = ColorUtil.withAlpha(myLabel.getForeground(), 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
if (value instanceof Boolean) {
|
||||
myLabel.setForeground(isSelected ? UIUtil.getTableSelectionForeground() : myLabelColor);
|
||||
myLabel.setBackground(UIUtil.getTableBackground(isSelected));
|
||||
myLabel.setText((Boolean)value ? "(default)" : "");
|
||||
return myLabel;
|
||||
}
|
||||
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyColorIcon extends EmptyIcon {
|
||||
|
||||
public static final int COLOR_HEIGHT = 14;
|
||||
|
||||
+4
-1
@@ -40,7 +40,10 @@ public class FileStatusColorsTableModel extends AbstractTableModel {
|
||||
new ColumnInfo(
|
||||
String.class, ApplicationBundle.message("file.status.colors.header.status"), descriptor -> descriptor.getStatus().getText()),
|
||||
new ColumnInfo(
|
||||
Color.class, ApplicationBundle.message("file.status.colors.header.color"), descriptor -> descriptor.getColor())
|
||||
Color.class, ApplicationBundle.message("file.status.colors.header.color"), descriptor -> descriptor.getColor()),
|
||||
new ColumnInfo(
|
||||
Boolean.class, "", descriptor -> descriptor.isDefault()
|
||||
)
|
||||
};
|
||||
|
||||
private static class ColumnInfo {
|
||||
|
||||
@@ -585,7 +585,7 @@ file.status.colors.header.color=Color
|
||||
file.status.color.none=UI Font Color
|
||||
file.status.color.menu.choose.color=Custom...
|
||||
file.status.color.menu.normal.text=UI Font Color
|
||||
file.status.color.menu.reset.to.default=Restore Default
|
||||
file.status.color.menu.reset.to.default=Default
|
||||
title.scope.based=By Scope
|
||||
title.colors.and.fonts=Color Scheme
|
||||
progress.analysing.font=Analysing font: {0}
|
||||
|
||||
Reference in New Issue
Block a user