Search
Powered by Squarespace
Stalk Richard

 
Article Topics
« Challenge with calling SOAP services via Applescript | Main | Removed Joomla its back to Wordpress time. »
Sunday
Jul062008

SWT StyledText SuperClass

I extended a superclass of StyledText to Add support for undo and redo operations.

First lets import a few things we are going to need:

   import java.util.LinkedList;
import java.util.List;

import org.eclipse.swt.custom.ExtendedModifyEvent;
import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;


The LinkedList and List java.util routines are needed because our undo and redo additions are going to need a place to store on a couple of stacks the data to undo or redo. Lets start by creating a class "MyStyledText" that extends the SWT StyledText class.

public class MyStyledText extends StyledText {

private class undoRedoItem {
public Character Action;
public int Location;
public String Data;

public undoRedoItem(Character Action,
int Location, String Data) {
this.Action = Action;
this.Location = Location;
this.Data = Data;
}
}

 

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>