Skip to content

Commit

Permalink
add win32.aarch64 platform build
Browse files Browse the repository at this point in the history
including merge of PR eclipse-platform#1690
  • Loading branch information
chirontt committed Apr 16, 2024
1 parent e987ac1 commit 6644bc0
Show file tree
Hide file tree
Showing 11 changed files with 184 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package org.eclipse.jface.viewers;

import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Scrollable;

/**
* EraseItem event listener that takes care of coloring the selection color of
* column viewers. The coloring is only applied if no other erase item listener
* is registered for the viewer. If other erase item listeners are registers,
* most probably a other customer coloring is applied and should not be
* overwritten.
*
* @since 3.4
* @see FocusCellOwnerDrawHighlighter
*/
public class ColumnViewerSelectionColorListener implements Listener {

/**
* Registers an erase item event listener that takes care of coloring the
* selection color of the given viewer.
*
* @param viewer The viewer that should be colored
*/
public static void addListenerToViewer(StructuredViewer viewer) {
viewer.getControl().addListener(SWT.EraseItem, new ColumnViewerSelectionColorListener());
}

@Override
public void handleEvent(Event event) {
if ((event.detail & SWT.SELECTED) == 0) {
return; /* item not selected */
}

Listener[] eraseItemListeners = event.widget.getListeners(SWT.EraseItem);
if (eraseItemListeners.length != 1) {
return; /* other eraseItemListener exists, do not apply coloring */
}

GC gc = event.gc;
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
if (event.widget instanceof Control control && control.isFocusControl()) {
gc.setBackground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND")); //$NON-NLS-1$
gc.setForeground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND")); //$NON-NLS-1$
} else {
gc.setBackground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND_NO_FOCUS")); //$NON-NLS-1$
gc.setForeground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND_NO_FOCUS")); //$NON-NLS-1$
}

int width = event.width;
if (event.widget instanceof Scrollable scrollable) {
width = scrollable.getClientArea().width;
}

gc.fillRectangle(0, event.y, width, event.height);

event.detail &= ~SWT.SELECTED;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package org.eclipse.jface.viewers;

import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.Util;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
Expand Down Expand Up @@ -112,6 +114,8 @@ private void removeSelectionInformation(Event event, ViewerCell cell) {
// fix this issue, the background must be overwridden
gc.setBackground(cell.getViewerRow().getBackground(cell.getColumnIndex()));
gc.fillRectangle(cell.getBounds());
} else {
gc.setAlpha(0); // Don't draw background to keep cell coloring of theme
}
gc.setForeground(cell.getViewerRow().getForeground(cell.getColumnIndex()));
event.detail &= ~SWT.SELECTED;
Expand Down Expand Up @@ -151,8 +155,8 @@ private void hookListener(final ColumnViewer viewer) {
* @return the color or <code>null</code> to use the default
*/
protected Color getSelectedCellBackgroundColor(ViewerCell cell) {
return removeNonFocusedSelectionInformation ? null
: cell.getItem().getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
return colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND"); //$NON-NLS-1$
}

/**
Expand All @@ -164,7 +168,8 @@ protected Color getSelectedCellBackgroundColor(ViewerCell cell) {
* @return the color or <code>null</code> to use the default
*/
protected Color getSelectedCellForegroundColor(ViewerCell cell) {
return null;
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
return colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND"); //$NON-NLS-1$
}

/**
Expand All @@ -178,7 +183,8 @@ protected Color getSelectedCellForegroundColor(ViewerCell cell) {
* @since 3.4
*/
protected Color getSelectedCellForegroundColorNoFocus(ViewerCell cell) {
return null;
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
return colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND_NO_FOCUS"); //$NON-NLS-1$
}

/**
Expand All @@ -192,7 +198,8 @@ protected Color getSelectedCellForegroundColorNoFocus(ViewerCell cell) {
* @since 3.4
*/
protected Color getSelectedCellBackgroundColorNoFocus(ViewerCell cell) {
return null;
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
return colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND_NO_FOCUS"); //$NON-NLS-1$
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import java.util.HashSet;
import java.util.Set;

import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Rectangle;
Expand Down Expand Up @@ -166,20 +168,16 @@ public void update(ViewerCell cell) {
}

/**
* Handle the erase event. The default implementation colors the background
* of selected areas with {@link SWT#COLOR_LIST_SELECTION} and foregrounds
* with {@link SWT#COLOR_LIST_SELECTION_TEXT}. Note that this
* implementation causes non-native behavior on some platforms. Subclasses
* should override this method and <b>not</b> call the super
* Handle the erase event. The default implementation colors the background of
* selected areas with "org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND" and
* foregrounds with "org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND". Note
* that this implementation causes non-native behavior on some platforms.
* Subclasses should override this method and <b>not</b> call the super
* implementation.
*
* @param event
* the erase event
* @param element
* the model object
* @param event the erase event
* @param element the model object
* @see SWT#EraseItem
* @see SWT#COLOR_LIST_SELECTION
* @see SWT#COLOR_LIST_SELECTION_TEXT
*/
protected void erase(Event event, Object element) {

Expand All @@ -189,11 +187,16 @@ protected void erase(Event event, Object element) {
Color oldForeground = event.gc.getForeground();
Color oldBackground = event.gc.getBackground();

event.gc.setBackground(event.item.getDisplay().getSystemColor(
SWT.COLOR_LIST_SELECTION));
event.gc.setForeground(event.item.getDisplay().getSystemColor(
SWT.COLOR_LIST_SELECTION_TEXT));
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
if (event.widget instanceof Control control && control.isFocusControl()) {
event.gc.setBackground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND")); //$NON-NLS-1$
event.gc.setForeground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND")); //$NON-NLS-1$
} else {
event.gc.setBackground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND_NO_FOCUS")); //$NON-NLS-1$
event.gc.setForeground(colorRegistry.get("org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND_NO_FOCUS")); //$NON-NLS-1$
}
event.gc.fillRectangle(bounds);

/* restore the old GC colors */
event.gc.setForeground(oldForeground);
event.gc.setBackground(oldBackground);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ protected void erase(Event event, Object element) {
// info has been set by 'update': announce that we paint ourselves
event.detail &= ~SWT.FOREGROUND;
}
super.erase(event, element);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public TableViewer(Composite parent, int style) {
public TableViewer(Table table) {
this.table = table;
hookControl(table);
overwriteSelectionColor();
}

@Override
Expand Down Expand Up @@ -507,4 +508,13 @@ void handleExpandableNodeClicked(Widget w) {
}
}

/**
* The color of the selected item is drawn by the OS. On some OS the color might
* be not accessible. To fix this issue the background color for selected items
* is drawn in a custom method.
*/
private void overwriteSelectionColor() {
ColumnViewerSelectionColorListener.addListenerToViewer(this);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public TreeViewer(Tree tree) {
super();
this.tree = tree;
hookControl(tree);
overwriteSelectionColor();
}

@Override
Expand Down Expand Up @@ -1188,4 +1189,13 @@ Object getLastElement(Widget parent) {
}
return items[length - 1].getData();
}

/**
* The color of the selected item is drawn by the OS. On some OS the color might
* be not accessible. To fix this issue the background color for selected items
* is drawn in a custom method.
*/
private void overwriteSelectionColor() {
ColumnViewerSelectionColorListener.addListenerToViewer(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ IEclipsePreferences#org-eclipse-ui-workbench:org-eclipse-ui-themes { /* pseudo a
'org.eclipse.ui.workbench.FORM_HEADING_ERROR_COLOR=255,110,110'
'org.eclipse.ui.workbench.FORM_HEADING_WARNING_COLOR=255,200,0'
'org.eclipse.ui.workbench.FORM_HEADING_INFO_COLOR=170,170,170'
'org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND=255,255,255'
'org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND=0,90,210'
'org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND_NO_FOCUS=227,227,227'
'org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND_NO_FOCUS=70,70,70'
'ERROR_COLOR=247,68,117'
'HYPERLINK_COLOR=111,197,238'
'INCOMING_COLOR=31,179,235'
Expand Down
9 changes: 9 additions & 0 deletions bundles/org.eclipse.ui/plugin.properties
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,15 @@ Color.showKeysForegroundDesc=Color for foreground of the control to visualize pr
Color.showKeysBackground=Keys background color
Color.showKeysBackgroundDesc=Color for background of the control to visualize pressed keys

Color.selectedCellForeground=Selection foreground color for cell viewer
Color.selectedCellForegroundDesc=The selection foreground color of a cell viewer
Color.selectedCellBackground=Selection background color for cell viewer
Color.selectedCellBackgroundDesc=The selection background color of a cell viewer
Color.selectedCellForegroundNoFocus=Selection foreground color for cell viewer without focus
Color.selectedCellForegroundNoFocusDesc=The selection foreground color of a cell viewer without focus
Color.selectedCellBackgroundNoFocus=Selection background color for cell viewer without focus
Color.selectedCellBackgroundNoFocusDesc=The selection background color of a cell viewer without focus

ThemeName.SystemDefault = Reduced Palette
HighContrast.ThemeDescription = A theme that takes all of its values from the system settings.

Expand Down
40 changes: 40 additions & 0 deletions bundles/org.eclipse.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2054,6 +2054,46 @@
%Color.showKeysBackgroundDesc
</description>
</colorDefinition>
<colorDefinition
id="org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND"
isEditable="true"
categoryId="org.eclipse.ui.workbenchMisc"
label="%Color.selectedCellForeground"
value="255,255,255">
<description>
%Color.selectedCellForegroundDesc
</description>
</colorDefinition>
<colorDefinition
id="org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND"
isEditable="true"
categoryId="org.eclipse.ui.workbenchMisc"
label="%Color.selectedCellBackground"
value="0,90,210">
<description>
%Color.selectedCellBackgroundDesc
</description>
</colorDefinition>
<colorDefinition
id="org.eclipse.ui.workbench.SELECTED_CELL_FOREGROUND_NO_FOCUS"
isEditable="true"
categoryId="org.eclipse.ui.workbenchMisc"
label="%Color.selectedCellForegroundNoFocus"
value="0,0,0">
<description>
%Color.selectedCellForegroundNoFocusDesc
</description>
</colorDefinition>
<colorDefinition
id="org.eclipse.ui.workbench.SELECTED_CELL_BACKGROUND_NO_FOCUS"
isEditable="true"
categoryId="org.eclipse.ui.workbenchMisc"
label="%Color.selectedCellBackgroundNoFocus"
value="220,220,220">
<description>
%Color.selectedCellBackgroundNoFocusDesc
</description>
</colorDefinition>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
Expand Down
14 changes: 14 additions & 0 deletions features/org.eclipse.e4.rcp/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@
arch="x86_64"
version="0.0.0"/>

<plugin
id="org.eclipse.equinox.launcher.win32.win32.aarch64"
os="win32"
ws="win32"
arch="aarch64"
version="0.0.0"/>

<plugin
id="org.eclipse.equinox.launcher.win32.win32.x86_64"
os="win32"
Expand All @@ -228,6 +235,13 @@
id="org.eclipse.swt"
version="0.0.0"/>

<plugin
id="org.eclipse.swt.win32.win32.aarch64"
os="win32"
ws="win32"
arch="aarch64"
version="0.0.0"/>

<plugin
id="org.eclipse.swt.win32.win32.x86_64"
os="win32"
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<plugin id="org.eclipse.equinox.launcher.gtk.linux.ppc64le" />
<plugin id="org.eclipse.equinox.launcher.gtk.linux.aarch64" />
<plugin id="org.eclipse.equinox.launcher.gtk.linux.x86_64" />
<plugin id="org.eclipse.equinox.launcher.win32.win32.aarch64" />
<plugin id="org.eclipse.equinox.launcher.win32.win32.x86_64" />
</excludes>
</configuration>
Expand Down

0 comments on commit 6644bc0

Please sign in to comment.