org.eclipse.jdt.ui.text

## Class JavaTextTools

- java.lang.Object
- - org.eclipse.jdt.ui.text.JavaTextTools

    public class JavaTextTools
    extends Object

Tools required to configure a Java text viewer. The color manager and all scanner exist only one time, i.e. the same instances are returned to all clients. Thus, clients share those tools.

This class may be instantiated; it is not intended to be subclassed.

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

### Constructor Summary

Constructors
Constructor and Description
`JavaTextTools(IPreferenceStore store)` Creates a new Java text tools collection.
`JavaTextTools(IPreferenceStore store, boolean autoDisposeOnDisplayDispose)` Creates a new Java text tools collection.
`JavaTextTools(IPreferenceStore store, Preferences coreStore)` Creates a new Java text tools collection.
`JavaTextTools(IPreferenceStore store, Preferences coreStore, boolean autoDisposeOnDisplayDispose)` Creates a new Java text tools collection.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`protected void` `adaptToPreferenceChange(PropertyChangeEvent event)` Deprecated. As of 3.0, no replacement
`boolean` `affectsBehavior(PropertyChangeEvent event)` Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.affectsTextPresentation(PropertyChangeEvent)`
`IDocumentPartitioner` `createDocumentPartitioner()` Factory method for creating a Java-specific document partitioner using this object's partitions scanner.
`void` `dispose()` Disposes all the individual tools of this tools collection.
`RuleBasedScanner` `getCodeScanner()` Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getCodeScanner()`
`IColorManager` `getColorManager()` Returns the color manager which is used to manage any Java-specific colors needed for such things like syntax highlighting.
`protected Preferences` `getCorePreferenceStore()` Returns this text tool's core preference store.
`RuleBasedScanner` `getJavaDocScanner()` Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getJavaDocScanner()`
`RuleBasedScanner` `getMultilineCommentScanner()` Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getMultilineCommentScanner()`
`String[]` `getPartitionManagingPositionCategories()` Deprecated. As of 3.0, replaced by `TextUtilities.computePartitionManagingCategories(IDocument)`
`IPartitionTokenScanner` `getPartitionScanner()` Returns a scanner which is configured to scan Java-specific partitions, which are multi-line comments, Javadoc comments, and regular Java source code.
`protected IPreferenceStore` `getPreferenceStore()` Returns this text tool's preference store.
`RuleBasedScanner` `getSinglelineCommentScanner()` Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getSinglelineCommentScanner()`
`RuleBasedScanner` `getStringScanner()` Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getStringScanner()`
`void` `setupJavaDocumentPartitioner(IDocument document)` Sets up the Java document partitioner for the given document for the default partitioning.
`void` `setupJavaDocumentPartitioner(IDocument document, String partitioning)` Sets up the Java document partitioner for the given document for the given partitioning.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### JavaTextTools

    public JavaTextTools(IPreferenceStore store)

Creates a new Java text tools collection.

Parameters:
  `store` - the preference store to initialize the text tools. The text tool instance installs a listener on the passed preference store to adapt itself to changes in the preference store. In general `PreferenceConstants. getPreferenceStore()` should be used to initialize the text tools.
Since:
  2.0
See Also:
  `PreferenceConstants.getPreferenceStore()`

#### JavaTextTools

    public JavaTextTools(IPreferenceStore store,
                         boolean autoDisposeOnDisplayDispose)

Creates a new Java text tools collection.

Parameters:
  `store` - the preference store to initialize the text tools. The text tool instance installs a listener on the passed preference store to adapt itself to changes in the preference store. In general `PreferenceConstants. getPreferenceStore()` should be used to initialize the text tools.
  `autoDisposeOnDisplayDispose` - if `true` the color manager automatically disposes all managed colors when the current display gets disposed and all calls to `ISharedTextColors.dispose()` are ignored.
Since:
  2.1
See Also:
  `PreferenceConstants.getPreferenceStore()`

#### JavaTextTools

    public JavaTextTools(IPreferenceStore store,
                         Preferences coreStore)

Creates a new Java text tools collection.

Parameters:
  `store` - the preference store to initialize the text tools. The text tool instance installs a listener on the passed preference store to adapt itself to changes in the preference store. In general `PreferenceConstants. getPreferenceStore()` should be used to initialize the text tools.
  `coreStore` - optional preference store to initialize the text tools. The text tool instance installs a listener on the passed preference store to adapt itself to changes in the preference store.
Since:
  2.1
See Also:
  `PreferenceConstants.getPreferenceStore()`

#### JavaTextTools

    public JavaTextTools(IPreferenceStore store,
                         Preferences coreStore,
                         boolean autoDisposeOnDisplayDispose)

Creates a new Java text tools collection.

