Java Doc for ITextViewer.java in  » IDE-Eclipse » jface » org » eclipse » jface » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jface » org.eclipse.jface.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.eclipse.jface.text.ITextViewer

All known Subclasses:   org.eclipse.jface.text.TextViewer,
ITextViewer
public interface ITextViewer (Code)
A text viewer connects a text widget with an org.eclipse.jface.text.IDocument . The document is used as the widget's text model.

It supports the following kinds of listeners:

  • view port listeners to inform about changes of the viewer's view port
  • text listeners to inform about changes of the document and the subsequent viewer change
  • text input listeners to inform about changes of the viewer's input document.
A text viewer supports a set of configuration options and plug-ins defining its behavior:
  • undo manager
  • double click behavior
  • auto indentation
  • text hover
Installed plug-ins are not automatically activated. Plug-ins must be activated with the activatePlugins call. Most plug-ins can be defined per content type. Content types are derived from a partitioning of the text viewer's input document. In case of documents that support multiple partitionings, the implementer is responsible for determining the partitioning to use.

A text viewer also provides the concept of event consumption. Events handled by the viewer can be filtered and processed by a dynamic event consumer. With org.eclipse.jface.text.ITextViewerExtension this mechanism has been replaced with the support for org.eclipse.swt.custom.VerifyKeyListener .

A text viewer provides several text editing functions, some of them are configurable, through a text operation target interface. It also supports a presentation mode in which it only shows a specified section of its document. By calling setVisibleRegion clients define which section is visible. Clients can get access to this section by calling getVisibleRegion. The viewer's presentation mode does not affect any client of the viewer other than text listeners. With org.eclipse.jface.text.ITextViewerExtension5 the visible region support has been reworked. With that extension interface, text viewers are allowed to show fractions of their input document. I.e. a widget selection of two visually neighboring characters is no longer guaranteed to be two neighboring characters in the viewer's input document. Thus, viewers implementing org.eclipse.jface.text.ITextViewerExtension5 are potentially forced to change the fractions of the input document that are shown when clients ask for the visible region.

In order to provide backward compatibility for clients of ITextViewer, extension interfaces are used as a means of evolution. The following extension interfaces exist:

Clients may implement this interface and its extension interfaces or use the standard implementation org.eclipse.jface.text.TextViewer .


See Also:   org.eclipse.jface.text.ITextViewerExtension
See Also:   org.eclipse.jface.text.ITextViewerExtension2
See Also:   org.eclipse.jface.text.ITextViewerExtension3
See Also:   org.eclipse.jface.text.ITextViewerExtension4
See Also:   org.eclipse.jface.text.ITextViewerExtension5
See Also:   org.eclipse.jface.text.ITextViewerExtension6
See Also:   org.eclipse.jface.text.ITextViewerExtension7
See Also:   org.eclipse.jface.text.IDocument
See Also:   org.eclipse.jface.text.ITextInputListener
See Also:   org.eclipse.jface.text.IViewportListener
See Also:   org.eclipse.jface.text.ITextListener
See Also:   org.eclipse.jface.text.IEventConsumer




Method Summary
 voidactivatePlugins()
     Activates the installed plug-ins.
 voidaddTextInputListener(ITextInputListener listener)
     Adds a text input listener to this viewer.
 voidaddTextListener(ITextListener listener)
     Adds a text listener to this viewer.
 voidaddViewportListener(IViewportListener listener)
     Adds the given view port listener to this viewer.
 voidchangeTextPresentation(TextPresentation presentation, boolean controlRedraw)
     Applies the color information encoded in the given text presentation. controlRedraw tells this viewer whether it should take care of redraw management or not.
 intgetBottomIndex()
     Returns the visible line with the highest line number.
 intgetBottomIndexEndOffset()
     Returns the document offset of the lower right corner of this viewer's view port.
 IDocumentgetDocument()
     Returns the text viewer's input document.
 IFindReplaceTargetgetFindReplaceTarget()
     Returns the find/replace operation target of this viewer.
 PointgetSelectedRange()
     Returns the range of the current selection in coordinates of this viewer's document.
 ISelectionProvidergetSelectionProvider()
     Returns a selection provider dedicated to this viewer.
 ITextOperationTargetgetTextOperationTarget()
     Returns the text operation target of this viewer.
 StyledTextgetTextWidget()
     Returns this viewer's SWT control, null if the control is disposed.

Calling API directly on the widget can interfere with features provided by a text viewer.

 intgetTopIndex()
     Returns the visible line with the smallest line number.
 intgetTopIndexStartOffset()
     Returns the document offset of the upper left corner of this viewer's view port.
 intgetTopInset()
     Returns the vertical offset of the first visible line.
 IRegiongetVisibleRegion()
     Returns the current visible region of this viewer's document.
 voidinvalidateTextPresentation()
     Marks the currently applied text presentation as invalid.
 booleanisEditable()
     Returns whether the shown text can be manipulated.
 booleanoverlapsWithVisibleRegion(int offset, int length)
     Returns whether a given range overlaps with the visible region of this viewer's document.

Viewers implementing ITextViewerExtension5 may be forced to change the fractions of the input document that are shown in order to fulfill this request.

 voidremoveTextInputListener(ITextInputListener listener)
     Removes the given listener from this viewer's set of text input listeners.
 voidremoveTextListener(ITextListener listener)
     Removes the given listener from this viewer's set of text listeners.
 voidremoveViewportListener(IViewportListener listener)
     Removes the given listener from this viewer's set of view port listeners.
 voidresetPlugins()
     Resets the installed plug-ins.
 voidresetVisibleRegion()
     Resets the region of this viewer's document which is visible in the presentation.
 voidrevealRange(int offset, int length)
     Ensures that the given range is visible.
 voidsetAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType)
     Sets this viewer's auto indent strategy for the given content type.
 voidsetDefaultPrefixes(String[] defaultPrefixes, String contentType)
     Sets the strings that are used as prefixes when lines of the given content type are prefixed using the prefix text operation.
 voidsetDocument(IDocument document)
     Sets the given document as the text viewer's model and updates the presentation accordingly.
 voidsetDocument(IDocument document, int modelRangeOffset, int modelRangeLength)
     Sets the given document as this viewer's model and exposes the specified region.
 voidsetEditable(boolean editable)
     Sets the editable state.
 voidsetEventConsumer(IEventConsumer consumer)
     Registers an event consumer with this viewer.
 voidsetIndentPrefixes(String[] indentPrefixes, String contentType)
     Sets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation.
 voidsetSelectedRange(int offset, int length)
     Sets the selection to the specified range.
 voidsetTextColor(Color color)
     Applies the given color as text foreground color to this viewer's selection.
 voidsetTextColor(Color color, int offset, int length, boolean controlRedraw)
     Applies the given color as text foreground color to the specified section of this viewer.
 voidsetTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType)
     Sets this viewer's text double click strategy for the given content type.
Parameters:
  strategy - the new double click strategy.
 voidsetTextHover(ITextHover textViewerHover, String contentType)
     Sets this viewer's text hover for the given content type.

