forked from eclipse-platform/eclipse.platform.ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always use focus selection color for code completion proposals
Fixes eclipse-platform#1688
- Loading branch information
1 parent
839895a
commit 292bd9c
Showing
4 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...lipse.jface.text/src/org/eclipse/jface/text/contentassist/CompletionTableDrawSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package org.eclipse.jface.text.contentassist; | ||
|
||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.graphics.Color; | ||
import org.eclipse.swt.widgets.Table; | ||
|
||
import org.eclipse.jface.internal.text.TableOwnerDrawSupport; | ||
|
||
/** | ||
* When a completion table (for example for code completion) is requested by the user, the user | ||
* needs to be able to continue typing in the linked text control. In such cases, the focus is not | ||
* on the completion table. To ensure the selected code completion proposal always displays in the | ||
* correct color, even if the completion table is not focused, the non-focused colors are overridden | ||
* with the focus colors. | ||
*/ | ||
public class CompletionTableDrawSupport extends TableOwnerDrawSupport { | ||
|
||
public static void install(Table table) { | ||
TableOwnerDrawSupport listener= new CompletionTableDrawSupport(table); | ||
table.addListener(SWT.Dispose, listener); | ||
table.addListener(SWT.MeasureItem, listener); | ||
table.addListener(SWT.EraseItem, listener); | ||
table.addListener(SWT.PaintItem, listener); | ||
} | ||
|
||
private CompletionTableDrawSupport(Table table) { | ||
super(table); | ||
} | ||
|
||
@Override | ||
protected Color getSelectedRowBackgroundColorNoFocus() { | ||
return super.getSelectedRowBackgroundColor(); | ||
} | ||
|
||
@Override | ||
protected Color getSelectedRowForegroundColorNoFocus() { | ||
return super.getSelectedRowForegroundColor(); | ||
} | ||
|
||
} |