Mercurial > projects > dwt2
diff org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children | 5feec68b4556 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.eclipse.text/src/org/eclipse/jface/text/IDocumentInformationMapping.d Sat Mar 14 18:23:29 2009 +0100 @@ -0,0 +1,270 @@ +/******************************************************************************* + * Copyright (c) 2000, 2005 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 org.eclipse.jface.text.IDocumentInformationMapping; + +import org.eclipse.jface.text.IDocumentPartitioningListener; // packageimport +import org.eclipse.jface.text.DefaultTextHover; // packageimport +import org.eclipse.jface.text.AbstractInformationControl; // packageimport +import org.eclipse.jface.text.TextUtilities; // packageimport +import org.eclipse.jface.text.IInformationControlCreatorExtension; // packageimport +import org.eclipse.jface.text.AbstractInformationControlManager; // packageimport +import org.eclipse.jface.text.ITextViewerExtension2; // packageimport +import org.eclipse.jface.text.IDocumentPartitioner; // packageimport +import org.eclipse.jface.text.DefaultIndentLineAutoEditStrategy; // packageimport +import org.eclipse.jface.text.ITextSelection; // packageimport +import org.eclipse.jface.text.Document; // packageimport +import org.eclipse.jface.text.FindReplaceDocumentAdapterContentProposalProvider; // packageimport +import org.eclipse.jface.text.ITextListener; // packageimport +import org.eclipse.jface.text.BadPartitioningException; // packageimport +import org.eclipse.jface.text.ITextViewerExtension5; // packageimport +import org.eclipse.jface.text.IDocumentPartitionerExtension3; // packageimport +import org.eclipse.jface.text.IUndoManager; // packageimport +import org.eclipse.jface.text.ITextHoverExtension2; // packageimport +import org.eclipse.jface.text.IRepairableDocument; // packageimport +import org.eclipse.jface.text.IRewriteTarget; // packageimport +import org.eclipse.jface.text.DefaultPositionUpdater; // packageimport +import org.eclipse.jface.text.RewriteSessionEditProcessor; // packageimport +import org.eclipse.jface.text.TextViewerHoverManager; // packageimport +import org.eclipse.jface.text.DocumentRewriteSession; // packageimport +import org.eclipse.jface.text.TextViewer; // packageimport +import org.eclipse.jface.text.ITextViewerExtension8; // packageimport +import org.eclipse.jface.text.RegExMessages; // packageimport +import org.eclipse.jface.text.IDelayedInputChangeProvider; // packageimport +import org.eclipse.jface.text.ITextOperationTargetExtension; // packageimport +import org.eclipse.jface.text.IWidgetTokenOwner; // packageimport +import org.eclipse.jface.text.IViewportListener; // packageimport +import org.eclipse.jface.text.GapTextStore; // packageimport +import org.eclipse.jface.text.MarkSelection; // packageimport +import org.eclipse.jface.text.IDocumentPartitioningListenerExtension; // packageimport +import org.eclipse.jface.text.IDocumentAdapterExtension; // packageimport +import org.eclipse.jface.text.IInformationControlExtension; // packageimport +import org.eclipse.jface.text.IDocumentPartitioningListenerExtension2; // packageimport +import org.eclipse.jface.text.DefaultDocumentAdapter; // packageimport +import org.eclipse.jface.text.ITextViewerExtension3; // packageimport +import org.eclipse.jface.text.IInformationControlCreator; // packageimport +import org.eclipse.jface.text.TypedRegion; // packageimport +import org.eclipse.jface.text.ISynchronizable; // packageimport +import org.eclipse.jface.text.IMarkRegionTarget; // packageimport +import org.eclipse.jface.text.TextViewerUndoManager; // packageimport +import org.eclipse.jface.text.IRegion; // packageimport +import org.eclipse.jface.text.IInformationControlExtension2; // packageimport +import org.eclipse.jface.text.IDocumentExtension4; // packageimport +import org.eclipse.jface.text.IDocumentExtension2; // packageimport +import org.eclipse.jface.text.IDocumentPartitionerExtension2; // packageimport +import org.eclipse.jface.text.Assert; // packageimport +import org.eclipse.jface.text.DefaultInformationControl; // packageimport +import org.eclipse.jface.text.IWidgetTokenOwnerExtension; // packageimport +import org.eclipse.jface.text.DocumentClone; // packageimport +import org.eclipse.jface.text.DefaultUndoManager; // packageimport +import org.eclipse.jface.text.IFindReplaceTarget; // packageimport +import org.eclipse.jface.text.IAutoEditStrategy; // packageimport +import org.eclipse.jface.text.ILineTrackerExtension; // packageimport +import org.eclipse.jface.text.IUndoManagerExtension; // packageimport +import org.eclipse.jface.text.TextSelection; // packageimport +import org.eclipse.jface.text.DefaultAutoIndentStrategy; // packageimport +import org.eclipse.jface.text.IAutoIndentStrategy; // packageimport +import org.eclipse.jface.text.IPainter; // packageimport +import org.eclipse.jface.text.IInformationControl; // packageimport +import org.eclipse.jface.text.IInformationControlExtension3; // packageimport +import org.eclipse.jface.text.ITextViewerExtension6; // packageimport +import org.eclipse.jface.text.IInformationControlExtension4; // packageimport +import org.eclipse.jface.text.DefaultLineTracker; // packageimport +import org.eclipse.jface.text.IDocumentInformationMappingExtension; // packageimport +import org.eclipse.jface.text.IRepairableDocumentExtension; // packageimport +import org.eclipse.jface.text.ITextHover; // packageimport +import org.eclipse.jface.text.FindReplaceDocumentAdapter; // packageimport +import org.eclipse.jface.text.ILineTracker; // packageimport +import org.eclipse.jface.text.Line; // packageimport +import org.eclipse.jface.text.ITextViewerExtension; // packageimport +import org.eclipse.jface.text.IDocumentAdapter; // packageimport +import org.eclipse.jface.text.TextEvent; // packageimport +import org.eclipse.jface.text.BadLocationException; // packageimport +import org.eclipse.jface.text.AbstractDocument; // packageimport +import org.eclipse.jface.text.AbstractLineTracker; // packageimport +import org.eclipse.jface.text.TreeLineTracker; // packageimport +import org.eclipse.jface.text.ITextPresentationListener; // packageimport +import org.eclipse.jface.text.Region; // packageimport +import org.eclipse.jface.text.ITextViewer; // packageimport +import org.eclipse.jface.text.MarginPainter; // packageimport +import org.eclipse.jface.text.IPaintPositionManager; // packageimport +import org.eclipse.jface.text.TextPresentation; // packageimport +import org.eclipse.jface.text.IFindReplaceTargetExtension; // packageimport +import org.eclipse.jface.text.ISlaveDocumentManagerExtension; // packageimport +import org.eclipse.jface.text.ISelectionValidator; // packageimport +import org.eclipse.jface.text.IDocumentExtension; // packageimport +import org.eclipse.jface.text.PropagatingFontFieldEditor; // packageimport +import org.eclipse.jface.text.ConfigurableLineTracker; // packageimport +import org.eclipse.jface.text.SlaveDocumentEvent; // packageimport +import org.eclipse.jface.text.IDocumentListener; // packageimport +import org.eclipse.jface.text.PaintManager; // packageimport +import org.eclipse.jface.text.IFindReplaceTargetExtension3; // packageimport +import org.eclipse.jface.text.ITextDoubleClickStrategy; // packageimport +import org.eclipse.jface.text.IDocumentExtension3; // packageimport +import org.eclipse.jface.text.Position; // packageimport +import org.eclipse.jface.text.TextMessages; // packageimport +import org.eclipse.jface.text.CopyOnWriteTextStore; // packageimport +import org.eclipse.jface.text.WhitespaceCharacterPainter; // packageimport +import org.eclipse.jface.text.IPositionUpdater; // packageimport +import org.eclipse.jface.text.DefaultTextDoubleClickStrategy; // packageimport +import org.eclipse.jface.text.ListLineTracker; // packageimport +import org.eclipse.jface.text.ITextInputListener; // packageimport +import org.eclipse.jface.text.BadPositionCategoryException; // packageimport +import org.eclipse.jface.text.IWidgetTokenKeeperExtension; // packageimport +import org.eclipse.jface.text.IInputChangedListener; // packageimport +import org.eclipse.jface.text.ITextOperationTarget; // packageimport +import org.eclipse.jface.text.IDocumentInformationMappingExtension2; // packageimport +import org.eclipse.jface.text.ITextViewerExtension7; // packageimport +import org.eclipse.jface.text.IInformationControlExtension5; // packageimport +import org.eclipse.jface.text.IDocumentRewriteSessionListener; // packageimport +import org.eclipse.jface.text.JFaceTextUtil; // packageimport +import org.eclipse.jface.text.AbstractReusableInformationControlCreator; // packageimport +import org.eclipse.jface.text.TabsToSpacesConverter; // packageimport +import org.eclipse.jface.text.CursorLinePainter; // packageimport +import org.eclipse.jface.text.ITextHoverExtension; // packageimport +import org.eclipse.jface.text.IEventConsumer; // packageimport +import org.eclipse.jface.text.IDocument; // packageimport +import org.eclipse.jface.text.IWidgetTokenKeeper; // packageimport +import org.eclipse.jface.text.DocumentCommand; // packageimport +import org.eclipse.jface.text.TypedPosition; // packageimport +import org.eclipse.jface.text.IEditingSupportRegistry; // packageimport +import org.eclipse.jface.text.IDocumentPartitionerExtension; // packageimport +import org.eclipse.jface.text.AbstractHoverInformationControlManager; // packageimport +import org.eclipse.jface.text.IEditingSupport; // packageimport +import org.eclipse.jface.text.IMarkSelection; // packageimport +import org.eclipse.jface.text.ISlaveDocumentManager; // packageimport +import org.eclipse.jface.text.DocumentEvent; // packageimport +import org.eclipse.jface.text.DocumentPartitioningChangedEvent; // packageimport +import org.eclipse.jface.text.ITextStore; // packageimport +import org.eclipse.jface.text.JFaceTextMessages; // packageimport +import org.eclipse.jface.text.DocumentRewriteSessionEvent; // packageimport +import org.eclipse.jface.text.SequentialRewriteTextStore; // packageimport +import org.eclipse.jface.text.DocumentRewriteSessionType; // packageimport +import org.eclipse.jface.text.TextAttribute; // packageimport +import org.eclipse.jface.text.ITextViewerExtension4; // packageimport +import org.eclipse.jface.text.ITypedRegion; // packageimport + + +import java.lang.all; +import java.util.Set; + + +/** + * A <code>IDocumentInformationMapping</code> represents a mapping between the coordinates of two + * <code>IDocument</code> objects: the original and the image. The document information mapping + * can translate document information such as line numbers or character ranges given for the original into + * the corresponding information of the image and vice versa. + * + * In order to provided backward compatibility for clients of <code>IDocumentInformationMapping</code>, extension + * interfaces are used to provide a means of evolution. The following extension interfaces + * exist: + * <ul> + * <li> {@link org.eclipse.jface.text.IDocumentInformationMappingExtension} since version 3.0 extending the + * degree of detail of the mapping information.</li> + * <li> {@link org.eclipse.jface.text.IDocumentInformationMappingExtension2} since version 3.1, adding lenient + * image region computation.</li> + * </ul> + * + * @since 2.1 + */ +public interface IDocumentInformationMapping { + + /** + * Returns the minimal region of the original document that completely comprises all of the image document + * or <code>null</code> if there is no such region. + * + * @return the minimal region of the original document comprising the image document or <code>null</code> + */ + IRegion getCoverage(); + + /** + * Returns the offset in the original document that corresponds to the given offset in the image document + * or <code>-1</code> if there is no such offset + * + * @param imageOffset the offset in the image document + * @return the corresponding offset in the original document or <code>-1</code> + * @throws BadLocationException if <code>imageOffset</code> is not a valid offset in the image document + */ + int toOriginOffset(int imageOffset) ; + + /** + * Returns the minimal region of the original document that completely comprises the given region of the + * image document or <code>null</code> if there is no such region. + * + * @param imageRegion the region of the image document + * @return the minimal region of the original document comprising the given region of the image document or <code>null</code> + * @throws BadLocationException if <code>imageRegion</code> is not a valid region of the image document + */ + IRegion toOriginRegion(IRegion imageRegion) ; + + /** + * Returns the range of lines of the original document that corresponds to the given line of the image document or + * <code>null</code> if there are no such lines. + * + * @param imageLine the line of the image document + * @return the corresponding lines of the original document or <code>null</code> + * @throws BadLocationException if <code>imageLine</code> is not a valid line number in the image document + */ + IRegion toOriginLines(int imageLine) ; + + /** + * Returns the line of the original document that corresponds to the given line of the image document or + * <code>-1</code> if there is no such line. + * + * @param imageLine the line of the image document + * @return the corresponding line of the original document or <code>-1</code> + * @throws BadLocationException if <code>imageLine</code> is not a valid line number in the image document + */ + int toOriginLine(int imageLine) ; + + + + /** + * Returns the offset in the image document that corresponds to the given offset in the original document + * or <code>-1</code> if there is no such offset + * + * @param originOffset the offset in the original document + * @return the corresponding offset in the image document or <code>-1</code> + * @throws BadLocationException if <code>originOffset</code> is not a valid offset in the original document + */ + int toImageOffset(int originOffset) ; + + /** + * Returns the minimal region of the image document that completely comprises the given region of the + * original document or <code>null</code> if there is no such region. + * + * @param originRegion the region of the original document + * @return the minimal region of the image document comprising the given region of the original document or <code>null</code> + * @throws BadLocationException if <code>originRegion</code> is not a valid region of the original document + */ + IRegion toImageRegion(IRegion originRegion) ; + + /** + * Returns the line of the image document that corresponds to the given line of the original document or + * <code>-1</code> if there is no such line. + * + * @param originLine the line of the original document + * @return the corresponding line of the image document or <code>-1</code> + * @throws BadLocationException if <code>originLine</code> is not a valid line number in the original document + */ + int toImageLine(int originLine) ; + + /** + * Returns the line of the image document whose corresponding line in the original document + * is closest to the given line in the original document. + * + * @param originLine the line in the original document + * @return the line in the image document that corresponds best to the given line in the original document + * @throws BadLocationException if <code>originLine</code>is not a valid line in the original document + */ + int toClosestImageLine(int originLine) ; +}