This method has been replaced by ITextViewerExtension2.setTextHover(ITextHoverStringint) . It is now equivalent to

 ITextViewerExtension2 extension= (ITextViewerExtension2) document;
 extension.setTextHover(textViewerHover, contentType, ITextViewerExtension2#DEFAULT_HOVER_STATE_MASK);
 

Parameters:
  textViewerHover - the new hover.
 voidsetTopIndex(int index)
     Scrolls the widget so that the given index is the line with the smallest line number of all visible lines.
 voidsetUndoManager(IUndoManager undoManager)
     Sets this viewer's undo manager.
Parameters:
  undoManager - the new undo manager.
 voidsetVisibleRegion(int offset, int length)
     Defines and sets the region of this viewer's document which will be visible in the presentation.



Method Detail
activatePlugins
void activatePlugins()(Code)
Activates the installed plug-ins. If the plug-ins are already activated this call has no effect.



addTextInputListener
void addTextInputListener(ITextInputListener listener)(Code)
Adds a text input listener to this viewer. If the listener is already registered with this viewer, this call has no effect.
Parameters:
  listener - the listener to be added



addTextListener
void addTextListener(ITextListener listener)(Code)
Adds a text listener to this viewer. If the listener is already registered with this viewer, this call has no effect.
Parameters:
  listener - the listener to be added



addViewportListener
void addViewportListener(IViewportListener listener)(Code)
Adds the given view port listener to this viewer. The listener is informed about all changes to the visible area of this viewer. If the listener is already registered with this viewer, this call has no effect.
Parameters:
  listener - the listener to be added



changeTextPresentation
void changeTextPresentation(TextPresentation presentation, boolean controlRedraw)(Code)
Applies the color information encoded in the given text presentation. controlRedraw tells this viewer whether it should take care of redraw management or not. If, e.g., this call is one in a sequence of multiple presentation calls, it is more appropriate to explicitly control redrawing at the beginning and the end of the sequence.
Parameters:
  presentation - the presentation to be applied to this viewer
Parameters:
  controlRedraw - indicates whether this viewer should manage redraws



getBottomIndex
int getBottomIndex()(Code)
Returns the visible line with the highest line number. the number of the bottom most line



getBottomIndexEndOffset
int getBottomIndexEndOffset()(Code)
Returns the document offset of the lower right corner of this viewer's view port. This is the visible character with the highest character position. If the content of this viewer is shorter, the position of the last character of the content is returned. the lower right corner offset



getDocument
IDocument getDocument()(Code)
Returns the text viewer's input document. the viewer's input document or null if none



getFindReplaceTarget
IFindReplaceTarget getFindReplaceTarget()(Code)
Returns the find/replace operation target of this viewer. the find/replace operation target of this viewer



getSelectedRange
Point getSelectedRange()(Code)
Returns the range of the current selection in coordinates of this viewer's document. a Point with x as the offset and y as the length of the current selection



getSelectionProvider
ISelectionProvider getSelectionProvider()(Code)
Returns a selection provider dedicated to this viewer. Subsequent calls to this method return always the same selection provider. this viewer's selection provider



getTextOperationTarget
ITextOperationTarget getTextOperationTarget()(Code)
Returns the text operation target of this viewer. the text operation target of this viewer



getTextWidget
StyledText getTextWidget()(Code)
Returns this viewer's SWT control, null if the control is disposed.

Calling API directly on the widget can interfere with features provided by a text viewer. Clients who call API directly on the widget are responsible to resolve such conflicts on their side.

the SWT control or null



getTopIndex
int getTopIndex()(Code)
Returns the visible line with the smallest line number. the number of the top most visible line



getTopIndexStartOffset
int getTopIndexStartOffset()(Code)
Returns the document offset of the upper left corner of this viewer's view port. the upper left corner offset



getTopInset
int getTopInset()(Code)
Returns the vertical offset of the first visible line. the vertical offset of the first visible line



getVisibleRegion
IRegion getVisibleRegion()(Code)
Returns the current visible region of this viewer's document. The result may differ from the argument passed to setVisibleRegion if the document has been modified since then. The visible region is supposed to be a consecutive region in viewer's input document and every character inside that region is supposed to visible in the viewer's widget.

Viewers implementing ITextViewerExtension5 may be forced to change the fractions of the input document that are shown, in order to fulfill this contract. this viewer's current visible region




invalidateTextPresentation
void invalidateTextPresentation()(Code)
Marks the currently applied text presentation as invalid. It is the viewer's responsibility to take any action it can to repair the text presentation.

See ITextViewerExtension2.invalidateTextPresentation(intint) for a way to invalidate specific regions rather than the presentation as a whole.
since:
   2.0




isEditable
boolean isEditable()(Code)
Returns whether the shown text can be manipulated. the viewer's editable state



overlapsWithVisibleRegion
boolean overlapsWithVisibleRegion(int offset, int length)(Code)
Returns whether a given range overlaps with the visible region of this viewer's document.

Viewers implementing ITextViewerExtension5 may be forced to change the fractions of the input document that are shown in order to fulfill this request. This is because the overlap is supposed to be without gaps.
Parameters:
  offset - the offset
Parameters:
  length - the length true if the specified range overlaps with thevisible region




removeTextInputListener
void removeTextInputListener(ITextInputListener listener)(Code)
Removes the given listener from this viewer's set of text input listeners. If the listener is not registered with this viewer, this call has no effect.
Parameters:
  listener - the listener to be removed



removeTextListener
void removeTextListener(ITextListener listener)(Code)
Removes the given listener from this viewer's set of text listeners. If the listener is not registered with this viewer, this call has no effect.
Parameters:
  listener - the listener to be removed



removeViewportListener
void removeViewportListener(IViewportListener listener)(Code)
Removes the given listener from this viewer's set of view port listeners. If the listener is not registered with this viewer, this call has no effect.
Parameters:
  listener - the listener to be removed



resetPlugins
void resetPlugins()(Code)
Resets the installed plug-ins. If plug-ins change their state or behavior over the course of time, this method causes them to be set back to their initial state and behavior. E.g., if an IUndoManager has been installed on this text viewer, the manager's list of remembered text editing operations is removed.



resetVisibleRegion
void resetVisibleRegion()(Code)
Resets the region of this viewer's document which is visible in the presentation. Afterwards, the whole input document is visible.



revealRange
void revealRange(int offset, int length)(Code)
Ensures that the given range is visible.
Parameters:
  offset - the offset of the range to be revealed
Parameters:
  length - the length of the range to be revealed



setAutoIndentStrategy
void setAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType)(Code)
Sets this viewer's auto indent strategy for the given content type. If the given strategy is null any installed strategy for the content type is removed. This method has been replaced by ITextViewerExtension2.prependAutoEditStrategy(IAutoEditStrategyString) and ITextViewerExtension2.removeAutoEditStrategy(IAutoEditStrategyString) . It is now equivalent to
 ITextViewerExtension2 extension= (ITextViewerExtension2) viewer;
 extension.removeAutoEditStrategy(oldStrategy, contentType);
 extension.prependAutoEditStrategy(strategy, contentType);
 

