1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Workaround for 195808: ProjectionViewer: Toggling between segmented and projection mode can fail

This commit is contained in:
Anton Leherbauer 2007-07-09 12:43:01 +00:00
parent f695e81bd6
commit bf4290500d
2 changed files with 28 additions and 0 deletions

View file

@ -2592,6 +2592,7 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
fOpenInViewGroup.fillActionBars(actionBars);
fRefactoringActionGroup.fillActionBars(actionBars);
fGenerateActionGroup.fillActionBars(actionBars);
fFoldingGroup.updateActionBars();
}
/*

View file

@ -99,6 +99,11 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
* @since 4.0
*/
private boolean fIsSetVisibleDocumentDelayed;
/**
* Whether projection mode was enabled when switching to segmented mode.
* Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=195808
*/
private boolean fWasProjectionMode;
/**
* Creates new source viewer.
@ -420,4 +425,26 @@ public class CSourceViewer extends ProjectionViewer implements IPropertyChangeLi
return null;
}
/*
* @see org.eclipse.jface.text.source.projection.ProjectionViewer#setVisibleRegion(int, int)
*/
public void setVisibleRegion(int start, int length) {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=195808
if (!fWasProjectionMode && isProjectionMode()) {
fWasProjectionMode= true;
}
super.setVisibleRegion(start, length);
}
/*
* @see org.eclipse.jface.text.source.projection.ProjectionViewer#resetVisibleRegion()
*/
public void resetVisibleRegion() {
super.resetVisibleRegion();
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=195808
if (fWasProjectionMode) {
fWasProjectionMode= false;
enableProjection();
}
}
}