Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
314a045
Version bump(s) for 4.39 stream
eclipse-platform-bot Jan 12, 2026
c2654d1
Handle viewer selection color
Christopher-Hermann Jan 9, 2026
abe68b1
Refactor a bit, make the code more compact
fedejeanne Feb 25, 2026
339d07c
Fix hasAdditionalEraseItemListeners: let it skip previous listeners
fedejeanne Feb 25, 2026
27abb7c
Fill only part of the rectangle to help debugging
fedejeanne Feb 25, 2026
9b24f71
Repaint the image manually (fix for Linux)
fedejeanne Feb 26, 2026
d688d34
Make constructor private
fedejeanne Feb 26, 2026
bc866ce
Draw completion proposals always as focused
Christopher-Hermann Feb 12, 2025
095c986
Undo some changes in TableOwnerDrawSupport
fedejeanne Feb 27, 2026
ada2dc8
Move stuff around
fedejeanne Feb 27, 2026
b921c1a
Use the id the match the colors in the color factory
fedejeanne Feb 27, 2026
1ca6ba6
Adapt some comments and remove FQN (use import)
fedejeanne Feb 27, 2026
b268373
Rename method to "install" to match similar methods in other listeners
fedejeanne Feb 27, 2026
81f9cd0
Move method up
fedejeanne Feb 27, 2026
0838f15
Extract private method
fedejeanne Feb 27, 2026
172eb01
Use private method in ColumnViewerSelectionColorListener
fedejeanne Feb 27, 2026
28563b5
Move CompletionDrawSupport to parent package.
fedejeanne Feb 27, 2026
521271e
Remove the install method from TableOwnerDrawSupport
fedejeanne Feb 27, 2026
ef799cc
Rename public methods in ColumnViewerSelectionColorListener
fedejeanne Feb 27, 2026
632a201
Make constant in OwnerDrawLabelProvider more visible and use it
fedejeanne Feb 27, 2026
0ec8982
Rename private method in ColumnViewerSelectionColorListener
fedejeanne Feb 27, 2026
d409d11
Use method getSelectionForegroundColor to avoid code duplication
fedejeanne Feb 27, 2026
1090778
Do not set the foreground color in handleEraseItem.
fedejeanne Feb 27, 2026
27357b4
Version bump(s) for 4.40 stream
eclipse-platform-bot Feb 27, 2026
da2d6fd
Bump minor version of org.eclipse.jface
fedejeanne Feb 27, 2026
8763def
Bump version in @since
fedejeanne Feb 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bundles/org.eclipse.jface.text/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jface.text
Bundle-Version: 3.30.0.qualifier
Bundle-Version: 3.30.100.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*******************************************************************************
* Copyright (c) 2025 SAP SE.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* SAP SE - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.internal.text;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Scrollable;
import org.eclipse.swt.widgets.Table;

import org.eclipse.jface.viewers.ColumnViewerSelectionColorListener;

