# com.bea.ide.sourceeditor.compiler
TwoWayEdit Class

public abstract class TwoWayEdit
extends `Object`

A utility class to handle the details of submitting a two-way edit request to the compiler. While this class may be used directly, two-way edits are almost always initiated with methods on the `ISourceElement``` interface, making direct use of this class unneccesary.

Hierarchy
  `Object`
  `TwoWayEdit`

Direct Known Subclasses
  `TwoWayEdit.AddChild`, `TwoWayEdit.ChangeProperty`, `TwoWayEdit.RemoveChild`

## Nested Class Summary

`public static class` | `TwoWayEdit.AddChild` A TwoWayEdit representing the addition of a child to a source element.
`public static class` | `TwoWayEdit.ChangeProperty` A two-way edit representing the change of a single element property.
`public static class` | `TwoWayEdit.RemoveChild` A two-way edit representing the removal of a child from a source element.

## Field Summary

`protected `Object`` | `_data` Object
`protected `ISourceElement`` | `_elemSource` ISourceElement

## Constructor Summary

TwoWayEdit(`ISourceElement` elemSource, `Object` data)

## Method Summary

`public abstract boolean` | `doEdit`(`IStructureFeature` feature) This method performs the actual two-way edit by pushing the requested change to the compiler via the specified IStructureFeature.
`public boolean` | `fire`() Performs the two-way edit by getting a compiler lock, then requesting the edit.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Detail

### _data

    protected Object _data

### _elemSource

    protected ISourceElement _elemSource

## Constructor Detail

### TwoWayEdit

    protected TwoWayEdit(ISourceElement elemSource,
                         Object data)

## Method Detail

### doEdit(IStructureFeature) Method

    public abstract boolean doEdit(IStructureFeature feature)
         throws InvalidElementException

This method performs the actual two-way edit by pushing the requested change to the compiler via the specified IStructureFeature.

#### Parameters

feature
  The IStructureFeature for the document that owns the source elements to be affected by the two-way edit.

#### Exceptions

``InvalidElementException``
  if any of the source elements involved in the two-way edit have since been removed from the parse tree. Element status can be checked prior to the two-way edit by calling `ISourceElement.getStatus```.

### fire() Method

    public boolean fire()
         throws InvalidElementException

Performs the two-way edit by getting a compiler lock, then requesting the edit. This method assumes that the document is synchronized (no outstanding compilations).

#### Returns

boolean indicating success or failure.

#### Exceptions

``InvalidElementException``
  if an edit is attempted on an element that is not part of a valid parse tree.