Changeset 3383 for devel-tools/trunk


Ignore:
Timestamp:
Feb 7, 2008, 12:24:25 AM (13 years ago)
Author:
yura
Message:
Location:
devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • devel-tools/trunk/eclipse/org.refal.plus.rfpdt.editor/src/org/refal/plus/rfpdt/editor/RfpSourceViewerConfiguration.java

    r3382 r3383  
    99import org.eclipse.jface.text.reconciler.IReconciler;
    1010import org.eclipse.jface.text.reconciler.MonoReconciler;
     11import org.eclipse.jface.text.source.Annotation;
     12import org.eclipse.jface.text.source.DefaultAnnotationHover;
    1113import org.eclipse.jface.text.source.IAnnotationHover;
    1214import org.eclipse.jface.text.source.ISourceViewer;
    1315import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
     16import org.eclipse.ui.texteditor.MarkerAnnotation;
    1417import org.refal.plus.rfpdt.editor.preferences.IPreferenceConstants;
    1518
    1619public class RfpSourceViewerConfiguration extends TextSourceViewerConfiguration {
    17     private final RfpDoubleClickStrategy doubleClickStrategy;
    18     private final RfpAutoIndentStrategy autoIngentStrategy;
     20    private static final IAnnotationHover annotationHover = new DefaultAnnotationHover() {
     21        protected boolean isIncluded (Annotation annotation) {
     22            return annotation instanceof MarkerAnnotation;
     23        }
     24    };
     25    private static final String[] configuredContentTypes = { IDocument.DEFAULT_CONTENT_TYPE,
     26            IRfpPartitions.SINGLE_LINE_COMMENT, IRfpPartitions.MULTI_LINE_COMMENT, IRfpPartitions.WORD,
     27            IRfpPartitions.CHARACTER };
     28    private static final String[] defaultPrefixes = { "//" };
     29    private static final ITextDoubleClickStrategy textDoubleClickStrategy = new RfpDoubleClickStrategy();
     30
    1931    private final RfpEditor editor;
     32    private final IAutoEditStrategy[] autoIngentStrategies;
    2033
    2134    public RfpSourceViewerConfiguration (RfpEditor editor, IPreferenceStore store) {
    2235        super(store);
    23         doubleClickStrategy = new RfpDoubleClickStrategy();
    24         autoIngentStrategy = new RfpAutoIndentStrategy(store);
    2536        this.editor = editor;
     37        autoIngentStrategies = new IAutoEditStrategy[] { new RfpAutoIndentStrategy(store) };
    2638    }
    2739
    28     // public IInformationPresenter getInformationPresenter (ISourceViewer sourceViewer) {
    29     // InformationPresenter informationPresenter = new InformationPresenter(this
    30     // .getInformationControlCreator(sourceViewer));
    31     // informationPresenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
    32     // informationPresenter.setInformationProvider(new IInformationProvider() {
    33     // public String getInformation (ITextViewer textViewer, IRegion subject) {
    34     // return "<html><body><p><b>123</b></p></body></html>";
    35     // }
    36     //
    37     // public IRegion getSubject (ITextViewer textViewer, int offset) {
    38     // return new Region(offset, 1);
    39     // }
    40     // }, IDocument.DEFAULT_CONTENT_TYPE);
    41     // informationPresenter.setSizeConstraints(60, 10, true, true);
    42     // return informationPresenter;
    43     // Display.getDefault().asyncExec(new Runnable() {
    44     // public void run () {
    45     // RfpSourceViewerConfiguration.x.setOffset(10);
    46     // RfpSourceViewerConfiguration.x.showInformation();
    47     //            }
    48     //        });
    49     //    }
    50 
    5140    public IAnnotationHover getAnnotationHover (ISourceViewer sourceViewer) {
    52         return new RfpAnnotationHover();
     41        return annotationHover;
    5342    }
    5443
    5544    public IAutoEditStrategy[] getAutoEditStrategies (ISourceViewer sourceViewer, String contentType) {
    56         return new IAutoEditStrategy[] { autoIngentStrategy };
     45        return autoIngentStrategies;
    5746    }
    5847
    5948    public String[] getConfiguredContentTypes (ISourceViewer sourceViewer) {
    60         return new String[] { IDocument.DEFAULT_CONTENT_TYPE, IRfpPartitions.SINGLE_LINE_COMMENT,
    61                 IRfpPartitions.MULTI_LINE_COMMENT, IRfpPartitions.WORD, IRfpPartitions.CHARACTER };
     49        return configuredContentTypes;
    6250    }
    6351
     
    6755
    6856    public String[] getDefaultPrefixes (ISourceViewer sourceViewer, String contentType) {
    69         String[] defaultPrefixes = { "//" };
    7057        return defaultPrefixes;
    7158    }
    7259
    7360    public ITextDoubleClickStrategy getDoubleClickStrategy (ISourceViewer sourceViewer, String contentType) {
    74         return doubleClickStrategy;
     61        return textDoubleClickStrategy;
    7562    }
    7663
Note: See TracChangeset for help on using the changeset viewer.