mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Fix 115999 and 156983 - handle preference changes to hovers and tab policy
This commit is contained in:
parent
d643f4f018
commit
cfabc6acdd
1 changed files with 41 additions and 0 deletions
|
@ -723,6 +723,11 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SPACES_FOR_TABS.equals(property)) {
|
if (SPACES_FOR_TABS.equals(property)) {
|
||||||
|
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
|
||||||
|
String[] types = configuration.getConfiguredContentTypes(asv);
|
||||||
|
for (int i = 0; i < types.length; i++) {
|
||||||
|
asv.setIndentPrefixes(configuration.getIndentPrefixes(asv, types[i]), types[i]);
|
||||||
|
}
|
||||||
if (isTabConversionEnabled())
|
if (isTabConversionEnabled())
|
||||||
startTabConversion();
|
startTabConversion();
|
||||||
else
|
else
|
||||||
|
@ -730,6 +735,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PreferenceConstants.EDITOR_TEXT_HOVER_MODIFIERS.equals(property))
|
||||||
|
updateHoverBehavior();
|
||||||
|
|
||||||
// Not implemented ... for the future.
|
// Not implemented ... for the future.
|
||||||
if (TRANSLATION_TASK_TAGS.equals(event.getProperty())) {
|
if (TRANSLATION_TASK_TAGS.equals(event.getProperty())) {
|
||||||
ISourceViewer sourceViewer= getSourceViewer();
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
|
@ -770,6 +778,39 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Update the hovering behavior depending on the preferences.
|
||||||
|
*/
|
||||||
|
private void updateHoverBehavior() {
|
||||||
|
SourceViewerConfiguration configuration= getSourceViewerConfiguration();
|
||||||
|
String[] types= configuration.getConfiguredContentTypes(getSourceViewer());
|
||||||
|
|
||||||
|
for (int i= 0; i < types.length; i++) {
|
||||||
|
|
||||||
|
String t= types[i];
|
||||||
|
|
||||||
|
ISourceViewer sourceViewer= getSourceViewer();
|
||||||
|
if (sourceViewer instanceof ITextViewerExtension2) {
|
||||||
|
// Remove existing hovers
|
||||||
|
((ITextViewerExtension2)sourceViewer).removeTextHovers(t);
|
||||||
|
|
||||||
|
int[] stateMasks= configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
|
||||||
|
|
||||||
|
if (stateMasks != null) {
|
||||||
|
for (int j= 0; j < stateMasks.length; j++) {
|
||||||
|
int stateMask= stateMasks[j];
|
||||||
|
ITextHover textHover= configuration.getTextHover(sourceViewer, t, stateMask);
|
||||||
|
((ITextViewerExtension2)sourceViewer).setTextHover(textHover, t, stateMask);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ITextHover textHover= configuration.getTextHover(sourceViewer, t);
|
||||||
|
((ITextViewerExtension2)sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* React to changed selection.
|
* React to changed selection.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue