mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 01:05:38 +02:00
Patch from Thomas Fletcher
- Restore bracket matching behaviour in the editor and use parent class code for setting up the editor's OverviewRuler.
This commit is contained in:
parent
49b97b4f31
commit
8f92139ae5
2 changed files with 12 additions and 22 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2004-05-27 Alain Magloire
|
||||||
|
|
||||||
|
Patch from Thomas Fletcher
|
||||||
|
- Restore bracket matching behaviour in the editor and use parent
|
||||||
|
class code for setting up the editor's OverviewRuler.
|
||||||
|
|
||||||
2004-05-26 Andrew Niefer
|
2004-05-26 Andrew Niefer
|
||||||
Selection search: if searching on a function, use ASTUtil.getFunctionParameterTypes to create a
|
Selection search: if searching on a function, use ASTUtil.getFunctionParameterTypes to create a
|
||||||
search pattern to find functions with the same parameters. Also, for AST nodes that have a
|
search pattern to find functions with the same parameters. Also, for AST nodes that have a
|
||||||
|
|
|
@ -53,7 +53,6 @@ import org.eclipse.jface.text.source.IOverviewRuler;
|
||||||
import org.eclipse.jface.text.source.ISharedTextColors;
|
import org.eclipse.jface.text.source.ISharedTextColors;
|
||||||
import org.eclipse.jface.text.source.ISourceViewer;
|
import org.eclipse.jface.text.source.ISourceViewer;
|
||||||
import org.eclipse.jface.text.source.IVerticalRuler;
|
import org.eclipse.jface.text.source.IVerticalRuler;
|
||||||
import org.eclipse.jface.text.source.OverviewRuler;
|
|
||||||
import org.eclipse.jface.text.source.SourceViewer;
|
import org.eclipse.jface.text.source.SourceViewer;
|
||||||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
@ -81,13 +80,11 @@ import org.eclipse.ui.part.EditorActionBarContributor;
|
||||||
import org.eclipse.ui.part.IShowInSource;
|
import org.eclipse.ui.part.IShowInSource;
|
||||||
import org.eclipse.ui.part.ShowInContext;
|
import org.eclipse.ui.part.ShowInContext;
|
||||||
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
import org.eclipse.ui.texteditor.AbstractTextEditor;
|
||||||
import org.eclipse.ui.texteditor.AnnotationPreference;
|
|
||||||
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
import org.eclipse.ui.texteditor.ChainedPreferenceStore;
|
||||||
import org.eclipse.ui.texteditor.ContentAssistAction;
|
import org.eclipse.ui.texteditor.ContentAssistAction;
|
||||||
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
import org.eclipse.ui.texteditor.IEditorStatusLine;
|
||||||
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
import org.eclipse.ui.texteditor.MarkerAnnotation;
|
||||||
import org.eclipse.ui.texteditor.MarkerAnnotationPreferences;
|
|
||||||
import org.eclipse.ui.texteditor.MarkerUtilities;
|
import org.eclipse.ui.texteditor.MarkerUtilities;
|
||||||
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
|
import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
|
||||||
import org.eclipse.ui.texteditor.TextOperationAction;
|
import org.eclipse.ui.texteditor.TextOperationAction;
|
||||||
|
@ -117,15 +114,13 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
/** The mouse listener */
|
/** The mouse listener */
|
||||||
private MouseClickListener fMouseListener;
|
private MouseClickListener fMouseListener;
|
||||||
|
|
||||||
protected final static char[] BRACKETS = { '{', '}', '(', ')', '[', ']' };
|
protected final static char[] BRACKETS = { '{', '}', '(', ')', '[', ']', '<', '>' };
|
||||||
|
|
||||||
protected CPairMatcher fBracketMatcher = new CPairMatcher(BRACKETS);
|
protected CPairMatcher fBracketMatcher = new CPairMatcher(BRACKETS);
|
||||||
|
|
||||||
/** The editor's tab converter */
|
/** The editor's tab converter */
|
||||||
private TabConverter fTabConverter;
|
private TabConverter fTabConverter;
|
||||||
|
|
||||||
private MarkerAnnotationPreferences fAnnotationPreferences;
|
|
||||||
|
|
||||||
/** Listener to annotation model changes that updates the error tick in the tab image */
|
/** Listener to annotation model changes that updates the error tick in the tab image */
|
||||||
private CEditorErrorTickUpdater fCEditorErrorTickUpdater;
|
private CEditorErrorTickUpdater fCEditorErrorTickUpdater;
|
||||||
|
|
||||||
|
@ -167,9 +162,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
|
* @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#initializeEditor()
|
||||||
*/
|
*/
|
||||||
protected void initializeEditor() {
|
protected void initializeEditor() {
|
||||||
//@@@ We should be able to get this from our parent
|
|
||||||
fAnnotationPreferences = new MarkerAnnotationPreferences();
|
|
||||||
|
|
||||||
CTextTools textTools = CUIPlugin.getDefault().getTextTools();
|
CTextTools textTools = CUIPlugin.getDefault().getTextTools();
|
||||||
setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
|
setSourceViewerConfiguration(new CSourceViewerConfiguration(textTools, this));
|
||||||
setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
|
setDocumentProvider(CUIPlugin.getDefault().getDocumentProvider());
|
||||||
|
@ -485,8 +477,6 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
stopTabConversion();
|
stopTabConversion();
|
||||||
disableBrowserLikeLinks();
|
disableBrowserLikeLinks();
|
||||||
|
|
||||||
fAnnotationPreferences = null;
|
|
||||||
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,16 +906,8 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
|
|
||||||
fAnnotationAccess = createAnnotationAccess();
|
fAnnotationAccess = createAnnotationAccess();
|
||||||
|
|
||||||
//TODO: TF NOTE: This can be greatly cleaned up using the parent createOverviewRuler method
|
|
||||||
//It will also totally get rid of the need for the fAnnotationPreferences in this object
|
|
||||||
ISharedTextColors sharedColors = CUIPlugin.getDefault().getSharedTextColors();
|
ISharedTextColors sharedColors = CUIPlugin.getDefault().getSharedTextColors();
|
||||||
fOverviewRuler = new OverviewRuler(fAnnotationAccess, VERTICAL_RULER_WIDTH, sharedColors);
|
fOverviewRuler = createOverviewRuler(sharedColors);
|
||||||
Iterator e = fAnnotationPreferences.getAnnotationPreferences().iterator();
|
|
||||||
while (e.hasNext()) {
|
|
||||||
AnnotationPreference preference = (AnnotationPreference) e.next();
|
|
||||||
if (preference.contributesToHeader())
|
|
||||||
fOverviewRuler.addHeaderAnnotationType(preference.getAnnotationType());
|
|
||||||
}
|
|
||||||
|
|
||||||
ISourceViewer sourceViewer =
|
ISourceViewer sourceViewer =
|
||||||
new AdaptedSourceViewer(
|
new AdaptedSourceViewer(
|
||||||
|
@ -940,8 +922,10 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS
|
||||||
|
|
||||||
configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
|
configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
|
||||||
|
|
||||||
//TODO: TF NOTE: Add the bracket matching back in here!
|
//Enhance the stock source viewer decorator with a bracket matcher
|
||||||
|
fSourceViewerDecorationSupport.setCharacterPairMatcher(fBracketMatcher);
|
||||||
|
fSourceViewerDecorationSupport.setMatchingCharacterPainterPreferenceKeys(MATCHING_BRACKETS, MATCHING_BRACKETS_COLOR);
|
||||||
|
|
||||||
return sourceViewer;
|
return sourceViewer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue