Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.jface.text.projection
Class ProjectionMapping

java.lang.Object
  extended by 
org.eclipse.jface.text.projection.ProjectionMapping
All Implemented Interfaces:
IDocumentInformationMapping, IDocumentInformationMappingExtension, IDocumentInformationMappingExtension2

public class ProjectionMapping
extends Object
implements IDocumentInformationMapping, IDocumentInformationMappingExtension, IDocumentInformationMappingExtension2

Internal class. Do not use. Only public for testing purposes.

Implementation of IDocumentInformationMapping for the projection mapping between a master and a slave document.

Since:
3.0
Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.

Constructor Summary
ProjectionMapping ( IDocument masterDocument, String fragmentsCategory, IDocument slaveDocument, String segmentsCategory)
          Creates a new mapping between the given parent document and the given projection document.
 
Method Summary
  IRegion getCoverage ()
          Returns the minimal region of the original document that completely comprises all of the image document or null if there is no such region.
  IRegion[] getExactCoverage ( IRegion originRegion)
          Returns the maximal sub-regions of the given origin region which are completely covered.
 int getImageLength ()
          Returns the length of the image document.
 void projectionChanged ()
          Notifies this projection mapping that there was a projection change.
 int toClosestImageLine (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.
  IRegion toClosestImageRegion ( IRegion originRegion)
          Returns the minimal region of the image document that completely comprises the given region of the original document.
  IRegion toExactImageRegion ( IRegion originRegion)
          Adheres to originRegion=toOriginRegion(toExactImageRegion(originRegion)), if toExactImageRegion(originRegion) !
  IRegion[] toExactImageRegions ( IRegion originRegion)
          Returns the segments of the image document that exactly correspond to the given region of the original document.
  IRegion[] toExactOriginRegions ( IRegion imageRegion)
          Returns the fragments of the original document that exactly correspond to the given region of the image document.
 int toImageLine (int originLine)
          Returns the line of the image document that corresponds to the given line of the original document or -1 if there is no such line.
 int toImageOffset (int originOffset)
          Returns the offset in the image document that corresponds to the given offset in the original document or -1 if there is no such offset
  IRegion toImageRegion ( IRegion originRegion)
          Returns the minimal region of the image document that completely comprises the given region of the original document or null if there is no such region.
 int toOriginLine (int imageLine)
          Returns the line of the original document that corresponds to the given line of the image document or -1 if there is no such line.
  IRegion toOriginLines (int imageLine)
          Returns the range of lines of the original document that corresponds to the given line of the image document or null if there are no such lines.
 int toOriginOffset (int imageOffset)
          Returns the offset in the original document that corresponds to the given offset in the image document or -1 if there is no such offset
  IRegion toOriginRegion ( IRegion imageRegion)
          Returns the minimal region of the original document that completely comprises the given region of the image document or null if there is no such region.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProjectionMapping

public ProjectionMapping(
IDocument masterDocument,
                         
String fragmentsCategory,
                         
IDocument slaveDocument,
                         
String segmentsCategory)
Creates a new mapping between the given parent document and the given projection document.

Parameters:
masterDocument - the master document
fragmentsCategory - the position category of the parent document used to manage the projected regions
slaveDocument - the slave document
segmentsCategory - the position category of the projection document used to manage the fragments
Method Detail

projectionChanged

public void projectionChanged()
Notifies this projection mapping that there was a projection change.


getCoverage

public 
IRegion getCoverage()
Description copied from interface: IDocumentInformationMapping
Returns the minimal region of the original document that completely comprises all of the image document or null if there is no such region.

Specified by:
getCoverage in interface IDocumentInformationMapping
Returns:
the minimal region of the original document comprising the image document or null

toOriginOffset

public int toOriginOffset(int imageOffset)
                   throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the offset in the original document that corresponds to the given offset in the image document or -1 if there is no such offset

Specified by:
toOriginOffset in interface IDocumentInformationMapping
Parameters:
imageOffset - the offset in the image document
Returns:
the corresponding offset in the original document or -1
Throws:
BadLocationException - if imageOffset is not a valid offset in the image document

toOriginRegion

public 
IRegion toOriginRegion(
IRegion imageRegion)
                       throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the minimal region of the original document that completely comprises the given region of the image document or null if there is no such region.

Specified by:
toOriginRegion in interface IDocumentInformationMapping
Parameters:
imageRegion - the region of the image document
Returns:
the minimal region of the original document comprising the given region of the image document or null
Throws:
BadLocationException - if imageRegion is not a valid region of the image document

toOriginLines

public 
IRegion toOriginLines(int imageLine)
                      throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the range of lines of the original document that corresponds to the given line of the image document or null if there are no such lines.

Specified by:
toOriginLines in interface IDocumentInformationMapping
Parameters:
imageLine - the line of the image document
Returns:
the corresponding lines of the original document or null
Throws:
BadLocationException - if imageLine is not a valid line number in the image document

toOriginLine

public int toOriginLine(int imageLine)
                 throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the line of the original document that corresponds to the given line of the image document or -1 if there is no such line.

Specified by:
toOriginLine in interface IDocumentInformationMapping
Parameters:
imageLine - the line of the image document
Returns:
the corresponding line of the original document or -1
Throws:
BadLocationException - if imageLine is not a valid line number in the image document

toImageOffset

public int toImageOffset(int originOffset)
                  throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the offset in the image document that corresponds to the given offset in the original document or -1 if there is no such offset

Specified by:
toImageOffset in interface IDocumentInformationMapping
Parameters:
originOffset - the offset in the original document
Returns:
the corresponding offset in the image document or -1
Throws:
BadLocationException - if originOffset is not a valid offset in the original document

toExactImageRegion

public 
IRegion toExactImageRegion(
IRegion originRegion)
                           throws 
BadLocationException
Description copied from interface: IDocumentInformationMappingExtension
Adheres to originRegion=toOriginRegion(toExactImageRegion(originRegion)), if toExactImageRegion(originRegion) != null. Returns null if there is no image for the given origin region.

Specified by:
toExactImageRegion in interface IDocumentInformationMappingExtension
Parameters:
originRegion - the origin region
Returns:
the exact image region or null
Throws:
BadLocationException - if origin region is not a valid region in the origin document

toImageRegion

public 
IRegion toImageRegion(
IRegion originRegion)
                      throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the minimal region of the image document that completely comprises the given region of the original document or null if there is no such region.

Specified by:
toImageRegion in interface IDocumentInformationMapping
Parameters:
originRegion - the region of the original document
Returns:
the minimal region of the image document comprising the given region of the original document or null
Throws:
BadLocationException - if originRegion is not a valid region of the original document

toClosestImageRegion

public 
IRegion toClosestImageRegion(
IRegion originRegion)
                             throws 
BadLocationException
Description copied from interface: IDocumentInformationMappingExtension2
Returns the minimal region of the image document that completely comprises the given region of the original document. The difference to IDocumentInformationMapping.toImageRegion(IRegion) is that this method will always return an image region for a valid origin region. If originRegion has no corresponding image region, the zero-length region at the offset between its surrounding fragments is returned.

Specified by:
toClosestImageRegion in interface IDocumentInformationMappingExtension2
Parameters:
originRegion - the region of the original document
Returns:
the minimal region of the image document comprising the given region of the original document
Throws:
BadLocationException - if originRegion is not a valid region of the original document

toImageLine

public int toImageLine(int originLine)
                throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the line of the image document that corresponds to the given line of the original document or -1 if there is no such line.

Specified by:
toImageLine in interface IDocumentInformationMapping
Parameters:
originLine - the line of the original document
Returns:
the corresponding line of the image document or -1
Throws:
BadLocationException - if originLine is not a valid line number in the original document

toClosestImageLine

public int toClosestImageLine(int originLine)
                       throws 
BadLocationException
Description copied from interface: IDocumentInformationMapping
Returns the line of the image document whose corresponding line in the original document is closest to the given line in the original document.

Specified by:
toClosestImageLine in interface IDocumentInformationMapping
Parameters:
originLine - the line in the original document
Returns:
the line in the image document that corresponds best to the given line in the original document
Throws:
BadLocationException - if originLineis not a valid line in the original document

toExactOriginRegions

public 
IRegion[] toExactOriginRegions(
IRegion imageRegion)
                               throws 
BadLocationException
Description copied from interface: IDocumentInformationMappingExtension
Returns the fragments of the original document that exactly correspond to the given region of the image document.

Specified by:
toExactOriginRegions in interface IDocumentInformationMappingExtension
Parameters:
imageRegion - the region in the image document
Returns:
the fragments in the origin document
Throws:
BadLocationException - in case the given image region is not valid in the image document

getImageLength

public int getImageLength()
Description copied from interface: IDocumentInformationMappingExtension
Returns the length of the image document.

Specified by:
getImageLength in interface IDocumentInformationMappingExtension
Returns:
the length of the image document

toExactImageRegions

public 
IRegion[] toExactImageRegions(
IRegion originRegion)
                              throws 
BadLocationException
Description copied from interface: IDocumentInformationMappingExtension
Returns the segments of the image document that exactly correspond to the given region of the original document. Returns null if there are no such image regions.

Specified by:
toExactImageRegions in interface IDocumentInformationMappingExtension
Parameters:
originRegion - the region in the origin document
Returns:
the segments in the image document or null
Throws:
BadLocationException - in case the given origin region is not valid in the original document

getExactCoverage

public 
IRegion[] getExactCoverage(
IRegion originRegion)
                           throws 
BadLocationException
Description copied from interface: IDocumentInformationMappingExtension
Returns the maximal sub-regions of the given origin region which are completely covered. I.e. each offset in a sub-region has a corresponding image offset. Returns null if there are no such sub-regions.

Specified by:
getExactCoverage in interface IDocumentInformationMappingExtension
Parameters:
originRegion - the region in the origin document
Returns:
the sub-regions with complete coverage or null
Throws:
BadLocationException - in case the given origin region is not valid in the original document

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire