Mercurial > projects > dwt-addons
view dwtx/jface/text/source/ISourceViewer.d @ 158:25f1f92fa3df
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 26 Aug 2008 02:46:34 +0200 |
parents | c4fb132a086c |
children | 1a5b8f8129df |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 2000, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwtx.jface.text.source.ISourceViewer; import dwtx.jface.text.source.ISharedTextColors; // packageimport import dwtx.jface.text.source.ILineRange; // packageimport import dwtx.jface.text.source.IAnnotationPresentation; // packageimport import dwtx.jface.text.source.IVerticalRulerInfoExtension; // packageimport import dwtx.jface.text.source.ICharacterPairMatcher; // packageimport import dwtx.jface.text.source.TextInvocationContext; // packageimport import dwtx.jface.text.source.LineChangeHover; // packageimport import dwtx.jface.text.source.IChangeRulerColumn; // packageimport import dwtx.jface.text.source.IAnnotationMap; // packageimport import dwtx.jface.text.source.IAnnotationModelListenerExtension; // packageimport import dwtx.jface.text.source.ISourceViewerExtension2; // packageimport import dwtx.jface.text.source.IAnnotationHover; // packageimport import dwtx.jface.text.source.ContentAssistantFacade; // packageimport import dwtx.jface.text.source.IAnnotationAccess; // packageimport import dwtx.jface.text.source.IVerticalRulerExtension; // packageimport import dwtx.jface.text.source.IVerticalRulerColumn; // packageimport import dwtx.jface.text.source.LineNumberRulerColumn; // packageimport import dwtx.jface.text.source.MatchingCharacterPainter; // packageimport import dwtx.jface.text.source.IAnnotationModelExtension; // packageimport import dwtx.jface.text.source.ILineDifferExtension; // packageimport import dwtx.jface.text.source.DefaultCharacterPairMatcher; // packageimport import dwtx.jface.text.source.LineNumberChangeRulerColumn; // packageimport import dwtx.jface.text.source.IAnnotationAccessExtension; // packageimport import dwtx.jface.text.source.AnnotationModel; // packageimport import dwtx.jface.text.source.ILineDifferExtension2; // packageimport import dwtx.jface.text.source.IAnnotationModelListener; // packageimport import dwtx.jface.text.source.IVerticalRuler; // packageimport import dwtx.jface.text.source.DefaultAnnotationHover; // packageimport import dwtx.jface.text.source.SourceViewer; // packageimport import dwtx.jface.text.source.SourceViewerConfiguration; // packageimport import dwtx.jface.text.source.AnnotationBarHoverManager; // packageimport import dwtx.jface.text.source.CompositeRuler; // packageimport import dwtx.jface.text.source.ImageUtilities; // packageimport import dwtx.jface.text.source.VisualAnnotationModel; // packageimport import dwtx.jface.text.source.IAnnotationModel; // packageimport import dwtx.jface.text.source.ISourceViewerExtension3; // packageimport import dwtx.jface.text.source.ILineDiffInfo; // packageimport import dwtx.jface.text.source.VerticalRulerEvent; // packageimport import dwtx.jface.text.source.ChangeRulerColumn; // packageimport import dwtx.jface.text.source.ILineDiffer; // packageimport import dwtx.jface.text.source.AnnotationModelEvent; // packageimport import dwtx.jface.text.source.AnnotationColumn; // packageimport import dwtx.jface.text.source.AnnotationRulerColumn; // packageimport import dwtx.jface.text.source.IAnnotationHoverExtension; // packageimport import dwtx.jface.text.source.AbstractRulerColumn; // packageimport import dwtx.jface.text.source.ISourceViewerExtension; // packageimport import dwtx.jface.text.source.AnnotationMap; // packageimport import dwtx.jface.text.source.IVerticalRulerInfo; // packageimport import dwtx.jface.text.source.IAnnotationModelExtension2; // packageimport import dwtx.jface.text.source.LineRange; // packageimport import dwtx.jface.text.source.IAnnotationAccessExtension2; // packageimport import dwtx.jface.text.source.VerticalRuler; // packageimport import dwtx.jface.text.source.JFaceTextMessages; // packageimport import dwtx.jface.text.source.IOverviewRuler; // packageimport import dwtx.jface.text.source.Annotation; // packageimport import dwtx.jface.text.source.IVerticalRulerListener; // packageimport import dwtx.jface.text.source.ISourceViewerExtension4; // packageimport import dwtx.jface.text.source.AnnotationPainter; // packageimport import dwtx.jface.text.source.IAnnotationHoverExtension2; // packageimport import dwtx.jface.text.source.OverviewRuler; // packageimport import dwtx.jface.text.source.OverviewRulerHoverManager; // packageimport import dwt.dwthelper.utils; import dwtx.jface.text.IDocument; import dwtx.jface.text.IRegion; import dwtx.jface.text.ITextOperationTarget; import dwtx.jface.text.ITextViewer; /** * In addition to the text viewer functionality a source viewer supports: * <ul> * <li>visual annotations based on an annotation model * <li>visual range indication * <li>management of text viewer add-ons * <li>explicit configuration * </ul> * It is assumed that range indication and visual annotations are shown inside * the same presentation area. There are no assumptions about whether this area * is different from the viewer's text widget. * <p> * As the visibility of visual annotations can dynamically be changed, it is * assumed that the annotation presentation area can dynamically be hidden if it * is different from the text widget. * <p> * In order to provide backward compatibility for clients of * <code>ISourceViewer</code>, extension interfaces are used as a means of * evolution. The following extension interfaces exist: * <ul> * <li>{@link dwtx.jface.text.source.ISourceViewerExtension} since version 2.1 * introducing the concept of an annotation overview.</li> * <li>{@link dwtx.jface.text.source.ISourceViewerExtension2} since version 3.0 * allowing source viewers to roll back a previously performed configuration and * allows access to the viewer's visual annotation model.</li> * <li>{@link dwtx.jface.text.source.ISourceViewerExtension3} since version 3.2 * introducing the concept of a quick assist assistant and providing access * to the quick assist invocation context as well as the current annotation hover.</li> * <li>{@link dwtx.jface.text.source.ISourceViewerExtension4} since version 3.4 * introducing API to access a minimal set of content assistant APIs.</li> * </ul></p> * <p> * Clients may implement this interface and its extension interfaces or use the * default implementation provided by * {@link dwtx.jface.text.source.SourceViewer}.</p> * * @see dwtx.jface.text.source.ISourceViewerExtension * @see dwtx.jface.text.source.ISourceViewerExtension2 * @see dwtx.jface.text.source.ISourceViewerExtension3 * @see dwtx.jface.text.source.ISourceViewerExtension4 */ public interface ISourceViewer : ITextViewer { /** * Text operation code for requesting content assist to show completion * proposals for the current insert position. */ static const int CONTENTASSIST_PROPOSALS= ITextOperationTarget.STRIP_PREFIX + 1; /** * Text operation code for requesting content assist to show * the content information for the current insert position. */ static const int CONTENTASSIST_CONTEXT_INFORMATION= ITextOperationTarget.STRIP_PREFIX + 2; /** * Text operation code for formatting the selected text or complete document * of this viewer if the selection is empty. */ static const int FORMAT= ITextOperationTarget.STRIP_PREFIX + 3; /** * Text operation code for requesting information at the current insertion position. * @since 2.0 */ static const int INFORMATION= ITextOperationTarget.STRIP_PREFIX + 4; /* * XXX: Cannot continue numbering due to operation codes used in ProjectionViewer */ /** * Text operation code for requesting quick assist. This will normally * show quick assist and quick fix proposals for the current position. * @since 3.2 */ static const int QUICK_ASSIST= ITextOperationTarget.STRIP_PREFIX + 10; /** * Configures the source viewer using the given configuration. Prior to 3.0 this * method can only be called once. Since 3.0 this method can be called again * after a call to {@link ISourceViewerExtension2#unconfigure()}. * * @param configuration the source viewer configuration to be used */ void configure(SourceViewerConfiguration configuration); /** * Sets the annotation hover of this source viewer. The annotation hover * provides the information to be displayed in a hover popup window * if requested over the annotation presentation area. The annotation * hover is assumed to be line oriented. * * @param annotationHover the hover to be used, <code>null</code> is a valid argument */ void setAnnotationHover(IAnnotationHover annotationHover); /** * Sets the given document as this viewer's text model and the * given annotation model as the model for this viewer's visual * annotations. The presentation is accordingly updated. An appropriate * <code>TextEvent</code> is issued. This text event does not carry * a related document event. * * @param document the viewer's new input document * @param annotationModel the model for the viewer's visual annotations * * @see ITextViewer#setDocument(IDocument) */ void setDocument(IDocument document, IAnnotationModel annotationModel); /** * Sets the given document as this viewer's text model and the * given annotation model as the model for this viewer's visual * annotations. The presentation is accordingly updated whereby * only the specified region is exposed. An appropriate * <code>TextEvent</code> is issued. The text event does not carry a * related document event. This method is a convenience method for * <code>setDocument(document, annotationModel);setVisibleRegion(offset, length)</code>. * * @param document the new input document * @param annotationModel the model of the viewer's visual annotations * @param modelRangeOffset the offset of the model range * @param modelRangeLength the length of the model range * * @see ITextViewer#setDocument(IDocument, int, int) */ void setDocument(IDocument document, IAnnotationModel annotationModel, int modelRangeOffset, int modelRangeLength); /** * Returns this viewer's annotation model. Use * {@link ISourceViewerExtension2#getVisualAnnotationModel()}in order to * get access to the viewer's visual annotation model. * * @return this viewer's annotation model */ IAnnotationModel getAnnotationModel(); /** * Sets the annotation used by this viewer as range indicator. The * range covered by this annotation is referred to as range indication. * * @param rangeIndicator the annotation to be used as this viewer's range indicator */ void setRangeIndicator(Annotation rangeIndicator); /** * Sets the viewers's range indication to the specified range. Its is indicated * whether the cursor should also be moved to the beginning of the specified range. * * @param offset the offset of the range * @param length the length of the range * @param moveCursor indicates whether the cursor should be moved to the given offset */ void setRangeIndication(int offset, int length, bool moveCursor); /** * Returns the viewer's range indication. * * @return the viewer's range indication. */ IRegion getRangeIndication(); /** * Removes the viewer's range indication. There is no visible range indication * after this method completed. */ void removeRangeIndication(); /** * Controls the visibility of annotations and in the case of separate * presentation areas of text and annotations, the visibility of the * annotation's presentation area.<p> * By default, annotations and their presentation area are visible. * * @param show indicates the visibility of annotations */ void showAnnotations(bool show); }