Changeset 3383 for devel-tools/trunk
- Timestamp:
- Feb 7, 2008, 12:24:25 AM (13 years ago)
- 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 9 9 import org.eclipse.jface.text.reconciler.IReconciler; 10 10 import org.eclipse.jface.text.reconciler.MonoReconciler; 11 import org.eclipse.jface.text.source.Annotation; 12 import org.eclipse.jface.text.source.DefaultAnnotationHover; 11 13 import org.eclipse.jface.text.source.IAnnotationHover; 12 14 import org.eclipse.jface.text.source.ISourceViewer; 13 15 import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; 16 import org.eclipse.ui.texteditor.MarkerAnnotation; 14 17 import org.refal.plus.rfpdt.editor.preferences.IPreferenceConstants; 15 18 16 19 public 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 19 31 private final RfpEditor editor; 32 private final IAutoEditStrategy[] autoIngentStrategies; 20 33 21 34 public RfpSourceViewerConfiguration (RfpEditor editor, IPreferenceStore store) { 22 35 super(store); 23 doubleClickStrategy = new RfpDoubleClickStrategy();24 autoIngentStrategy = new RfpAutoIndentStrategy(store);25 36 this.editor = editor; 37 autoIngentStrategies = new IAutoEditStrategy[] { new RfpAutoIndentStrategy(store) }; 26 38 } 27 39 28 // public IInformationPresenter getInformationPresenter (ISourceViewer sourceViewer) {29 // InformationPresenter informationPresenter = new InformationPresenter(this30 // .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 51 40 public IAnnotationHover getAnnotationHover (ISourceViewer sourceViewer) { 52 return new RfpAnnotationHover();41 return annotationHover; 53 42 } 54 43 55 44 public IAutoEditStrategy[] getAutoEditStrategies (ISourceViewer sourceViewer, String contentType) { 56 return new IAutoEditStrategy[] { autoIngentStrategy };45 return autoIngentStrategies; 57 46 } 58 47 59 48 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; 62 50 } 63 51 … … 67 55 68 56 public String[] getDefaultPrefixes (ISourceViewer sourceViewer, String contentType) { 69 String[] defaultPrefixes = { "//" };70 57 return defaultPrefixes; 71 58 } 72 59 73 60 public ITextDoubleClickStrategy getDoubleClickStrategy (ISourceViewer sourceViewer, String contentType) { 74 return doubleClickStrategy;61 return textDoubleClickStrategy; 75 62 } 76 63
Note: See TracChangeset
for help on using the changeset viewer.