/**
* Provides custom drawing support for completion proposals. This class ensures that completion
* proposals are always rendered with a focused appearance.
*
* <p>
* This drawing behavior addresses the particular situation where the code completion is triggered
* via keyboard shortcut, leaving the editor focused. In such cases, without this custom drawing
* support, the completion proposal would appear unfocused, leading to a suboptimal coloring.
* </p>
*/
public class CompletionProposalDrawSupport implements Listener {

/**
* Delegate
*/
private final TableOwnerDrawSupport fTableOwnerDrawSupport;

private CompletionProposalDrawSupport(Table table) {
fTableOwnerDrawSupport= new TableOwnerDrawSupport(table);
}

public static void install(Table table) {
CompletionProposalDrawSupport listener= new CompletionProposalDrawSupport(table);

// Since this listener delegates to TableOwnerDrawSupport right after doing
// its own stuff, we need to make sure to listen for all kind of events so
// that the delegation happens even after a No-Op.
table.addListener(SWT.Dispose, listener);
table.addListener(SWT.MeasureItem, listener);
table.addListener(SWT.EraseItem, listener);
table.addListener(SWT.PaintItem, listener);
}

@Override
public void handleEvent(Event event) {

if (event.widget instanceof Control && event.gc != null) {

boolean isSelected= (event.detail & SWT.SELECTED) != 0;

if (event.type == SWT.EraseItem && isSelected) {

final Color backgroundColor= ColumnViewerSelectionColorListener.getSelectionBackgroundColor(event.display, isSelected);
event.gc.setBackground(backgroundColor);

final int width= (event.widget instanceof Scrollable s) ? s.getClientArea().width : event.width;
event.gc.fillRectangle(0, event.y, width, event.height);

// Prevent native selection drawing
event.detail&= ~SWT.SELECTED;

} else if (event.type == SWT.PaintItem) {
final Color foregroundColor= ColumnViewerSelectionColorListener.getSelectionForegroundColor(event.display, isSelected);
event.gc.setForeground(foregroundColor);
}
}

fTableOwnerDrawSupport.handleEvent(event);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@


/**
* Adds owner draw support for tables.
* Adds owner draw support for tables.<br/>
* <br/>
* It has been replaced by {@link CompletionProposalDrawSupport} in 2026-06.
*
* @since 3.4
*/
Expand All @@ -40,14 +42,6 @@ public class TableOwnerDrawSupport implements Listener {

private int fDeltaOfLastMeasure;

public static void install(Table table) {
TableOwnerDrawSupport listener= new TableOwnerDrawSupport(table);
table.addListener(SWT.Dispose, listener);
table.addListener(SWT.MeasureItem, listener);
table.addListener(SWT.EraseItem, listener);
table.addListener(SWT.PaintItem, listener);
}

/**
* Stores the styled ranges in the given table item.
*
Expand All @@ -70,7 +64,7 @@ private static StyleRange[] getStyledRanges(TableItem item, int column) {
return (StyleRange[])item.getData(STYLED_RANGES_KEY + column);
}

private TableOwnerDrawSupport(Table table) {
TableOwnerDrawSupport(Table table) {
int orientation= table.getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
fSharedLayout= new TextLayout(table.getDisplay());
fSharedLayout.setOrientation(orientation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;

import org.eclipse.jface.internal.text.CompletionProposalDrawSupport;
import org.eclipse.jface.internal.text.TableOwnerDrawSupport;
import org.eclipse.jface.preference.JFacePreferences;
import org.eclipse.jface.resource.ColorRegistry;
Expand Down Expand Up @@ -274,7 +275,7 @@ private void createProposalSelector() {

fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled();
if (fIsColoredLabelsSupportEnabled) {
TableOwnerDrawSupport.install(fProposalTable);
CompletionProposalDrawSupport.install(fProposalTable);
}

fProposalTable.setLocation(0, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
import org.eclipse.jface.bindings.keys.KeySequence;
import org.eclipse.jface.bindings.keys.SWTKeySupport;
import org.eclipse.jface.contentassist.IContentAssistSubjectControl;
import org.eclipse.jface.internal.text.CompletionProposalDrawSupport;
import org.eclipse.jface.internal.text.InformationControlReplacer;
import org.eclipse.jface.internal.text.TableOwnerDrawSupport;
import org.eclipse.jface.preference.JFacePreferences;
Expand Down Expand Up @@ -628,7 +629,7 @@ void createProposalSelector() {

fIsColoredLabelsSupportEnabled= fContentAssistant.isColoredLabelsSupportEnabled();
if (fIsColoredLabelsSupportEnabled) {
TableOwnerDrawSupport.install(fProposalTable);
CompletionProposalDrawSupport.install(fProposalTable);
}

fProposalTable.setLocation(0, 0);
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.jface/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jface;singleton:=true
Bundle-Version: 3.39.0.qualifier
Bundle-Version: 3.40.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jface,
Expand Down
Loading
Loading