提交 f953d376 编写于 作者: S Serge Rider

#7287 Dark theme coloring fixes


Former-commit-id: a956d576
上级 14cd1ba7
......@@ -54,8 +54,6 @@ import org.jkiss.dbeaver.runtime.properties.ObjectPropertyDescriptor;
import org.jkiss.dbeaver.ui.*;
import org.jkiss.dbeaver.ui.controls.ObjectEditorPageControl;
import org.jkiss.dbeaver.ui.controls.folders.TabbedFolderPage;
import org.jkiss.dbeaver.ui.css.CSSUtils;
import org.jkiss.dbeaver.ui.css.DBStyles;
import org.jkiss.dbeaver.ui.editors.IDatabaseEditorInput;
import org.jkiss.dbeaver.ui.editors.entity.EntityEditor;
import org.jkiss.dbeaver.ui.navigator.actions.NavigatorHandlerObjectOpen;
......@@ -64,8 +62,8 @@ import org.jkiss.utils.BeanUtils;
import org.jkiss.utils.CommonUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.List;
import java.util.*;
/**
* TabbedFolderPageProperties
......@@ -107,17 +105,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
// scrolled.setLayout(new GridLayout(1, false));
propertiesGroup = new Composite(parent, SWT.NONE);
CSSUtils.setCSSClass(propertiesGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
//propertiesGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
// scrolled.setContent(propertiesGroup);
// scrolled.setExpandHorizontal(true);
// scrolled.setExpandVertical(true);
//
// scrolled.addListener( SWT.Resize, event -> {
// int width = scrolled.getClientArea().width;
// scrolled.setMinSize( propertiesGroup.computeSize( width, SWT.DEFAULT ) );
// } );
//CSSUtils.setCSSClass(propertiesGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
curPropertySource = input.getPropertySource();
......@@ -242,7 +230,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
}
Composite primaryGroup = new Composite(propertiesGroup, SWT.NONE);
CSSUtils.setCSSClass(primaryGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
//CSSUtils.setCSSClass(primaryGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
primaryGroup.setLayout(new GridLayout(2, false));
GridData gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = maxGroupWidth;
......@@ -253,7 +241,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
if (hasSecondaryProps) {
secondaryGroup = new Composite(propertiesGroup, SWT.NONE);
secondaryGroup.setLayout(new GridLayout(2, false));
CSSUtils.setCSSClass(secondaryGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
//CSSUtils.setCSSClass(secondaryGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = maxGroupWidth;
secondaryGroup.setLayoutData(gd);
......@@ -263,7 +251,7 @@ public class TabbedFolderPageForm extends TabbedFolderPage implements IRefreshab
if (hasSpecificProps) {
specificGroup = new Composite(propertiesGroup, SWT.NONE);
specificGroup.setLayout(new GridLayout(2, false));
CSSUtils.setCSSClass(secondaryGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
//CSSUtils.setCSSClass(secondaryGroup, DBStyles.COLORED_BY_CONNECTION_TYPE);
gd = new GridData(GridData.FILL_BOTH);
gd.widthHint = maxGroupWidth;
specificGroup.setLayoutData(gd);
......
......@@ -28,7 +28,6 @@
package org.jkiss.dbeaver.ui.controls.folders;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.text.source.ISharedTextColors;
import org.eclipse.swt.SWT;
......@@ -43,7 +42,6 @@ import org.eclipse.swt.widgets.*;
import org.jkiss.dbeaver.ui.DBeaverIcons;
import org.jkiss.dbeaver.ui.UIStyles;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.css.CSSUtils;
import java.util.IdentityHashMap;
import java.util.Map;
......@@ -136,17 +134,14 @@ public class TabbedFolderList extends Composite {
}
}
});
addMouseMoveListener(new MouseMoveListener() {
public void mouseMove(MouseEvent e) {
String tooltip = tab.getTooltip();
if (tooltip != null) {
setToolTipText(tooltip);
}
if (!hover) {
hover = true;
redraw();
}
addMouseMoveListener(e -> {
String tooltip = tab.getTooltip();
if (tooltip != null) {
setToolTipText(tooltip);
}
if (!hover) {
hover = true;
redraw();
}
});
addMouseTrackListener(new MouseTrackAdapter() {
......@@ -296,12 +291,7 @@ public class TabbedFolderList extends Composite {
*/
public TopNavigationElement(Composite parent) {
super(parent, SWT.NO_FOCUS);
addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
paint(e);
}
});
addPaintListener(this::paint);
addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent e) {
......@@ -379,12 +369,7 @@ public class TabbedFolderList extends Composite {
*/
public BottomNavigationElement(Composite parent) {
super(parent, SWT.NO_FOCUS);
addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
paint(e);
}
});
addPaintListener(this::paint);
addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent e) {
......@@ -488,19 +473,12 @@ public class TabbedFolderList extends Composite {
computeTopAndBottomTab();
}
});
this.addTraverseListener(new TraverseListener() {
public void keyTraversed(TraverseEvent e) {
handleTraverse(e);
}
});
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
for (Image di : grayedImages.values()) {
UIUtils.dispose(di);
}
grayedImages.clear();
this.addTraverseListener(this::handleTraverse);
addDisposeListener(e -> {
for (Image di : grayedImages.values()) {
UIUtils.dispose(di);
}
grayedImages.clear();
});
}
......@@ -721,17 +699,16 @@ public class TabbedFolderList extends Composite {
Display display = Display.getCurrent();
ISharedTextColors sharedColors = UIUtils.getSharedTextColors();
ColorRegistry colorRegistry = UIUtils.getColorRegistry();
listBackground = UIStyles.getDefaultTextBackground();
Color widgetBackground = getBackground();
if (UIUtils.isInDialog(this) && UIStyles.isDarkTheme()) {
// FIXME: hacking of dark theme
Color widgetBackground;
if (UIStyles.isDarkTheme()) {
// By some reason E4 sets white background in dark theme.
widgetBackground = UIStyles.getDefaultTextBackground();
super.setBackground(widgetBackground);
topNavigationElement.setBackground(widgetBackground);
bottomNavigationElement.setBackground(widgetBackground);
} else {
widgetBackground = getBackground();
}
widgetForeground = UIStyles.getDefaultTextForeground();
widgetDarkShadow = display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
......@@ -779,19 +756,16 @@ public class TabbedFolderList extends Composite {
@Override
public void setBackground(Color color) {
super.setBackground(color);
UIUtils.asyncExec(new Runnable() {
@Override
public void run() {
if (isDisposed()) {
return;
}
initColours();
for (ListElement e : elements) {
e.redraw();
}
topNavigationElement.redraw();
bottomNavigationElement.redraw();
UIUtils.asyncExec(() -> {
if (isDisposed()) {
return;
}
initColours();
for (ListElement e : elements) {
e.redraw();
}
topNavigationElement.redraw();
bottomNavigationElement.redraw();
});
}
......@@ -996,21 +970,13 @@ public class TabbedFolderList extends Composite {
}
});
addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
if (isFocusControl()) {
accessible.setFocus(ACC.CHILDID_SELF);
}
}
});
addListener(SWT.FocusIn, new Listener() {
public void handleEvent(Event event) {
addListener(SWT.Selection, event -> {
if (isFocusControl()) {
accessible.setFocus(ACC.CHILDID_SELF);
}
});
addListener(SWT.FocusIn, event -> accessible.setFocus(ACC.CHILDID_SELF));
}
public void addSelectionListener(SelectionListener listener) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册