mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Bug 370762 - Adding support for Remote Semantic Highlighting in the
Remote C/C++ Editor
This commit is contained in:
parent
dbdee9975b
commit
75ff7eb113
2 changed files with 30 additions and 27 deletions
|
@ -45,7 +45,7 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
/**
|
/**
|
||||||
* Highlighting style.
|
* Highlighting style.
|
||||||
*/
|
*/
|
||||||
static class HighlightingStyle {
|
public static class HighlightingStyle {
|
||||||
|
|
||||||
/** Text attribute */
|
/** Text attribute */
|
||||||
private TextAttribute fTextAttribute;
|
private TextAttribute fTextAttribute;
|
||||||
|
@ -94,7 +94,7 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
/**
|
/**
|
||||||
* Highlighted Positions.
|
* Highlighted Positions.
|
||||||
*/
|
*/
|
||||||
static class HighlightedPosition extends Position {
|
public static class HighlightedPosition extends Position {
|
||||||
|
|
||||||
/** Highlighting of the position */
|
/** Highlighting of the position */
|
||||||
private HighlightingStyle fStyle;
|
private HighlightingStyle fStyle;
|
||||||
|
@ -260,30 +260,30 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Semantic highlighting presenter */
|
/** Semantic highlighting presenter */
|
||||||
private SemanticHighlightingPresenter fPresenter;
|
protected SemanticHighlightingPresenter fPresenter;
|
||||||
/** Semantic highlighting reconciler */
|
/** Semantic highlighting reconciler */
|
||||||
private SemanticHighlightingReconciler fReconciler;
|
private SemanticHighlightingReconciler fReconciler;
|
||||||
|
|
||||||
/** Semantic highlightings */
|
/** Semantic highlightings */
|
||||||
private SemanticHighlighting[] fSemanticHighlightings;
|
protected SemanticHighlighting[] fSemanticHighlightings;
|
||||||
/** Highlightings */
|
/** Highlightings */
|
||||||
private HighlightingStyle[] fHighlightings;
|
protected HighlightingStyle[] fHighlightings;
|
||||||
|
|
||||||
/** The editor */
|
/** The editor */
|
||||||
private CEditor fEditor;
|
private CEditor fEditor;
|
||||||
/** The source viewer */
|
/** The source viewer */
|
||||||
private CSourceViewer fSourceViewer;
|
protected CSourceViewer fSourceViewer;
|
||||||
/** The color manager */
|
/** The color manager */
|
||||||
private IColorManager fColorManager;
|
protected IColorManager fColorManager;
|
||||||
/** The preference store */
|
/** The preference store */
|
||||||
private IPreferenceStore fPreferenceStore;
|
protected IPreferenceStore fPreferenceStore;
|
||||||
/** The source viewer configuration */
|
/** The source viewer configuration */
|
||||||
private CSourceViewerConfiguration fConfiguration;
|
protected CSourceViewerConfiguration fConfiguration;
|
||||||
/** The presentation reconciler */
|
/** The presentation reconciler */
|
||||||
private CPresentationReconciler fPresentationReconciler;
|
protected CPresentationReconciler fPresentationReconciler;
|
||||||
|
|
||||||
/** The hard-coded ranges */
|
/** The hard-coded ranges */
|
||||||
private HighlightedRange[][] fHardcodedRanges;
|
protected HighlightedRange[][] fHardcodedRanges;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Install the semantic highlighting on the given editor infrastructure
|
* Install the semantic highlighting on the given editor infrastructure
|
||||||
|
@ -347,7 +347,7 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
*
|
*
|
||||||
* @return the hard-coded positions
|
* @return the hard-coded positions
|
||||||
*/
|
*/
|
||||||
private HighlightedPosition[] createHardcodedPositions() {
|
protected HighlightedPosition[] createHardcodedPositions() {
|
||||||
List<HighlightedPosition> positions= new ArrayList<HighlightedPosition>();
|
List<HighlightedPosition> positions= new ArrayList<HighlightedPosition>();
|
||||||
for (int i= 0; i < fHardcodedRanges.length; i++) {
|
for (int i= 0; i < fHardcodedRanges.length; i++) {
|
||||||
HighlightedRange range= null;
|
HighlightedRange range= null;
|
||||||
|
@ -421,14 +421,14 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
/**
|
/**
|
||||||
* @return <code>true</code> iff semantic highlighting is enabled in the preferences
|
* @return <code>true</code> iff semantic highlighting is enabled in the preferences
|
||||||
*/
|
*/
|
||||||
private boolean isEnabled() {
|
protected boolean isEnabled() {
|
||||||
return SemanticHighlightings.isEnabled(fPreferenceStore);
|
return SemanticHighlightings.isEnabled(fPreferenceStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize semantic highlightings.
|
* Initialize semantic highlightings.
|
||||||
*/
|
*/
|
||||||
private void initializeHighlightings() {
|
protected void initializeHighlightings() {
|
||||||
fSemanticHighlightings= SemanticHighlightings.getSemanticHighlightings();
|
fSemanticHighlightings= SemanticHighlightings.getSemanticHighlightings();
|
||||||
fHighlightings= new HighlightingStyle[fSemanticHighlightings.length];
|
fHighlightings= new HighlightingStyle[fSemanticHighlightings.length];
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
/**
|
/**
|
||||||
* Dispose the semantic highlightings.
|
* Dispose the semantic highlightings.
|
||||||
*/
|
*/
|
||||||
private void disposeHighlightings() {
|
protected void disposeHighlightings() {
|
||||||
for (int i= 0, n= fSemanticHighlightings.length; i < n; i++)
|
for (int i= 0, n= fSemanticHighlightings.length; i < n; i++)
|
||||||
removeColor(SemanticHighlightings.getColorPreferenceKey(fSemanticHighlightings[i]));
|
removeColor(SemanticHighlightings.getColorPreferenceKey(fSemanticHighlightings[i]));
|
||||||
|
|
||||||
|
@ -480,10 +480,11 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
* Handle the given property change event
|
* Handle the given property change event
|
||||||
*
|
*
|
||||||
* @param event The event
|
* @param event The event
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private void handlePropertyChangeEvent(PropertyChangeEvent event) {
|
protected boolean handlePropertyChangeEvent(PropertyChangeEvent event) {
|
||||||
if (fPreferenceStore == null)
|
if (fPreferenceStore == null)
|
||||||
return; // Uninstalled during event notification
|
return false; // Uninstalled during event notification
|
||||||
|
|
||||||
if (fConfiguration != null)
|
if (fConfiguration != null)
|
||||||
fConfiguration.handlePropertyChangeEvent(event);
|
fConfiguration.handlePropertyChangeEvent(event);
|
||||||
|
@ -496,7 +497,7 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isEnabled())
|
if (!isEnabled())
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
boolean refreshNeeded= false;
|
boolean refreshNeeded= false;
|
||||||
|
|
||||||
|
@ -554,6 +555,8 @@ public class SemanticHighlightingManager implements IPropertyChangeListener {
|
||||||
|
|
||||||
if (refreshNeeded && fReconciler != null)
|
if (refreshNeeded && fReconciler != null)
|
||||||
fReconciler.refresh();
|
fReconciler.refresh();
|
||||||
|
|
||||||
|
return refreshNeeded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adaptToEnablementChange(HighlightingStyle highlighting, PropertyChangeEvent event) {
|
private void adaptToEnablementChange(HighlightingStyle highlighting, PropertyChangeEvent event) {
|
||||||
|
|
|
@ -287,18 +287,18 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
/** The C editor this semantic highlighting reconciler is installed on */
|
/** The C editor this semantic highlighting reconciler is installed on */
|
||||||
private CEditor fEditor;
|
private CEditor fEditor;
|
||||||
/** The semantic highlighting presenter */
|
/** The semantic highlighting presenter */
|
||||||
private SemanticHighlightingPresenter fPresenter;
|
protected SemanticHighlightingPresenter fPresenter;
|
||||||
/** Semantic highlightings */
|
/** Semantic highlightings */
|
||||||
private SemanticHighlighting[] fSemanticHighlightings;
|
protected SemanticHighlighting[] fSemanticHighlightings;
|
||||||
/** Highlightings */
|
/** Highlightings */
|
||||||
private HighlightingStyle[] fHighlightings;
|
private HighlightingStyle[] fHighlightings;
|
||||||
|
|
||||||
/** Background job's added highlighted positions */
|
/** Background job's added highlighted positions */
|
||||||
private List<HighlightedPosition> fAddedPositions= new ArrayList<HighlightedPosition>();
|
protected List<HighlightedPosition> fAddedPositions= new ArrayList<HighlightedPosition>();
|
||||||
/** Background job's removed highlighted positions */
|
/** Background job's removed highlighted positions */
|
||||||
private List<HighlightedPosition> fRemovedPositions= new ArrayList<HighlightedPosition>();
|
protected List<HighlightedPosition> fRemovedPositions= new ArrayList<HighlightedPosition>();
|
||||||
/** Number of removed positions */
|
/** Number of removed positions */
|
||||||
private int fNOfRemovedPositions;
|
protected int fNOfRemovedPositions;
|
||||||
|
|
||||||
/** Background job */
|
/** Background job */
|
||||||
private Job fJob;
|
private Job fJob;
|
||||||
|
@ -313,9 +313,9 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
private boolean fIsReconciling= false;
|
private boolean fIsReconciling= false;
|
||||||
|
|
||||||
/** The semantic highlighting presenter - cache for background thread, only valid during {@link #reconciled(IASTTranslationUnit, boolean, IProgressMonitor)} */
|
/** The semantic highlighting presenter - cache for background thread, only valid during {@link #reconciled(IASTTranslationUnit, boolean, IProgressMonitor)} */
|
||||||
private SemanticHighlightingPresenter fJobPresenter;
|
protected SemanticHighlightingPresenter fJobPresenter;
|
||||||
/** Semantic highlightings - cache for background thread, only valid during {@link #reconciled(IASTTranslationUnit, boolean, IProgressMonitor)} */
|
/** Semantic highlightings - cache for background thread, only valid during {@link #reconciled(IASTTranslationUnit, boolean, IProgressMonitor)} */
|
||||||
private SemanticHighlighting[] fJobSemanticHighlightings;
|
protected SemanticHighlighting[] fJobSemanticHighlightings;
|
||||||
/** Highlightings - cache for background thread, only valid during {@link #reconciled(IASTTranslationUnit, boolean, IProgressMonitor)} */
|
/** Highlightings - cache for background thread, only valid during {@link #reconciled(IASTTranslationUnit, boolean, IProgressMonitor)} */
|
||||||
private HighlightingStyle[] fJobHighlightings;
|
private HighlightingStyle[] fJobHighlightings;
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
/**
|
/**
|
||||||
* Start reconciling positions.
|
* Start reconciling positions.
|
||||||
*/
|
*/
|
||||||
private void startReconcilingPositions() {
|
protected void startReconcilingPositions() {
|
||||||
fJobPresenter.addAllPositions(fRemovedPositions);
|
fJobPresenter.addAllPositions(fRemovedPositions);
|
||||||
fNOfRemovedPositions= fRemovedPositions.size();
|
fNOfRemovedPositions= fRemovedPositions.size();
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
/**
|
/**
|
||||||
* Stop reconciling positions.
|
* Stop reconciling positions.
|
||||||
*/
|
*/
|
||||||
private void stopReconcilingPositions() {
|
protected void stopReconcilingPositions() {
|
||||||
fRemovedPositions.clear();
|
fRemovedPositions.clear();
|
||||||
fNOfRemovedPositions= 0;
|
fNOfRemovedPositions= 0;
|
||||||
fAddedPositions.clear();
|
fAddedPositions.clear();
|
||||||
|
|
Loading…
Add table
Reference in a new issue