Parameters:
  `store` - the preference store to initialize the text tools. The text tool instance installs a listener on the passed preference store to adapt itself to changes in the preference store. In general `PreferenceConstants. getPreferenceStore()` should be used to initialize the text tools.
  `coreStore` - optional preference store to initialize the text tools. The text tool instance installs a listener on the passed preference store to adapt itself to changes in the preference store.
  `autoDisposeOnDisplayDispose` - if `true` the color manager automatically disposes all managed colors when the current display gets disposed and all calls to `ISharedTextColors.dispose()` are ignored.
Since:
  2.1
See Also:
  `PreferenceConstants.getPreferenceStore()`

### Method Detail

#### dispose

    public void dispose()

Disposes all the individual tools of this tools collection.

#### getColorManager

    public IColorManager getColorManager()

Returns the color manager which is used to manage any Java-specific colors needed for such things like syntax highlighting.

Clients which are only interested in the color manager of the Java UI plug-in should use `JavaUI.getColorManager()`.

Returns:
  the color manager to be used for Java text viewers
See Also:
  `JavaUI.getColorManager()`

#### getCodeScanner

    @Deprecated
    public RuleBasedScanner getCodeScanner()

Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getCodeScanner()`
Returns a scanner which is configured to scan Java source code.

Returns:
  a Java source code scanner

#### getMultilineCommentScanner

    @Deprecated
    public RuleBasedScanner getMultilineCommentScanner()

Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getMultilineCommentScanner()`
Returns a scanner which is configured to scan Java multi-line comments.

Returns:
  a Java multi-line comment scanner
Since:
  2.0

#### getSinglelineCommentScanner

    @Deprecated
    public RuleBasedScanner getSinglelineCommentScanner()

Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getSinglelineCommentScanner()`
Returns a scanner which is configured to scan Java single-line comments.

Returns:
  a Java single-line comment scanner
Since:
  2.0

#### getStringScanner

    @Deprecated
    public RuleBasedScanner getStringScanner()

Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getStringScanner()`
Returns a scanner which is configured to scan Java strings.

Returns:
  a Java string scanner
Since:
  2.0

#### getJavaDocScanner

    @Deprecated
    public RuleBasedScanner getJavaDocScanner()

Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.getJavaDocScanner()`
Returns a scanner which is configured to scan JavaDoc compliant comments.

Note that the start sequence "/**" and the corresponding end sequence are part of the Javadoc comment.

Returns:
  a Javadoc scanner

#### getPartitionScanner

    public IPartitionTokenScanner getPartitionScanner()

Returns a scanner which is configured to scan Java-specific partitions, which are multi-line comments, Javadoc comments, and regular Java source code.

Returns:
  a Java partition scanner

#### createDocumentPartitioner

    public IDocumentPartitioner createDocumentPartitioner()

Factory method for creating a Java-specific document partitioner using this object's partitions scanner. This method is a convenience method.

Returns:
  a newly created Java document partitioner

#### getPartitionManagingPositionCategories

    @Deprecated
    public String[] getPartitionManagingPositionCategories()

Deprecated. As of 3.0, replaced by `TextUtilities.computePartitionManagingCategories(IDocument)`
Returns the names of the document position categories used by the document partitioners created by this object to manage their partition information.

If the partitioners don't use document position categories, the returned result is `null`.

Returns:
  the partition managing position categories or `null` if there is none

#### affectsBehavior

    @Deprecated
    public boolean affectsBehavior(PropertyChangeEvent event)

Deprecated. As of 3.0, replaced by `JavaSourceViewerConfiguration.affectsTextPresentation(PropertyChangeEvent)`
Determines whether the preference change encoded by the given event changes the behavior of one its contained components.

Parameters:
  `event` - the event to be investigated
Returns:
  `true` if event causes a behavioral change
Since:
  2.0

#### adaptToPreferenceChange

    @Deprecated
    protected void adaptToPreferenceChange(PropertyChangeEvent event)

Deprecated. As of 3.0, no replacement
Adapts the behavior of the contained components to the change encoded in the given event.

Parameters:
  `event` - the event to which to adapt
Since:
  2.0

#### setupJavaDocumentPartitioner

    public void setupJavaDocumentPartitioner(IDocument document)

Sets up the Java document partitioner for the given document for the default partitioning.

Parameters:
  `document` - the document to be set up
Since:
  3.0

#### setupJavaDocumentPartitioner

    public void setupJavaDocumentPartitioner(IDocument document,
                                             String partitioning)

Sets up the Java document partitioner for the given document for the given partitioning.

Parameters:
  `document` - the document to be set up
  `partitioning` - the document partitioning
Since:
  3.0

#### getPreferenceStore

    protected IPreferenceStore getPreferenceStore()

Returns this text tool's preference store.

Returns:
  the preference store
Since:
  3.0

#### getCorePreferenceStore

    protected Preferences getCorePreferenceStore()

Returns this text tool's core preference store.

Returns:
  the core preference store
Since:
  3.0