Parameters:
  strategy - the new auto indent strategy. null is avalid argument.
Parameters:
  contentType - the type for which the strategy is registeredITextViewerExtension2.prependAutoEditStrategy(IAutoEditStrategyString)ITextViewerExtension2.removeAutoEditStrategy(IAutoEditStrategyString)



setDefaultPrefixes
void setDefaultPrefixes(String[] defaultPrefixes, String contentType)(Code)
Sets the strings that are used as prefixes when lines of the given content type are prefixed using the prefix text operation. The prefixes are considered equivalent. Inserting a prefix always inserts the defaultPrefixes[0]. Removing a prefix removes all of the specified prefixes.
Parameters:
  defaultPrefixes - the prefixes to be used
Parameters:
  contentType - the content type for which the prefixes are specified
since:
   2.0



setDocument
void setDocument(IDocument document)(Code)
Sets the given document as the text viewer's model and updates the presentation accordingly. An appropriate TextEvent is issued. This text event does not carry a related document event.
Parameters:
  document - the viewer's new input document null if none



setDocument
void setDocument(IDocument document, int modelRangeOffset, int modelRangeLength)(Code)
Sets the given document as this viewer's model and exposes the specified region. An appropriate TextEvent is issued. The text event does not carry a related document event. This method is a convenience method for setDocument(document);setVisibleRegion(offset, length).
Parameters:
  document - the new input document or null if none
Parameters:
  modelRangeOffset - the offset of the model range
Parameters:
  modelRangeLength - the length of the model range



setEditable
void setEditable(boolean editable)(Code)
Sets the editable state.
Parameters:
  editable - the editable state



setEventConsumer
void setEventConsumer(IEventConsumer consumer)(Code)
Registers an event consumer with this viewer. This method has been replaces with the org.eclipse.swt.custom.VerifyKeyListener management methods in ITextViewerExtension .
Parameters:
  consumer - the viewer's event consumer. null is avalid argument.



setIndentPrefixes
void setIndentPrefixes(String[] indentPrefixes, String contentType)(Code)
Sets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation. The prefixes are considered equivalent. Thus "\t" and " " can both be used as prefix characters. Shift right always inserts the indentPrefixes[0]. Shift left removes all of the specified prefixes.
Parameters:
  indentPrefixes - the prefixes to be used
Parameters:
  contentType - the content type for which the prefixes are specified



setSelectedRange
void setSelectedRange(int offset, int length)(Code)
Sets the selection to the specified range.
Parameters:
  offset - the offset of the selection range
Parameters:
  length - the length of the selection range



setTextColor
void setTextColor(Color color)(Code)
Applies the given color as text foreground color to this viewer's selection.
Parameters:
  color - the color to be applied



setTextColor
void setTextColor(Color color, int offset, int length, boolean controlRedraw)(Code)
Applies the given color as text foreground color to the specified section of this viewer. controlRedraw tells this viewer whether it should take care of redraw management or not.
Parameters:
  color - the color to be applied
Parameters:
  offset - the offset of the range to be changed
Parameters:
  length - the length of the range to be changed
Parameters:
  controlRedraw - indicates whether this viewer should manage redraws



setTextDoubleClickStrategy
void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType)(Code)
Sets this viewer's text double click strategy for the given content type.
Parameters:
  strategy - the new double click strategy. null is a valid argument.
Parameters:
  contentType - the type for which the strategy is registered



setTextHover
void setTextHover(ITextHover textViewerHover, String contentType)(Code)
Sets this viewer's text hover for the given content type.

This method has been replaced by ITextViewerExtension2.setTextHover(ITextHoverStringint) . It is now equivalent to

 ITextViewerExtension2 extension= (ITextViewerExtension2) document;
 extension.setTextHover(textViewerHover, contentType, ITextViewerExtension2#DEFAULT_HOVER_STATE_MASK);
 

Parameters:
  textViewerHover - the new hover. null is a validargument.
Parameters:
  contentType - the type for which the hover is registered



setTopIndex
void setTopIndex(int index)(Code)
Scrolls the widget so that the given index is the line with the smallest line number of all visible lines.
Parameters:
  index - the line which should become the top most line



setUndoManager
void setUndoManager(IUndoManager undoManager)(Code)
Sets this viewer's undo manager.
Parameters:
  undoManager - the new undo manager. null is a valid argument.



setVisibleRegion
void setVisibleRegion(int offset, int length)(Code)
Defines and sets the region of this viewer's document which will be visible in the presentation. Every character inside the specified region is supposed to be visible in the viewer's widget after that call.
Parameters:
  offset - the offset of the visible region
Parameters:
  length - the length of the visible region



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.