org.eclipse.wst.jsdt.ui.text

## Class JavaScriptTextTools

- java.lang.Object
- - org.eclipse.wst.jsdt.ui.text.JavaScriptTextTools

    public class JavaScriptTextTools
    extends java.lang.Object

Tools required to configure a JavaScript 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.

Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.

### Constructor Summary

Constructors
Constructor and Description
`JavaScriptTextTools(IPreferenceStore store)` Creates a new JavaScript text tools collection.
`JavaScriptTextTools(IPreferenceStore store, boolean autoDisposeOnDisplayDispose)` Creates a new JavaScript text tools collection.
`JavaScriptTextTools(IPreferenceStore store, Preferences coreStore)` Creates a new JavaScript text tools collection.
`JavaScriptTextTools(IPreferenceStore store, Preferences coreStore, boolean autoDisposeOnDisplayDispose)` Creates a new JavaScript 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
`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.
`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.
`IPartitionTokenScanner` `getPartitionScanner()` Returns a scanner which is configured to scan Java-specific partitions, which are multi-line comments, Javadoc comments, and regular JavaScript source code.
`protected IPreferenceStore` `getPreferenceStore()` Returns this text tool's preference store.
`void` `setupJavaDocumentPartitioner(IDocument document)` Sets up the JavaScript document partitioner for the given document for the default partitioning.
`void` `setupJavaDocumentPartitioner(IDocument document, java.lang.String partitioning)` Sets up the JavaScript 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

#### JavaScriptTextTools

    public JavaScriptTextTools(IPreferenceStore store)

Creates a new JavaScript 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.
See Also:
  `PreferenceConstants.getPreferenceStore()`

#### JavaScriptTextTools

    public JavaScriptTextTools(IPreferenceStore store,
                               boolean autoDisposeOnDisplayDispose)

Creates a new JavaScript 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 `org.eclipse.jface.text.source.ISharedTextColors#dispose()` are ignored.
See Also:
  `PreferenceConstants.getPreferenceStore()`

#### JavaScriptTextTools

    public JavaScriptTextTools(IPreferenceStore store,
                               Preferences coreStore)

Creates a new JavaScript 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.
See Also:
  `PreferenceConstants.getPreferenceStore()`

#### JavaScriptTextTools

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

Creates a new JavaScript 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 `org.eclipse.jface.text.source.ISharedTextColors#dispose()` are ignored.
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 JavaScript UI plug-in should use `JavaScriptUI.getColorManager()`.

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

#### getPartitionScanner

    public IPartitionTokenScanner getPartitionScanner()

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

Returns:
  a JavaScript 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 JavaScript document partitioner

#### adaptToPreferenceChange

    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

#### setupJavaDocumentPartitioner

    public void setupJavaDocumentPartitioner(IDocument document)

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

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

#### setupJavaDocumentPartitioner

    public void setupJavaDocumentPartitioner(IDocument document,
                                             java.lang.String partitioning)

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

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

#### getPreferenceStore

    protected IPreferenceStore getPreferenceStore()

Returns this text tool's preference store.

Returns:
  the preference store

#### getCorePreferenceStore

    protected Preferences getCorePreferenceStore()

Returns this text tool's core preference store.

Returns:
  the core preference store