Bug 520420 - Run formatter on org.eclipse.ui.regex code

Change-Id: I9b44f7b3212e3a10a4a06c3bd5c6dc32bfc6a965
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Group.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Group.java
index 8caf2ec..169b8a0 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Group.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Group.java
@@ -11,18 +11,15 @@
  ******************************************************************************/

 package org.eclipse.ui.regex;

 

-

 public class Group {

-	

+

 	private int index;

 	private String text;

-	

+

 	public Group(int index, String text) {

 		this.index = index;

 		this.text = text;

 	}

-	

-	

 

 	/**

 	 * @return Returns the index.

@@ -30,6 +27,7 @@
 	public int getIndex() {

 		return index;

 	}

+

 	/**

 	 * @return Returns the text.

 	 */

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/IRegExListener.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/IRegExListener.java
index 2a7dbec..6b48336 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/IRegExListener.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/IRegExListener.java
@@ -13,13 +13,17 @@
 

 import org.eclipse.ui.regex.event.IListener;

 

-

 public interface IRegExListener extends IListener {

-	

+

 	public void foundMatches(Matches matches);

+

 	public void foundNoMatches();

+

 	public void expressionError(String errMsg);

+

 	public void doneWithReplace(ReplaceResult result);

+

 	public void doneWithSplit(String[] result);

-    public void updateRequested();

+

+	public void updateRequested();

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Match.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Match.java
index 8fca7b6..d867428 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Match.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Match.java
@@ -16,32 +16,38 @@
 

 /**

  * Defines a single match with was found.

+ * 

  * @author sbrosinski

  * @version $$Id: Match.java,v 1.4 2004/06/15 11:49:17 sbrosin Exp $$

  */

- 

-public class Match {

-	/** the match's start index within the search text */ 

-	private int	start_;

-	/** the match's end index within the search text */ 	

-	private int	end_;

 

-	/** contains the match text actually found */ 

+public class Match {

+	/** the match's start index within the search text */

+	private int start_;

+	/** the match's end index within the search text */

+	private int end_;

+

+	/** contains the match text actually found */

 	private String text_;

 

 	private ArrayList groups_;

 

 	/**

 	 * Construct a Match.

-	 * @param id	an id, identifying the match uniquely

-	 * @param start the match's start index within the search text

-	 * @param end   the match's end index within the search text 

-	 * @param text  contains the match text actually found

+	 * 

+	 * @param id

+	 *            an id, identifying the match uniquely

+	 * @param start

+	 *            the match's start index within the search text

+	 * @param end

+	 *            the match's end index within the search text

+	 * @param text

+	 *            contains the match text actually found

 	 */

 	public Match(int start, int end, String text) {

-		start_ 	= start;

-		end_ 	= end;

-		text_	= text;

+		start_ = start;

+		end_ = end;

+		text_ = text;

 		groups_ = new ArrayList();

 	}

 

@@ -52,60 +58,63 @@
 	public int getGroupCount() {

 		return groups_.size();

 	}

-	

+

 	public List getGroups() {

 		return groups_;

 	}

 

 	/**

 	 * Gets the end index of found match.

+	 * 

 	 * @return end index of found match

 	 */

 	public int getEnd() {

 		return end_;

 	}

 

-

 	/**

 	 * Gets the start index of found match.

+	 * 

 	 * @return start index of found match

 	 */

 	public int getStart() {

 		return start_;

 	}

 

-

 	/**

 	 * Gets the match text.

+	 * 

 	 * @return the match text

 	 */

 	public String getText() {

 		return text_;

 	}

 

-

-

 	/**

 	 * Sets the end end index of found match.

-	 * @param end end index of found match

+	 * 

+	 * @param end

+	 *            end index of found match

 	 */

 	public void setEnd(int end) {

 		end_ = end;

 	}

 

-

 	/**

 	 * Sets the start end index of found match.

-	 * @param start start index of found match

+	 * 

+	 * @param start

+	 *            start index of found match

 	 */

 	public void setStart(int start) {

 		start_ = start;

 	}

 

-

 	/**

 	 * Sets the match text.

-	 * @param text the match text

+	 * 

+	 * @param text

+	 *            the match text

 	 */

 	public void setText(String text) {

 		text_ = text;

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Matches.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Matches.java
index a2a3a15..f48fbd2 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Matches.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/Matches.java
@@ -14,22 +14,22 @@
 import java.util.ArrayList;

 import java.util.Iterator;

 

-

 /**

- * Encapsulates all matches found during a single matching session. 

+ * Encapsulates all matches found during a single matching session.

+ * 

  * @author sbrosinski

  * @version $$Id: Matches.java,v 1.6 2004/09/06 10:35:16 sbrosin Exp $$

  */

 public class Matches {

 

 	/** a list containing all matches. */

-	private ArrayList	matchList_;

-	

-	/** virtual marker, can be set to a certain position within the matches

-	 *  list. Is used to provide previousMatch/nextMatch result scrolling.

-	 * */

-	private int			posMarker_;

+	private ArrayList matchList_;

 

+	/**

+	 * virtual marker, can be set to a certain position within the matches list. Is

+	 * used to provide previousMatch/nextMatch result scrolling.

+	 */

+	private int posMarker_;

 

 	/**

 	 * Constructs a new Matches object.

@@ -41,33 +41,34 @@
 	}

 

 	public Iterator iterator() {

-	    return matchList_.iterator();

+		return matchList_.iterator();

 	}

-	

-	

+

 	/**

 	 * Gets the number of matches found.

+	 * 

 	 * @return number of matches.

 	 */

 	public int getMatchCount() {

 		return matchList_.size();

 	}

 

-

-	/** 

+	/**

 	 * Gets the postion of the internal list marker.

+	 * 

 	 * @return position, 0 to numberOfMatches-1

 	 */

 	public int getMatchPos() {

 		return posMarker_;

 	}

 

-

 	/**

-	 * Returns the match found for a certain range withing the

-	 * search text.

-	 * @param start the range's start index

-	 * @param end	the range's end index

+	 * Returns the match found for a certain range withing the search text.

+	 * 

+	 * @param start

+	 *            the range's start index

+	 * @param end

+	 *            the range's end index

 	 * @return one Match or null, if no match was found

 	 */

 	public Match getMatchByRange(int start, int end) {

@@ -79,12 +80,10 @@
 		return null;

 	}

 

-

 	public void addMatch(Match match) {

 		matchList_.add(match);

 	}

 

-

 	public Match nextMatch() {

 		if (matchList_ == null)

 			return null;

@@ -98,7 +97,6 @@
 		return null;

 	}

 

-

 	public Match prevMatch() {

 		if (matchList_ == null)

 			return null;

@@ -112,17 +110,14 @@
 		return null;

 	}

 

-

 	public void resetMatchPos() {

 		posMarker_ = -1;

 	}

 

-

 	public void setMatchPos(int pos) {

 		posMarker_ = pos;

 	}

 

-

 	public void reset() {

 		matchList_ = new ArrayList();

 	}

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExListenerManager.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExListenerManager.java
index 678eb6e..98caeca 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExListenerManager.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExListenerManager.java
@@ -17,7 +17,7 @@
 import org.eclipse.ui.regex.event.ListenerManager;

 

 public class RegExListenerManager extends ListenerManager {

-	

+

 	public void publishExpressionError(String errMsg) {

 		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			IRegExListener listener = (IRegExListener) i.next();

@@ -26,38 +26,38 @@
 	}

 

 	public void publishFoundMatches(Matches foundMatches) {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			IRegExListener listener = (IRegExListener) i.next();

 			listener.foundMatches(foundMatches);

 		}

 	}

 

 	public void publishFoundNoMatches() {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			IRegExListener listener = (IRegExListener) i.next();

 			listener.foundNoMatches();

 		}

 	}

-	

+

 	public void publishDoneWithReplace(ReplaceResult result) {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			IRegExListener listener = (IRegExListener) i.next();

 			listener.doneWithReplace(result);

 		}

 	}

-	

+

 	public void publishDoneWithSplit(String[] result) {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			IRegExListener listener = (IRegExListener) i.next();

 			listener.doneWithSplit(result);

 		}

 	}

-	

+

 	public void updateRequested() {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			IRegExListener listener = (IRegExListener) i.next();

 			listener.updateRequested();

 		}

-	}	

-	

+	}

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExModel.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExModel.java
index 6410420..1c386ee 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExModel.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExModel.java
@@ -17,271 +17,270 @@
 

 public class RegExModel {

 

-    private static RegExModel _instance;

+	private static RegExModel _instance;

 

-    public final static int MODE_FIND = 0;

+	public final static int MODE_FIND = 0;

 

-    public final static int MODE_MATCH = 1;

+	public final static int MODE_MATCH = 1;

 

-    public final static int MODE_SPLIT = 2;

+	public final static int MODE_SPLIT = 2;

 

-    public final static int MODE_REPLACE = 3;

+	public final static int MODE_REPLACE = 3;

 

-    private int patternFlags;

+	private int patternFlags;

 

-    private Matches matches;

+	private Matches matches;

 

-    private boolean foundMatches;

+	private boolean foundMatches;

 

-    private int matchMode;

+	private int matchMode;

 

-    private String replace;

+	private String replace;

 

-    private String _regExp;

+	private String _regExp;

 

-    private String _searchText;

+	private String _searchText;

 

-    private RegExListenerManager regExListenerManager;

+	private RegExListenerManager regExListenerManager;

 

-    private String description;

-    

-    private RegExModel() {

-        matches = new Matches();

-        matchMode = MODE_FIND;

-        patternFlags = 0;

-        foundMatches = false;

-        regExListenerManager = new RegExListenerManager();

-    }

+	private String description;

 

-    public static RegExModel getInstance() {

-        if (_instance == null) {

-            _instance = new RegExModel();

-        }

-        return _instance;

-    }

+	private RegExModel() {

+		matches = new Matches();

+		matchMode = MODE_FIND;

+		patternFlags = 0;

+		foundMatches = false;

+		regExListenerManager = new RegExListenerManager();

+	}

 

-    public int getMatchMode() {

-        return matchMode;

-    }

-    

-    public void requestUpdate() {

-        regExListenerManager.updateRequested();

-    }

-    

-    public void addRegExListener(IRegExListener listener) {

-    	regExListenerManager.addListener(listener);

-    }

+	public static RegExModel getInstance() {

+		if (_instance == null) {

+			_instance = new RegExModel();

+		}

+		return _instance;

+	}

 

-    public void removeRegExListener(IRegExListener listener) {

-    	regExListenerManager.removeListener(listener);

-    }

+	public int getMatchMode() {

+		return matchMode;

+	}

 

-    public void process() {

-        foundMatches = false;

-        matches = new Matches();

-        if (_regExp.equals("") || _searchText.equals("")) {

-        	regExListenerManager.publishFoundNoMatches();

-            return;

-        }

-        try {

-            Pattern pattern = Pattern.compile(_regExp, getPatternFlags());

-            Matcher match = pattern.matcher(_searchText);

-            switch (matchMode) {

-            case MODE_FIND: {

-                find(match);

-                break;

-            }

-            case MODE_MATCH: {

-                match(match);

-                break;

-            }

-            case MODE_REPLACE: {

-                replace(match);

-                break;

-            }

-            case MODE_SPLIT: {

-                split(match, pattern);

-                break;

-            }

-            }

-        } catch (PatternSyntaxException patternSyntaxException) {

-        	regExListenerManager.publishExpressionError(patternSyntaxException.getMessage());

-        }

-    }

+	public void requestUpdate() {

+		regExListenerManager.updateRequested();

+	}

 

-    private void find(Matcher match) {

-        if (processMatches(match)) {

-        	regExListenerManager.publishFoundMatches(matches);

-        } else {

-        	regExListenerManager.publishFoundNoMatches();

-        }

-    }

-    

-    private void match(Matcher match) {

+	public void addRegExListener(IRegExListener listener) {

+		regExListenerManager.addListener(listener);

+	}

 

-        if (match.matches()) {

-            foundMatches = true;

-            matches.addMatch(new Match(match.start(), match.end(), match

-                    .group(0)));

-            regExListenerManager.publishFoundMatches(matches);

-        } else {

-        	regExListenerManager.publishFoundNoMatches();

-        }

+	public void removeRegExListener(IRegExListener listener) {

+		regExListenerManager.removeListener(listener);

+	}

 

-    }

+	public void process() {

+		foundMatches = false;

+		matches = new Matches();

+		if (_regExp.equals("") || _searchText.equals("")) {

+			regExListenerManager.publishFoundNoMatches();

+			return;

+		}

+		try {

+			Pattern pattern = Pattern.compile(_regExp, getPatternFlags());

+			Matcher match = pattern.matcher(_searchText);

+			switch (matchMode) {

+			case MODE_FIND: {

+				find(match);

+				break;

+			}

+			case MODE_MATCH: {

+				match(match);

+				break;

+			}

+			case MODE_REPLACE: {

+				replace(match);

+				break;

+			}

+			case MODE_SPLIT: {

+				split(match, pattern);

+				break;

+			}

+			}

+		} catch (PatternSyntaxException patternSyntaxException) {

+			regExListenerManager.publishExpressionError(patternSyntaxException.getMessage());

+		}

+	}

 

-    private boolean processMatches(Matcher match) {

-        while (match.find()) {

-            foundMatches = true;

+	private void find(Matcher match) {

+		if (processMatches(match)) {

+			regExListenerManager.publishFoundMatches(matches);

+		} else {

+			regExListenerManager.publishFoundNoMatches();

+		}

+	}

 

-            Match aMatch = new Match(match.start(), match.end(), match.group(0));

-            for (int i = 0; i < match.groupCount() + 1; i++) {

-                aMatch.addGroup(new Group(i, match.group(i)));

-            }

-            matches.addMatch(aMatch);

-        }

-        return foundMatches;

-    }

+	private void match(Matcher match) {

 

-    private void replace(Matcher match) {

-        if (replace != null) {

-            if (processMatches(match)) {

-                String resultText = match.replaceAll(replace);

-                regExListenerManager.publishDoneWithReplace(new ReplaceResult(resultText, matches));

-            } else {

-            	regExListenerManager.publishFoundNoMatches();

-            }

-        }

-    }

+		if (match.matches()) {

+			foundMatches = true;

+			matches.addMatch(new Match(match.start(), match.end(), match.group(0)));

+			regExListenerManager.publishFoundMatches(matches);

+		} else {

+			regExListenerManager.publishFoundNoMatches();

+		}

 

+	}

 

-    private void split(Matcher match, Pattern pattern) {

-        if (processMatches(match)) {

-        	regExListenerManager.publishFoundMatches(matches);

-        	regExListenerManager.publishDoneWithSplit(pattern.split(_searchText));        

-        } else {

-        	regExListenerManager.publishFoundNoMatches();

-        }

-    }    

-    

+	private boolean processMatches(Matcher match) {

+		while (match.find()) {

+			foundMatches = true;

 

-    public void setMatchMode(int mode) {

-        matchMode = mode;

-    }

+			Match aMatch = new Match(match.start(), match.end(), match.group(0));

+			for (int i = 0; i < match.groupCount() + 1; i++) {

+				aMatch.addGroup(new Group(i, match.group(i)));

+			}

+			matches.addMatch(aMatch);

+		}

+		return foundMatches;

+	}

 

-    public void setReplace(String theReplace) {

-        replace = theReplace;

-    }

+	private void replace(Matcher match) {

+		if (replace != null) {

+			if (processMatches(match)) {

+				String resultText = match.replaceAll(replace);

+				regExListenerManager.publishDoneWithReplace(new ReplaceResult(resultText, matches));

+			} else {

+				regExListenerManager.publishFoundNoMatches();

+			}

+		}

+	}

 

-    public String getReplace() {

-        return replace;

-    }

+	private void split(Matcher match, Pattern pattern) {

+		if (processMatches(match)) {

+			regExListenerManager.publishFoundMatches(matches);

+			regExListenerManager.publishDoneWithSplit(pattern.split(_searchText));

+		} else {

+			regExListenerManager.publishFoundNoMatches();

+		}

+	}

 

-    public void reset() {

-        foundMatches = false;

-        matches = new Matches();

-        _regExp = "";

-        _searchText = "";

-    }

+	public void setMatchMode(int mode) {

+		matchMode = mode;

+	}

 

-    public boolean foundMatches() {

-        return foundMatches;

-    }

+	public void setReplace(String theReplace) {

+		replace = theReplace;

+	}

 

-    public Matches getMatches() {

-        return matches;

-    }

+	public String getReplace() {

+		return replace;

+	}

 

-    public void addPatternFlag(int flag) {

-        patternFlags += flag;

-    }

+	public void reset() {

+		foundMatches = false;

+		matches = new Matches();

+		_regExp = "";

+		_searchText = "";

+	}

 

-    public void removePatternFlag(int flag) {

-        patternFlags -= flag;

-    }

+	public boolean foundMatches() {

+		return foundMatches;

+	}

 

-    public void resetPatternFlag() {

-        patternFlags = 0;

-    }

+	public Matches getMatches() {

+		return matches;

+	}

 

-    public int getPatternFlags() {

-        return patternFlags;

-    }

+	public void addPatternFlag(int flag) {

+		patternFlags += flag;

+	}

 

-    public String getPatternFlagsAsString() {

-        if (patternFlags == 0)

-            return "";

-        StringBuffer out = new StringBuffer();

-        if ((patternFlags & Pattern.CANON_EQ) != 0)

-            out.append("Pattern.CANON_EQ+");

-        if ((patternFlags & Pattern.CASE_INSENSITIVE) != 0)

-            out.append("Pattern.CASE_INSENSITIVE+");

-        if ((patternFlags & Pattern.COMMENTS) != 0)

-            out.append("Pattern.COMMENTS+");

-        if ((patternFlags & Pattern.DOTALL) != 0)

-            out.append("Pattern.DOTALL+");

-        if ((patternFlags & Pattern.MULTILINE) != 0)

-            out.append("Pattern.MULTILINE+");

-        if ((patternFlags & Pattern.UNICODE_CASE) != 0)

-            out.append("Pattern.UNICODE_CASE+");

-        if ((patternFlags & Pattern.UNIX_LINES) != 0)

-            out.append("Pattern.UNIX_LINES+");

-        String outStr = out.toString();

-        return outStr.substring(0, outStr.length() - 1);

-    }

+	public void removePatternFlag(int flag) {

+		patternFlags -= flag;

+	}

 

-    public String getRegExAsLiteral() {

-        StringBuffer out = new StringBuffer();

-        char[] chars = getRegExp().toCharArray();

-        for (int i = 0; i < chars.length; i++) {

-            if (chars[i] == '\\') {

-                out.append("\\\\");

-            } else if (chars[i] == '"') {

-                out.append("\\\"");

-            } else {

-                out.append(chars[i]);

-            }

-        }

-        return out.toString();

-    }

+	public void resetPatternFlag() {

+		patternFlags = 0;

+	}

 

-    /**

-     * @return Returns the _regExp.

-     */

-    public String getRegExp() {

-        return _regExp;

-    }

+	public int getPatternFlags() {

+		return patternFlags;

+	}

 

-    /**

-     * @param exp The _regExp to set.

-     */

-    public void setRegExp(String exp) {

-        _regExp = exp;

-    }

+	public String getPatternFlagsAsString() {

+		if (patternFlags == 0)

+			return "";

+		StringBuffer out = new StringBuffer();

+		if ((patternFlags & Pattern.CANON_EQ) != 0)

+			out.append("Pattern.CANON_EQ+");

+		if ((patternFlags & Pattern.CASE_INSENSITIVE) != 0)

+			out.append("Pattern.CASE_INSENSITIVE+");

+		if ((patternFlags & Pattern.COMMENTS) != 0)

+			out.append("Pattern.COMMENTS+");

+		if ((patternFlags & Pattern.DOTALL) != 0)

+			out.append("Pattern.DOTALL+");

+		if ((patternFlags & Pattern.MULTILINE) != 0)

+			out.append("Pattern.MULTILINE+");

+		if ((patternFlags & Pattern.UNICODE_CASE) != 0)

+			out.append("Pattern.UNICODE_CASE+");

+		if ((patternFlags & Pattern.UNIX_LINES) != 0)

+			out.append("Pattern.UNIX_LINES+");

+		String outStr = out.toString();

+		return outStr.substring(0, outStr.length() - 1);

+	}

 

-    /**

-     * @return Returns the _searchText.

-     */

-    public String getSearchText() {

-        return _searchText;

-    }

+	public String getRegExAsLiteral() {

+		StringBuffer out = new StringBuffer();

+		char[] chars = getRegExp().toCharArray();

+		for (int i = 0; i < chars.length; i++) {

+			if (chars[i] == '\\') {

+				out.append("\\\\");

+			} else if (chars[i] == '"') {

+				out.append("\\\"");

+			} else {

+				out.append(chars[i]);

+			}

+		}

+		return out.toString();

+	}

 

-    /**

-     * @param text The _searchText to set.

-     */

-    public void setSearchText(String text) {

-        _searchText = text;

-    }

+	/**

+	 * @return Returns the _regExp.

+	 */

+	public String getRegExp() {

+		return _regExp;

+	}

 

-    /**

-     * @param descr

-     */

-    public void setDescription(String description) {

-        this.description = description;        

-    }

-    

-    public String getDescription() {

-        return description;

-    }

-    

+	/**

+	 * @param exp

+	 *            The _regExp to set.

+	 */

+	public void setRegExp(String exp) {

+		_regExp = exp;

+	}

+

+	/**

+	 * @return Returns the _searchText.

+	 */

+	public String getSearchText() {

+		return _searchText;

+	}

+

+	/**

+	 * @param text

+	 *            The _searchText to set.

+	 */

+	public void setSearchText(String text) {

+		_searchText = text;

+	}

+

+	/**

+	 * @param descr

+	 */

+	public void setDescription(String description) {

+		this.description = description;

+	}

+

+	public String getDescription() {

+		return description;

+	}

+

 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExPlugin.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExPlugin.java
index c4cbf7e..f89a888 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExPlugin.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/RegExPlugin.java
@@ -20,14 +20,13 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;

 import org.osgi.framework.BundleContext;

 

-

 public class RegExPlugin extends AbstractUIPlugin {

 

 	private static RegExPlugin plugin;

-	

-	//Resource bundle.

+

+	// Resource bundle.

 	private ResourceBundle resourceBundle;

-	

+

 	/**

 	 * The constructor.

 	 */

@@ -64,8 +63,7 @@
 	}

 

 	/**

-	 * Returns the string from the plugin's resource bundle,

-	 * or 'key' if not found.

+	 * Returns the string from the plugin's resource bundle, or 'key' if not found.

 	 */

 	public static String getResourceString(String key) {

 		ResourceBundle bundle = RegExPlugin.getDefault().getResourceBundle();

@@ -82,24 +80,22 @@
 	public ResourceBundle getResourceBundle() {

 		return resourceBundle;

 	}

-	

 

-	

 	protected void initializeDefaultPluginPreferences() {

-		getPreferenceStore().setDefault("Pattern.CANON_EQ",false);

-		getPreferenceStore().setDefault("Pattern.CASE_INSENSITIVE",false);

-		getPreferenceStore().setDefault("Pattern.COMMENTS",false);

-		getPreferenceStore().setDefault("Pattern.DOTALL",false);

-		getPreferenceStore().setDefault("Pattern.MULTILINE",false);

-		getPreferenceStore().setDefault("Pattern.UNICODE_CASE",false);

-		getPreferenceStore().setDefault("Pattern.UNIX_LINES",false);

-		getPreferenceStore().setDefault("EvalRegEx",false);

-		getPreferenceStore().setDefault("EvalSearch",false);

-		getPreferenceStore().setDefault("EvalBoth",true);

-		getPreferenceStore().setDefault("EvalSwitch",false);

-		

+		getPreferenceStore().setDefault("Pattern.CANON_EQ", false);

+		getPreferenceStore().setDefault("Pattern.CASE_INSENSITIVE", false);

+		getPreferenceStore().setDefault("Pattern.COMMENTS", false);

+		getPreferenceStore().setDefault("Pattern.DOTALL", false);

+		getPreferenceStore().setDefault("Pattern.MULTILINE", false);

+		getPreferenceStore().setDefault("Pattern.UNICODE_CASE", false);

+		getPreferenceStore().setDefault("Pattern.UNIX_LINES", false);

+		getPreferenceStore().setDefault("EvalRegEx", false);

+		getPreferenceStore().setDefault("EvalSearch", false);

+		getPreferenceStore().setDefault("EvalBoth", true);

+		getPreferenceStore().setDefault("EvalSwitch", false);

+

 		FontData systemFont = Display.getCurrent().getSystemFont().getFontData()[0];

-		

+

 		getPreferenceStore().setDefault("font.regex.name", systemFont.getName());

 		getPreferenceStore().setDefault("font.regex.height", systemFont.getHeight());

 		getPreferenceStore().setDefault("font.regex.style", systemFont.getStyle());

@@ -111,10 +107,8 @@
 		getPreferenceStore().setDefault("font.result.style", systemFont.getStyle());

 	}

 

-	

 	public ImageDescriptor getImageDescriptor(String imageName) {

 		return imageDescriptorFromPlugin("org.eclipse.ui.regex", "icons/" + imageName);

 	}

 

-

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/ReplaceResult.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/ReplaceResult.java
index 20fb1dc..9f43963 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/ReplaceResult.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/ReplaceResult.java
@@ -11,16 +11,15 @@
  ******************************************************************************/

 package org.eclipse.ui.regex;

 

-

 public class ReplaceResult {

-	

+

 	private Matches matches;

 	private String resultText;

-	

+

 	public ReplaceResult(String resultText, Matches matches) {

 		this.resultText = resultText;

 		this.matches = matches;

-		

+

 	}

 

 	/**

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/event/ListenerManager.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/event/ListenerManager.java
index 5a17976..6f31668 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/event/ListenerManager.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/event/ListenerManager.java
@@ -15,11 +15,10 @@
 import java.util.ArrayList;

 import java.util.List;

 

-

 public abstract class ListenerManager {

-	

+

 	private List listeners = new ArrayList();

-	

+

 	public void addListener(IListener listener) {

 		listeners.add(listener);

 	}

@@ -27,8 +26,8 @@
 	public void removeListener(IListener listener) {

 		listeners.remove(listener);

 	}

-	

+

 	protected List getListeners() {

-	    return listeners;

+		return listeners;

 	}

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistKeyAdapter.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistKeyAdapter.java
index 475654c..3e2c310 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistKeyAdapter.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistKeyAdapter.java
@@ -20,51 +20,42 @@
 import org.eclipse.swt.graphics.Point;

 import org.eclipse.swt.graphics.Rectangle;

 

-

 public class AssistKeyAdapter extends KeyAdapter {

 

 	private StyledText textField;

-	

+

 	public void keyPressed(KeyEvent e) {

 		textField = (StyledText) e.widget;

 		int caretOffset = textField.getCaretOffset();

 

-		if (textField.getText().equals("") || caretOffset == 0) return;

+		if (textField.getText().equals("") || caretOffset == 0)

+			return;

 

 		String textSoFar = textField.getText(0, caretOffset - 1);

 

 		ArrayList proposals = Assistant.getAssistItems(textSoFar);

-				

+

 		if (proposals.size() != 0 && e.stateMask == SWT.CONTROL && e.keyCode == 32) {

 			Proposal proposal = showProposals(proposals);

 

-				if (proposal != null) {

+			if (proposal != null) {

 

-					textField.replaceTextRange(caretOffset

-							- proposal.getReplaceCount(), proposal

-							.getReplaceCount(), proposal

-							.getSubstitute());

-					textField.setCaretOffset(caretOffset

-							+ proposal.getSubstitute().length() - proposal.getReplaceCount());

-				} else {

-					textField.setCaretOffset(caretOffset);

-				}

-		

-				

-		} 

+				textField.replaceTextRange(caretOffset - proposal.getReplaceCount(), proposal.getReplaceCount(),

+						proposal.getSubstitute());

+				textField.setCaretOffset(caretOffset + proposal.getSubstitute().length() - proposal.getReplaceCount());

+			} else {

+				textField.setCaretOffset(caretOffset);

+			}

+

+		}

 	}

-	

+

 	protected Proposal showProposals(ArrayList proposals) {

 		AssistPopup assist = new AssistPopup(textField.getShell());

 		assist.setProposals(proposals);

-		Point pos = textField.toDisplay(textField.getCaret()

-				.getLocation());

-		return assist.open(new Rectangle(

-				pos.x + 10, pos.y - 90, 140, 120));

-		

+		Point pos = textField.toDisplay(textField.getCaret().getLocation());

+		return assist.open(new Rectangle(pos.x + 10, pos.y - 90, 140, 120));

+

 	}

-	

 

-

-	

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistPopup.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistPopup.java
index 82bec58..e9cc9da 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistPopup.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/AssistPopup.java
@@ -11,7 +11,6 @@
  ******************************************************************************/

 package org.eclipse.ui.regex.view;

 

-

 import java.util.ArrayList;

 import java.util.Iterator;

 

@@ -31,152 +30,156 @@
 import org.eclipse.swt.widgets.Listener;

 import org.eclipse.swt.widgets.Shell;

 

-

 public class AssistPopup {

-	private Shell  shell;

-	private List   list;

-	private int    minimumWidth;

+	private Shell shell;

+	private List list;

+	private int minimumWidth;

 	private ArrayList proposals;

 	private static final Color bgColor = new Color(Display.getCurrent(), 254, 241, 233);

-	

-public AssistPopup(Shell parent) {

-	this(parent, 0);

-}

 

+	public AssistPopup(Shell parent) {

+		this(parent, 0);

+	}

 

-public AssistPopup(Shell parent, int style) {

-	shell = new Shell(parent, checkStyle(style));

-	

-	list = new List(shell, SWT.SINGLE | SWT.V_SCROLL);	

-	list.setBackground(bgColor);

-	

-	// close dialog if user selects outside of the shell

-	shell.addListener(SWT.Deactivate, new Listener() {

-		public void handleEvent(Event e){	

-			shell.setVisible (false);

-		}

-	});

-	

-	// resize shell when list resizes

-	shell.addControlListener(new ControlListener() {

-		public void controlMoved(ControlEvent e){}

-		public void controlResized(ControlEvent e){

-			Rectangle shellSize = shell.getClientArea();

-			list.setSize(shellSize.width, shellSize.height);

-		}

-	});

-	

-	// return list selection on Mouse Up or Carriage Return

-	list.addMouseListener(new MouseListener() {

-		public void mouseDoubleClick(MouseEvent e){}

-		public void mouseDown(MouseEvent e){}

-		public void mouseUp(MouseEvent e){

-			shell.setVisible (false);

-		}

-	});

-	list.addKeyListener(new KeyListener() {

-		public void keyReleased(KeyEvent e){}

-		public void keyPressed(KeyEvent e){

-			if (e.character == '\r'){

-				shell.setVisible (false);

+	public AssistPopup(Shell parent, int style) {

+		shell = new Shell(parent, checkStyle(style));

+

+		list = new List(shell, SWT.SINGLE | SWT.V_SCROLL);

+		list.setBackground(bgColor);

+

+		// close dialog if user selects outside of the shell

+		shell.addListener(SWT.Deactivate, new Listener() {

+			public void handleEvent(Event e) {

+				shell.setVisible(false);

 			}

-		}

-	});

-	

-}

-private static int checkStyle (int style) {

-	int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;

-	return style & mask;

-}

+		});

 

+		// resize shell when list resizes

+		shell.addControlListener(new ControlListener() {

+			public void controlMoved(ControlEvent e) {

+			}

 

-public Proposal open (Rectangle rect) {

+			public void controlResized(ControlEvent e) {

+				Rectangle shellSize = shell.getClientArea();

+				list.setSize(shellSize.width, shellSize.height);

+			}

+		});

 

-	Point listSize = list.computeSize (rect.width, SWT.DEFAULT);

-	Rectangle screenSize = shell.getDisplay().getBounds();

+		// return list selection on Mouse Up or Carriage Return

+		list.addMouseListener(new MouseListener() {

+			public void mouseDoubleClick(MouseEvent e) {

+			}

 

-	// Position the dialog so that it does not run off the screen and the largest number of items are visible

-	int spaceBelow = screenSize.height - (rect.y + rect.height) - 30;

-	int spaceAbove = rect.y - 30;

+			public void mouseDown(MouseEvent e) {

+			}

 

-	int y = 0;

-	if (spaceAbove > spaceBelow && listSize.y > spaceBelow) {

-		// place popup list above table cell

-		if (listSize.y > spaceAbove){

-			listSize.y = spaceAbove;

+			public void mouseUp(MouseEvent e) {

+				shell.setVisible(false);

+			}

+		});

+		list.addKeyListener(new KeyListener() {

+			public void keyReleased(KeyEvent e) {

+			}

+

+			public void keyPressed(KeyEvent e) {

+				if (e.character == '\r') {

+					shell.setVisible(false);

+				}

+			}

+		});

+

+	}

+

+	private static int checkStyle(int style) {

+		int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;

+		return style & mask;

+	}

+

+	public Proposal open(Rectangle rect) {

+

+		Point listSize = list.computeSize(rect.width, SWT.DEFAULT);

+		Rectangle screenSize = shell.getDisplay().getBounds();

+

+		// Position the dialog so that it does not run off the screen and the largest

+		// number of items are visible

+		int spaceBelow = screenSize.height - (rect.y + rect.height) - 30;

+		int spaceAbove = rect.y - 30;

+

+		int y = 0;

+		if (spaceAbove > spaceBelow && listSize.y > spaceBelow) {

+			// place popup list above table cell

+			if (listSize.y > spaceAbove) {

+				listSize.y = spaceAbove;

+			} else {

+				listSize.y += 2;

+			}

+			y = rect.y - listSize.y;

+

 		} else {

-			listSize.y += 2;

+			// place popup list below table cell

+			if (listSize.y > spaceBelow) {

+				listSize.y = spaceBelow;

+			} else {

+				listSize.y += 2;

+			}

+			y = rect.y + rect.height;

 		}

-		y = rect.y - listSize.y;

-		

-	} else {

-		// place popup list below table cell

-		if (listSize.y > spaceBelow){

-			listSize.y = spaceBelow;

-		} else {

-			listSize.y += 2;

+

+		// Make dialog as wide as the cell

+		listSize.x = rect.width;

+		// dialog width should not be les than minimumwidth

+		if (listSize.x < minimumWidth)

+			listSize.x = minimumWidth;

+

+		// Align right side of dialog with right side of cell

+		int x = rect.x + rect.width - listSize.x;

+

+		shell.setBounds(x, y, listSize.x, listSize.y);

+

+		shell.open();

+		list.setFocus();

+

+		Display display = shell.getDisplay();

+		while (!shell.isDisposed() && shell.isVisible()) {

+			if (!display.readAndDispatch())

+				display.sleep();

 		}

-		y = rect.y + rect.height;

+

+		Proposal result = null;

+		if (!shell.isDisposed()) {

+			if (list.getSelectionIndex() != -1) {

+				result = (Proposal) proposals.get(list.getSelectionIndex());

+			}

+			shell.dispose();

+		}

+		return result;

 	}

-	

-	// Make dialog as wide as the cell

-	listSize.x = rect.width;

-	// dialog width should not be les than minimumwidth

-	if (listSize.x < minimumWidth)

-		listSize.x = minimumWidth;

-	

-	// Align right side of dialog with right side of cell

-	int x = rect.x + rect.width - listSize.x;

-	

-	shell.setBounds(x, y, listSize.x, listSize.y);

-	

-	shell.open();

-	list.setFocus();

 

-	Display display = shell.getDisplay();

-	while (!shell.isDisposed () && shell.isVisible ()) {

-		if (!display.readAndDispatch()) display.sleep();

-	}

-	

-	Proposal result = null;

-	if (!shell.isDisposed ()) {

-		if (list.getSelectionIndex() != -1) {

-			result = (Proposal) proposals.get(list.getSelectionIndex());

-		} 

-		shell.dispose();

-	}

-	return result;

-}

+	public void select(String string) {

+		String[] items = list.getItems();

 

-

-public void select(String string) {

-	String[] items = list.getItems();

-

-	// find the first entry in the list that starts with the

-	// specified string

-	if (string != null){

-		for (int i = 0; i < items.length; i++) {

-			if (items[i].startsWith(string)){

-				int index = list.indexOf(items[i]);

-				list.select(index);

-				break;

+		// find the first entry in the list that starts with the

+		// specified string

+		if (string != null) {

+			for (int i = 0; i < items.length; i++) {

+				if (items[i].startsWith(string)) {

+					int index = list.indexOf(items[i]);

+					list.select(index);

+					break;

+				}

 			}

 		}

 	}

-}

 

-public void setProposals(ArrayList proposals) {

-	this.proposals = proposals;

-	int c = 0;

-	String[] items = new String[proposals.size()];

-	for (Iterator i = proposals.iterator(); i.hasNext(); ) {

-		Proposal proposal = (Proposal) i.next();

-		items[c++] = proposal.getDescription();

+	public void setProposals(ArrayList proposals) {

+		this.proposals = proposals;

+		int c = 0;

+		String[] items = new String[proposals.size()];

+		for (Iterator i = proposals.iterator(); i.hasNext();) {

+			Proposal proposal = (Proposal) i.next();

+			items[c++] = proposal.getDescription();

+		}

+		list.setItems(items);

 	}

-	list.setItems(items);

-}

-

 

 }

-

-

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Assistant.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Assistant.java
index 05c556c..3955b2a 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Assistant.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Assistant.java
@@ -13,10 +13,8 @@
 

 import java.util.ArrayList;

 

-

 public class Assistant {

 

-

 	public static ArrayList getAssistItems(String textLeftOfCursor) {

 		ArrayList proposals = new ArrayList();

 		if (textLeftOfCursor.endsWith("\\")) {

@@ -25,8 +23,7 @@
 			proposals.add(new Proposal("\\B", "Non-word boundary \\B", 1));

 			proposals.add(new Proposal("\\d", "Digit \\d", 1));

 			proposals.add(new Proposal("\\D", "Non-digit \\D", 1));

-			proposals

-					.add(new Proposal("\\G", "End of previous match \\G", 1));

+			proposals.add(new Proposal("\\G", "End of previous match \\G", 1));

 			proposals.add(new Proposal("\\n", "Newline \\n", 1));

 			proposals.add(new Proposal("\\r", "Carriage-return \\r", 1));

 			proposals.add(new Proposal("\\s", "Whitespace \\s", 1));

@@ -42,10 +39,8 @@
 			proposals.add(new Proposal("(?:", "Non-capturing group (?:", 2));

 			proposals.add(new Proposal("(?=", "Positive lookahead (?=", 2));

 			proposals.add(new Proposal("(?!", "Negative lookahead (?!", 2));

-			proposals

-					.add(new Proposal("(?<=", "Positive lookbehind (?<=", 2));

-			proposals

-					.add(new Proposal("(?<!", "Negative lookbehind (?<!", 2));

+			proposals.add(new Proposal("(?<=", "Positive lookbehind (?<=", 2));

+			proposals.add(new Proposal("(?<!", "Negative lookbehind (?<!", 2));

 

 		}

 

@@ -56,8 +51,8 @@
 			proposals.add(new Proposal("[a-zA-Z]", "[a-zA-Z]", 1));

 			proposals.add(new Proposal("[a-zA-Z0-9]", "[a-zA-Z0-9]", 1));

 		}

-		

+

 		return proposals;

 	}

-	

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/BracketMatchingKeyAdapter.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/BracketMatchingKeyAdapter.java
index b7e24aa..45ce1dc 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/BracketMatchingKeyAdapter.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/BracketMatchingKeyAdapter.java
@@ -23,30 +23,30 @@
 	public void keyPressed(KeyEvent e) {

 		StyledText txt_RegExp = (StyledText) e.widget;

 		txt_RegExp.setStyleRange(null);

-		

-		if (matchableBracket(e.character)) { 

-			

+

+		if (matchableBracket(e.character)) {

+

 			markMatchingBracket(txt_RegExp, e.character);

 

 		} else {

-				

+

 			final int KEY_LEFT_ARROW = 16777219;

 			final int KEY_RIGHT_ARROW = 16777220;

-	

+

 			if (e.keyCode == KEY_LEFT_ARROW || e.keyCode == KEY_RIGHT_ARROW) {

-			

+

 				int caretOffset = txt_RegExp.getCaretOffset();

 				String lastText = " ";

 				if (caretOffset - 1 >= 0) {

 					lastText = txt_RegExp.getText(caretOffset - 1, caretOffset - 1);

 				}

-		

+

 				if (matchableBracket(lastText.charAt(0))) {

 					markMatchingBracket(txt_RegExp, lastText.charAt(0));

 				}

-			

+

 			}

-		

+

 		}

 

 	}

@@ -55,7 +55,7 @@
 		int caretOffset = txt_RegExp.getCaretOffset();

 		int brakePos = -1;

 		int ignoreInnerBracket = 0;

-		

+

 		if (isClosingBracket(bracket)) {

 			String text = txt_RegExp.getText(0, caretOffset - 1);

 			for (int i = text.length() - 2; i >= 0; i--) {

@@ -72,7 +72,7 @@
 				}

 			}

 		}

-			

+

 		if (isOpeningBracket(bracket)) {

 			if (caretOffset != txt_RegExp.getText().length()) {

 				String text = txt_RegExp.getText(caretOffset, txt_RegExp.getText().length() - 1);

@@ -90,56 +90,65 @@
 					}

 				}

 			}

-		}		

-		

+		}

+

 		if (brakePos != -1) {

-			StyleRange styleRange1 = new StyleRange(brakePos, 1, Display

-					.getCurrent().getSystemColor(SWT.COLOR_RED), Display

-					.getCurrent().getSystemColor(SWT.COLOR_WHITE), SWT.BOLD);

-			StyleRange styleRange2 = new StyleRange(caretOffset - 1, 1, Display

-					.getCurrent().getSystemColor(SWT.COLOR_RED), Display

-					.getCurrent().getSystemColor(SWT.COLOR_WHITE), SWT.BOLD);

-			

+			StyleRange styleRange1 = new StyleRange(brakePos, 1, Display.getCurrent().getSystemColor(SWT.COLOR_RED),

+					Display.getCurrent().getSystemColor(SWT.COLOR_WHITE), SWT.BOLD);

+			StyleRange styleRange2 = new StyleRange(caretOffset - 1, 1,

+					Display.getCurrent().getSystemColor(SWT.COLOR_RED),

+					Display.getCurrent().getSystemColor(SWT.COLOR_WHITE), SWT.BOLD);

+

 			if (isOpeningBracket(bracket)) {

-				txt_RegExp

-					.setStyleRanges(new StyleRange[]{styleRange2, styleRange1});

+				txt_RegExp.setStyleRanges(new StyleRange[] { styleRange2, styleRange1 });

 			}

 			if (isClosingBracket(bracket)) {

-				txt_RegExp

-					.setStyleRanges(new StyleRange[]{styleRange1, styleRange2});

+				txt_RegExp.setStyleRanges(new StyleRange[] { styleRange1, styleRange2 });

 			}

 		}

 	}

-	

+

 	protected boolean matchableBracket(char bracket) {

 		if (bracket == ')' || bracket == ']' || bracket == '(' || bracket == '[' || bracket == '}' || bracket == '{') {

 			return true;

-		} else  {

+		} else {

 			return false;

 		}

 	}

-	

+

 	protected char getMatchingBracket(char bracket) {

-		if (bracket == ')') return '(';

-		if (bracket == '(') return ')';

-		if (bracket == ']') return '[';

-		if (bracket == '[') return ']';

-		if (bracket == '}') return '{';

-		if (bracket == '{') return '}';

+		if (bracket == ')')

+			return '(';

+		if (bracket == '(')

+			return ')';

+		if (bracket == ']')

+			return '[';

+		if (bracket == '[')

+			return ']';

+		if (bracket == '}')

+			return '{';

+		if (bracket == '{')

+			return '}';

 		return ' ';

 	}

-	

+

 	protected boolean isOpeningBracket(char bracket) {

-		if (bracket == '(') return true;

-		if (bracket == '[') return true;

-		if (bracket == '{') return true;

-		return false;	

+		if (bracket == '(')

+			return true;

+		if (bracket == '[')

+			return true;

+		if (bracket == '{')

+			return true;

+		return false;

 	}

-	

+

 	protected boolean isClosingBracket(char bracket) {

-		if (bracket == ')') return true;

-		if (bracket == ']') return true;

-		if (bracket == '}') return true;

-		return false;	

+		if (bracket == ')')

+			return true;

+		if (bracket == ']')

+			return true;

+		if (bracket == '}')

+			return true;

+		return false;

 	}

 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/CopyDeclarationAdapter.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/CopyDeclarationAdapter.java
index 46697ca..fcaa828 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/CopyDeclarationAdapter.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/CopyDeclarationAdapter.java
@@ -18,7 +18,6 @@
 import org.eclipse.swt.events.SelectionEvent;

 import org.eclipse.ui.regex.RegExModel;

 

-

 public class CopyDeclarationAdapter extends SelectionAdapter {

 

 	public void widgetSelected(SelectionEvent e) {

@@ -29,10 +28,9 @@
 			text += "\"," + RegExModel.getInstance().getPatternFlagsAsString() + ");";

 		Clipboard clipboard = new Clipboard(e.display);

 		TextTransfer textTransfer = TextTransfer.getInstance();

-		clipboard.setContents(new Object[]{text},

-				new Transfer[]{textTransfer});

+		clipboard.setContents(new Object[] { text }, new Transfer[] { textTransfer });

 		clipboard.dispose();

 

 	}

-	

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Expression.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Expression.java
index 171ecc6..9050a8f 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Expression.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Expression.java
@@ -11,91 +11,97 @@
  ******************************************************************************/

 package org.eclipse.ui.regex.view;

 

-

 public class Expression {

 

-    private String regex = "";

+	private String regex = "";

 

-    private String searchText = "";

+	private String searchText = "";

 

-    private String name = "";

+	private String name = "";

 

-    private int matchMode = 0;

+	private int matchMode = 0;

 

-    private int patternFlag = 0;

-    

+	private int patternFlag = 0;

 

-    public Expression(String name) {

-        this.name = name;

-    }

+	public Expression(String name) {

+		this.name = name;

+	}

 

-    /**

-     * @param name The name to set.

-     */

-    public void setName(String name) {

-        this.name = name;

-    }

-    

-    /* (non-Javadoc)

-     * @see java.lang.Object#hashCode()

-     */

-    public int hashCode() {

-        int hash = 7;

+	/**

+	 * @param name

+	 *            The name to set.

+	 */

+	public void setName(String name) {

+		this.name = name;

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see java.lang.Object#hashCode()

+	 */

+	public int hashCode() {

+		int hash = 7;

 		hash = 31 * hash + (null == name ? 0 : name.hashCode());

 		return hash;

-    }

-    

-    /* (non-Javadoc)

-     * @see java.lang.Object#equals(java.lang.Object)

-     */

-    public boolean equals(Object o) {

-        if (o == this) return true;

-        if (o == null) return false;

-        if (! (o instanceof Expression)) return false;

-        Expression state = (Expression) o;

-        if (name.equals(state.getName())) {

-            	return true;

-        }              

-        return false;

-    }

-    

-    public String toString() {

-        return name;

-    }

+	}

 

-    public String getName() {

-        return name;

-    }

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see java.lang.Object#equals(java.lang.Object)

+	 */

+	public boolean equals(Object o) {

+		if (o == this)

+			return true;

+		if (o == null)

+			return false;

+		if (!(o instanceof Expression))

+			return false;

+		Expression state = (Expression) o;

+		if (name.equals(state.getName())) {

+			return true;

+		}

+		return false;

+	}

 

-    public int getMatchMode() {

-        return matchMode;

-    }

+	public String toString() {

+		return name;

+	}

 

-    public void setMatchMode(int matchMode) {

-        this.matchMode = matchMode;

-    }

+	public String getName() {

+		return name;

+	}

 

-    public int getPatternFlag() {

-        return patternFlag;

-    }

+	public int getMatchMode() {

+		return matchMode;

+	}

 

-    public void setPatternFlag(int patternFlag) {

-        this.patternFlag = patternFlag;

-    }

+	public void setMatchMode(int matchMode) {

+		this.matchMode = matchMode;

+	}

 

-    public String getRegex() {

-        return regex;

-    }

+	public int getPatternFlag() {

+		return patternFlag;

+	}

 

-    public void setRegex(String regex) {

-        this.regex = regex;

-    }

+	public void setPatternFlag(int patternFlag) {

+		this.patternFlag = patternFlag;

+	}

 

-    public String getSearchText() {

-        return searchText;

-    }

+	public String getRegex() {

+		return regex;

+	}

 

-    public void setSearchText(String searchText) {

-        this.searchText = searchText;

-    }

+	public void setRegex(String regex) {

+		this.regex = regex;

+	}

+

+	public String getSearchText() {

+		return searchText;

+	}

+

+	public void setSearchText(String searchText) {

+		this.searchText = searchText;

+	}

 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ExpressionLoader.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ExpressionLoader.java
index 22e4f74..5b2d32a 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ExpressionLoader.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ExpressionLoader.java
@@ -15,43 +15,49 @@
 import java.util.Iterator;

 import java.util.List;

 

-

 public class ExpressionLoader {

 

-    private List listener = new ArrayList();

-    

-    private static ExpressionLoader instance;

-    

-    public static ExpressionLoader getInstance() {

-        if (instance == null) {

-            instance = new ExpressionLoader();

-        }

-        return instance;

-    }

-    

-    private ExpressionLoader() {}

-    

-    /* (non-Javadoc)

-     * @see org.eclipse.ui.regex.view.IExpressionLoader#addExpressionLoaderListener(org.eclipse.ui.regex.view.IExpressionLoaderListener)

-     */

-    public void addExpressionLoaderListener(IExpressionLoaderListener loaderListener) {

-        listener.add(loaderListener);        

-    }

+	private List listener = new ArrayList();

 

-    /* (non-Javadoc)

-     * @see org.eclipse.ui.regex.view.IExpressionLoader#removeExpressionLoaderListener(org.eclipse.ui.regex.view.IExpressionLoaderListener)

-     */

-    public void removeExpressionLoaderListener(IExpressionLoaderListener loaderListener) {

-        listener.remove(loaderListener);    

-    }

+	private static ExpressionLoader instance;

 

-    

-    public void fireLoadExpression(Expression expression) {

-        for (Iterator i = listener.iterator(); i.hasNext();) {

-            IExpressionLoaderListener l = (IExpressionLoaderListener) i.next();

-            l.loadExpression(expression);

-        }

-    }

-    

-    

+	public static ExpressionLoader getInstance() {

+		if (instance == null) {

+			instance = new ExpressionLoader();

+		}

+		return instance;

+	}

+

+	private ExpressionLoader() {

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see

+	 * org.eclipse.ui.regex.view.IExpressionLoader#addExpressionLoaderListener(org.

+	 * eclipse.ui.regex.view.IExpressionLoaderListener)

+	 */

+	public void addExpressionLoaderListener(IExpressionLoaderListener loaderListener) {

+		listener.add(loaderListener);

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see

+	 * org.eclipse.ui.regex.view.IExpressionLoader#removeExpressionLoaderListener(

+	 * org.eclipse.ui.regex.view.IExpressionLoaderListener)

+	 */

+	public void removeExpressionLoaderListener(IExpressionLoaderListener loaderListener) {

+		listener.remove(loaderListener);

+	}

+

+	public void fireLoadExpression(Expression expression) {

+		for (Iterator i = listener.iterator(); i.hasNext();) {

+			IExpressionLoaderListener l = (IExpressionLoaderListener) i.next();

+			l.loadExpression(expression);

+		}

+	}

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/FontPreferencePage.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/FontPreferencePage.java
index 19daffb..c515c10 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/FontPreferencePage.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/FontPreferencePage.java
@@ -30,198 +30,214 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;

 import org.eclipse.ui.regex.RegExPlugin;

 

-

 public class FontPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, SelectionListener {

 

-    private Button regexFontButton;

-    private Text regexFontText;

-    private FontData regexFontData;

-    private Text searchTextFontText;

-    private Button searchTextFontButton;

-    private Text resultFontText;

-    private Button resultFontButton;

-    private FontData searchTextFontData;

-    private FontData resultFontData;

-    

-    /* (non-Javadoc)

-     * @see org.eclipse.jface.preference.PreferencePage#performDefaults()

-     */

-    protected void performDefaults() {

-        String fontName   = getPreferenceStore().getDefaultString("font.regex.name");

-        int fontHeight = getPreferenceStore().getDefaultInt("font.regex.height");

-        int fontStyle  = getPreferenceStore().getDefaultInt("font.regex.style");

-        regexFontData = new FontData(fontName, fontHeight, fontStyle);

-        regexFontText.setText(buildDescription(fontName, fontHeight));

-    }

-    

-    private void setFontData() {

-        if (regexFontData != null) {

+	private Button regexFontButton;

+	private Text regexFontText;

+	private FontData regexFontData;

+	private Text searchTextFontText;

+	private Button searchTextFontButton;

+	private Text resultFontText;

+	private Button resultFontButton;

+	private FontData searchTextFontData;

+	private FontData resultFontData;

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.jface.preference.PreferencePage#performDefaults()

+	 */

+	protected void performDefaults() {

+		String fontName = getPreferenceStore().getDefaultString("font.regex.name");

+		int fontHeight = getPreferenceStore().getDefaultInt("font.regex.height");

+		int fontStyle = getPreferenceStore().getDefaultInt("font.regex.style");

+		regexFontData = new FontData(fontName, fontHeight, fontStyle);

+		regexFontText.setText(buildDescription(fontName, fontHeight));

+	}

+

+	private void setFontData() {

+		if (regexFontData != null) {

 			getPreferenceStore().setValue("font.regex.name", regexFontData.getName());

 			getPreferenceStore().setValue("font.regex.height", regexFontData.getHeight());

 			getPreferenceStore().setValue("font.regex.style", regexFontData.getStyle());

-        }

-        if (searchTextFontData != null) {

+		}

+		if (searchTextFontData != null) {

 			getPreferenceStore().setValue("font.searchtext.name", searchTextFontData.getName());

 			getPreferenceStore().setValue("font.searchtext.height", searchTextFontData.getHeight());

 			getPreferenceStore().setValue("font.searchtext.style", searchTextFontData.getStyle());

-        }

-        if (resultFontData != null) {

+		}

+		if (resultFontData != null) {

 			getPreferenceStore().setValue("font.result.name", resultFontData.getName());

 			getPreferenceStore().setValue("font.result.height", resultFontData.getHeight());

 			getPreferenceStore().setValue("font.result.style", resultFontData.getStyle());

-        }        

-    }

-    

-    /* (non-Javadoc)

-     * @see org.eclipse.jface.preference.PreferencePage#performApply()

-     */

-    protected void performApply() {

-        setFontData();

-    }

-    

-	/* (non-Javadoc)

-     * @see org.eclipse.jface.preference.IPreferencePage#performOk()

-     */

-    public boolean performOk() {

-        setFontData();

+		}

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.jface.preference.PreferencePage#performApply()

+	 */

+	protected void performApply() {

+		setFontData();

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.jface.preference.IPreferencePage#performOk()

+	 */

+	public boolean performOk() {

+		setFontData();

 		RegExPlugin.getDefault().savePluginPreferences();

 		return true;

-    }

-    

-    

-    /* (non-Javadoc)

-     * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)

-     */

-    protected Control createContents(Composite parent) {

-        Composite composite = new Composite(parent, SWT.NONE);

-        

-        GridLayout gridLayout = new GridLayout();

-        gridLayout.numColumns = 2;

-        composite.setLayout(gridLayout);

-        composite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));

-        

-        Label regexFontLabel = new Label(composite, SWT.NONE);

-        regexFontLabel.setText("Regular Expression Font:");

-        GridData gridData = new GridData();

-        gridData.horizontalSpan = 2;

-        regexFontLabel.setLayoutData(gridData);

-        

-        regexFontText = new Text(composite, SWT.BORDER);

-        regexFontText.setText(buildDescription(fontName("regex"), fontHeight("regex")));

-        regexFontText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

-        regexFontText.setFont(createFont("regex"));

-        

-        regexFontButton = new Button(composite, SWT.PUSH);

-        regexFontButton.setText("Change...");

-        regexFontButton.addSelectionListener(this);

-        regexFontButton.setData("regex");

-        regexFontButton.setLayoutData(new GridData());

+	}

 

-        Label searchTextFontLabel = new Label(composite, SWT.NONE);

-        searchTextFontLabel.setText("Search Text Font:");

-        gridData = new GridData();

-        gridData.horizontalSpan = 2;

-        searchTextFontLabel.setLayoutData(gridData);

-        

-        searchTextFontText = new Text(composite, SWT.BORDER);

-        searchTextFontText.setText(buildDescription(fontName("searchtext"), fontHeight("searchtext")));

-        searchTextFontText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

-        searchTextFontText.setFont(createFont("searchtext"));

-        

-        searchTextFontButton = new Button(composite, SWT.PUSH);

-        searchTextFontButton.setText("Change...");

-        searchTextFontButton.addSelectionListener(this);

-        searchTextFontButton.setData("searchtext");

-        searchTextFontButton.setLayoutData(new GridData());

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see

+	 * org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.

+	 * widgets.Composite)

+	 */

+	protected Control createContents(Composite parent) {

+		Composite composite = new Composite(parent, SWT.NONE);

 

-        Label resultFontLabel = new Label(composite, SWT.NONE);

-        resultFontLabel.setText("Result Font:");

-        gridData = new GridData();

-        gridData.horizontalSpan = 2;

-        resultFontLabel.setLayoutData(gridData);

-        

-        resultFontText = new Text(composite, SWT.BORDER);

-        resultFontText.setText(buildDescription(fontName("result"), fontHeight("result")));

-        resultFontText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

-        resultFontText.setFont(createFont("result"));

-        

-        resultFontButton = new Button(composite, SWT.PUSH);

-        resultFontButton.setText("Change...");

-        resultFontButton.addSelectionListener(this);

-        resultFontButton.setData("result");

-        resultFontButton.setLayoutData(new GridData());       

-        

-        return parent;

-    }

-    

-    private String fontName(String type) {

-        return getPreferenceStore().getString("font." + type + ".name");

-    }

+		GridLayout gridLayout = new GridLayout();

+		gridLayout.numColumns = 2;

+		composite.setLayout(gridLayout);

+		composite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));

 

-    private int fontHeight(String type) {

-        return getPreferenceStore().getInt("font." + type + ".height");

-    }

+		Label regexFontLabel = new Label(composite, SWT.NONE);

+		regexFontLabel.setText("Regular Expression Font:");

+		GridData gridData = new GridData();

+		gridData.horizontalSpan = 2;

+		regexFontLabel.setLayoutData(gridData);

 

-    private int fontStyle(String type) {

-        return getPreferenceStore().getInt("font." + type + ".style");

-    }

-    

-    private FontData fontData(String type) {

-        return new FontData(fontName(type), fontHeight(type), fontStyle(type));

-    }

-    

-    private Font createFont(String type) {

-        return new Font(Display.getCurrent(), fontData(type));

-    }

-    

+		regexFontText = new Text(composite, SWT.BORDER);

+		regexFontText.setText(buildDescription(fontName("regex"), fontHeight("regex")));

+		regexFontText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

+		regexFontText.setFont(createFont("regex"));

 

-    /* (non-Javadoc)

-     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)

-     */

-    public void init(IWorkbench workbench) {

-        this.setPreferenceStore(RegExPlugin.getDefault().getPreferenceStore());

-        

-    }

+		regexFontButton = new Button(composite, SWT.PUSH);

+		regexFontButton.setText("Change...");

+		regexFontButton.addSelectionListener(this);

+		regexFontButton.setData("regex");

+		regexFontButton.setLayoutData(new GridData());

 

-    /* (non-Javadoc)

-     * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)

-     */

-    public void widgetSelected(SelectionEvent e) {

-        if (e.widget == regexFontButton || e.widget == searchTextFontButton || e.widget == resultFontButton) {

-            FontDialog fontDialog = new FontDialog(getShell());

-            fontDialog.setFontList(new FontData[]{fontData((String) ((Button) e.widget).getData())});

-            FontData fontData = fontDialog.open();

-            if (fontData != null) {

-                if (e.widget == regexFontButton) {

-	                regexFontData = fontData;

-	                regexFontText.setText(fontData.getName() + ", " + fontData.getHeight());

-	                regexFontText.setFont(new Font(Display.getCurrent(), fontData));

-                }

-                if (e.widget == searchTextFontButton) {

-	                searchTextFontData = fontData;

-	                searchTextFontText.setText(fontData.getName() + ", " + fontData.getHeight());

-	                searchTextFontText.setFont(new Font(Display.getCurrent(), fontData));

-                }

-                if (e.widget == resultFontButton) {

-	                resultFontData = fontData;

-	                resultFontText.setText(fontData.getName() + ", " + fontData.getHeight());

-	                resultFontText.setFont(new Font(Display.getCurrent(), fontData));

-                }

-            }

-        }

-        

-    }

+		Label searchTextFontLabel = new Label(composite, SWT.NONE);

+		searchTextFontLabel.setText("Search Text Font:");

+		gridData = new GridData();

+		gridData.horizontalSpan = 2;

+		searchTextFontLabel.setLayoutData(gridData);

 

-    /* (non-Javadoc)

-     * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)

-     */

-    public void widgetDefaultSelected(SelectionEvent e) {

-        // TODO Auto-generated method stub

-        

-    }

+		searchTextFontText = new Text(composite, SWT.BORDER);

+		searchTextFontText.setText(buildDescription(fontName("searchtext"), fontHeight("searchtext")));

+		searchTextFontText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

+		searchTextFontText.setFont(createFont("searchtext"));

 

-    private String buildDescription(String fontName, int fontHeight) {

-        return fontName + ", " + fontHeight;

-    }

+		searchTextFontButton = new Button(composite, SWT.PUSH);

+		searchTextFontButton.setText("Change...");

+		searchTextFontButton.addSelectionListener(this);

+		searchTextFontButton.setData("searchtext");

+		searchTextFontButton.setLayoutData(new GridData());

+

+		Label resultFontLabel = new Label(composite, SWT.NONE);

+		resultFontLabel.setText("Result Font:");

+		gridData = new GridData();

+		gridData.horizontalSpan = 2;

+		resultFontLabel.setLayoutData(gridData);

+

+		resultFontText = new Text(composite, SWT.BORDER);

+		resultFontText.setText(buildDescription(fontName("result"), fontHeight("result")));

+		resultFontText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

+		resultFontText.setFont(createFont("result"));

+

+		resultFontButton = new Button(composite, SWT.PUSH);

+		resultFontButton.setText("Change...");

+		resultFontButton.addSelectionListener(this);

+		resultFontButton.setData("result");

+		resultFontButton.setLayoutData(new GridData());

+

+		return parent;

+	}

+

+	private String fontName(String type) {

+		return getPreferenceStore().getString("font." + type + ".name");

+	}

+

+	private int fontHeight(String type) {

+		return getPreferenceStore().getInt("font." + type + ".height");

+	}

+

+	private int fontStyle(String type) {

+		return getPreferenceStore().getInt("font." + type + ".style");

+	}

+

+	private FontData fontData(String type) {

+		return new FontData(fontName(type), fontHeight(type), fontStyle(type));

+	}

+

+	private Font createFont(String type) {

+		return new Font(Display.getCurrent(), fontData(type));

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)

+	 */

+	public void init(IWorkbench workbench) {

+		this.setPreferenceStore(RegExPlugin.getDefault().getPreferenceStore());

+

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.

+	 * events.SelectionEvent)

+	 */

+	public void widgetSelected(SelectionEvent e) {

+		if (e.widget == regexFontButton || e.widget == searchTextFontButton || e.widget == resultFontButton) {

+			FontDialog fontDialog = new FontDialog(getShell());

+			fontDialog.setFontList(new FontData[] { fontData((String) ((Button) e.widget).getData()) });

+			FontData fontData = fontDialog.open();

+			if (fontData != null) {

+				if (e.widget == regexFontButton) {

+					regexFontData = fontData;

+					regexFontText.setText(fontData.getName() + ", " + fontData.getHeight());

+					regexFontText.setFont(new Font(Display.getCurrent(), fontData));

+				}

+				if (e.widget == searchTextFontButton) {

+					searchTextFontData = fontData;

+					searchTextFontText.setText(fontData.getName() + ", " + fontData.getHeight());

+					searchTextFontText.setFont(new Font(Display.getCurrent(), fontData));

+				}

+				if (e.widget == resultFontButton) {

+					resultFontData = fontData;

+					resultFontText.setText(fontData.getName() + ", " + fontData.getHeight());

+					resultFontText.setFont(new Font(Display.getCurrent(), fontData));

+				}

+			}

+		}

+

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see

+	 * org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.

+	 * swt.events.SelectionEvent)

+	 */

+	public void widgetDefaultSelected(SelectionEvent e) {

+		// TODO Auto-generated method stub

+

+	}

+

+	private String buildDescription(String fontName, int fontHeight) {

+		return fontName + ", " + fontHeight;

+	}

 

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/IExpressionLoaderListener.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/IExpressionLoaderListener.java
index e7551e2..a9c54db 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/IExpressionLoaderListener.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/IExpressionLoaderListener.java
@@ -11,9 +11,8 @@
  ******************************************************************************/

 package org.eclipse.ui.regex.view;

 

-

 public interface IExpressionLoaderListener {

-    

-    public void loadExpression(Expression expression);

+

+	public void loadExpression(Expression expression);

 

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ILiveEvalListener.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ILiveEvalListener.java
index 447d203..72826f9 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ILiveEvalListener.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/ILiveEvalListener.java
@@ -14,12 +14,14 @@
 

 import org.eclipse.ui.regex.event.IListener;

 

-

 public interface ILiveEvalListener extends IListener {

-	

+

 	public void evalActivated();

+

 	public void evalDeactivated();

+

 	public void evalDone();

+

 	public void doEval();

-	

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEval.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEval.java
index dfbbc51..e86031a 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEval.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEval.java
@@ -20,105 +20,100 @@
 import org.eclipse.ui.regex.RegExPlugin;

 

 public class LiveEval {

-	

+

 	private LiveEvalListenerManager liveEvalListenerManager;

 

-    class LiveEvalListener implements ExtendedModifyListener {

+	class LiveEvalListener implements ExtendedModifyListener {

 

-        public void modifyText(ExtendedModifyEvent event) {

-            if (LiveEval.this.isLiveEval()) LiveEval.this.doEval();

-        }

-    }

+		public void modifyText(ExtendedModifyEvent event) {

+			if (LiveEval.this.isLiveEval())

+				LiveEval.this.doEval();

+		}

+	}

 

-   

-    private boolean isLiveEval;

+	private boolean isLiveEval;

 

-    private LiveEvalListener liveEvalListener;

+	private LiveEvalListener liveEvalListener;

 

-    private StyledText regEx, searchText;

+	private StyledText regEx, searchText;

 

-    private IPreferenceStore prefs = RegExPlugin.getDefault()

-            .getPreferenceStore();

+	private IPreferenceStore prefs = RegExPlugin.getDefault().getPreferenceStore();

 

-    

-    public LiveEval(StyledText regEx, StyledText searchText) {

-        liveEvalListener = new LiveEvalListener();

-        this.regEx = regEx;

-        this.searchText = searchText;

-        isLiveEval = prefs.getBoolean("EvalSwitch");

-    

-        prefs.addPropertyChangeListener(new IPropertyChangeListener() {

+	public LiveEval(StyledText regEx, StyledText searchText) {

+		liveEvalListener = new LiveEvalListener();

+		this.regEx = regEx;

+		this.searchText = searchText;

+		isLiveEval = prefs.getBoolean("EvalSwitch");

 

-            public void propertyChange(PropertyChangeEvent event) {

-                if (LiveEval.this.regEx.isDisposed()

-                        || LiveEval.this.searchText.isDisposed()) { return; }

-                String prop = event.getProperty();

+		prefs.addPropertyChangeListener(new IPropertyChangeListener() {

 

-                if (prop.equals("EvalSwitch")) {

-                    boolean newVal = ((Boolean) event.getNewValue())

-                            .booleanValue();

-                    if (newVal)

-                        LiveEval.this.start();

-                    else

-                        LiveEval.this.stop();

-                }

-                if (LiveEval.this.isLiveEval()) updateChangeListeners();

-            }

-        });

-        liveEvalListenerManager = new LiveEvalListenerManager();

-    }

+			public void propertyChange(PropertyChangeEvent event) {

+				if (LiveEval.this.regEx.isDisposed() || LiveEval.this.searchText.isDisposed()) {

+					return;

+				}

+				String prop = event.getProperty();

 

-    public void addLiveEvalListener(ILiveEvalListener listener) {

-    	liveEvalListenerManager.addListener(listener);

-    }

+				if (prop.equals("EvalSwitch")) {

+					boolean newVal = ((Boolean) event.getNewValue()).booleanValue();

+					if (newVal)

+						LiveEval.this.start();

+					else

+						LiveEval.this.stop();

+				}

+				if (LiveEval.this.isLiveEval())

+					updateChangeListeners();

+			}

+		});

+		liveEvalListenerManager = new LiveEvalListenerManager();

+	}

 

-    public void removeLiveEvalListener(ILiveEvalListener listener) {

-    	liveEvalListenerManager.removeListener(listener);

-    }

-    

-    public boolean isLiveEval() {

-        return this.isLiveEval;

-    }

+	public void addLiveEvalListener(ILiveEvalListener listener) {

+		liveEvalListenerManager.addListener(listener);

+	}

 

-    public void start() {

-        this.isLiveEval = true;

-        updateChangeListeners();

-        liveEvalListenerManager.publishEvalActivated();

-    }

+	public void removeLiveEvalListener(ILiveEvalListener listener) {

+		liveEvalListenerManager.removeListener(listener);

+	}

 

-    public void stop() {

-        this.isLiveEval = false;

-        removeChangeListeners();

-        liveEvalListenerManager.publishEvalDeactivated();

-    }

-    

+	public boolean isLiveEval() {

+		return this.isLiveEval;

+	}

 

-  

-    private void doEval() {

-    	liveEvalListenerManager.publishDoEval();

-    	liveEvalListenerManager.publishEvalDone();

-    }

+	public void start() {

+		this.isLiveEval = true;

+		updateChangeListeners();

+		liveEvalListenerManager.publishEvalActivated();

+	}

 

-    private void removeChangeListeners() {

-        regEx.removeExtendedModifyListener(liveEvalListener);

-        searchText.removeExtendedModifyListener(liveEvalListener);

+	public void stop() {

+		this.isLiveEval = false;

+		removeChangeListeners();

+		liveEvalListenerManager.publishEvalDeactivated();

+	}

 

-    }

-    

-    private void updateChangeListeners() {

-        removeChangeListeners();

-        if (prefs.getBoolean("EvalSearch")) {

-            searchText.addExtendedModifyListener(liveEvalListener);

-        }

-        if (prefs.getBoolean("EvalRegEx")) {

-            regEx.addExtendedModifyListener(liveEvalListener);

-        }

-        if (prefs.getBoolean("EvalBoth")) {

-            searchText.addExtendedModifyListener(liveEvalListener);

-            regEx.addExtendedModifyListener(liveEvalListener);

-        }

-    }

+	private void doEval() {

+		liveEvalListenerManager.publishDoEval();

+		liveEvalListenerManager.publishEvalDone();

+	}

 

-    

-    

+	private void removeChangeListeners() {

+		regEx.removeExtendedModifyListener(liveEvalListener);

+		searchText.removeExtendedModifyListener(liveEvalListener);

+

+	}

+

+	private void updateChangeListeners() {

+		removeChangeListeners();

+		if (prefs.getBoolean("EvalSearch")) {

+			searchText.addExtendedModifyListener(liveEvalListener);

+		}

+		if (prefs.getBoolean("EvalRegEx")) {

+			regEx.addExtendedModifyListener(liveEvalListener);

+		}

+		if (prefs.getBoolean("EvalBoth")) {

+			searchText.addExtendedModifyListener(liveEvalListener);

+			regEx.addExtendedModifyListener(liveEvalListener);

+		}

+	}

+

 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEvalListenerManager.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEvalListenerManager.java
index 6c52311..4e4c7aa 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEvalListenerManager.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/LiveEvalListenerManager.java
@@ -15,36 +15,34 @@
 

 import org.eclipse.ui.regex.event.ListenerManager;

 

-

 public class LiveEvalListenerManager extends ListenerManager {

 

 	public void publishEvalActivated() {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			ILiveEvalListener listener = (ILiveEvalListener) i.next();

 			listener.evalActivated();

 		}

-		};

-		

+	};

+

 	public void publishEvalDeactivated() {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			ILiveEvalListener listener = (ILiveEvalListener) i.next();

 			listener.evalDeactivated();

 		}

-		};

-		

+	};

+

 	public void publishEvalDone() {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			ILiveEvalListener listener = (ILiveEvalListener) i.next();

 			listener.evalDone();

 		}

-		};

-		

+	};

+

 	public void publishDoEval() {

-		for (Iterator i = getListeners().iterator(); i.hasNext(); ) {

+		for (Iterator i = getListeners().iterator(); i.hasNext();) {

 			ILiveEvalListener listener = (ILiveEvalListener) i.next();

 			listener.doEval();

 		}

-		};

-		

-	

+	};

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Proposal.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Proposal.java
index 36a2cc3..d2382f5 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Proposal.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/Proposal.java
@@ -16,7 +16,7 @@
 	private String substitute;

 	private String description;

 	private int replaceCount;

-	

+

 	/**

 	 * @param substitute

 	 * @param description

@@ -28,40 +28,46 @@
 		this.replaceCount = replaceCount;

 	}

 

-

-

 	/**

 	 * @return Returns the replaceCount.

 	 */

 	public int getReplaceCount() {

 		return replaceCount;

 	}

+

 	/**

-	 * @param replaceCount The replaceCount to set.

+	 * @param replaceCount

+	 *            The replaceCount to set.

 	 */

 	public void setReplaceCount(int replaceCount) {

 		this.replaceCount = replaceCount;

 	}

+

 	/**

 	 * @return Returns the description.

 	 */

 	public String getDescription() {

 		return description;

 	}

+

 	/**

-	 * @param description The description to set.

+	 * @param description

+	 *            The description to set.

 	 */

 	public void setDescription(String description) {

 		this.description = description;

 	}

+

 	/**

 	 * @return Returns the substitute.

 	 */

 	public String getSubstitute() {

 		return substitute;

 	}

+

 	/**

-	 * @param substitute The substitute to set.

+	 * @param substitute

+	 *            The substitute to set.

 	 */

 	public void setSubstitute(String substitute) {

 		this.substitute = substitute;

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExPreferencePage.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExPreferencePage.java
index 6f34bc9..1c01b8c 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExPreferencePage.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExPreferencePage.java
@@ -25,7 +25,6 @@
 import org.eclipse.ui.IWorkbenchPreferencePage;

 import org.eclipse.ui.regex.RegExPlugin;

 

-

 public class RegExPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {

 

 	private Button btn_CanonicalEquivalence;

@@ -39,12 +38,11 @@
 	private Button btn_EvalSearch;

 	private Button btn_EvalBoth;

 	private Button btn_EvalSwitch;

-	

+

 	public RegExPreferencePage() {

 	}

 

-

-	public void init(IWorkbench workbench)  {

+	public void init(IWorkbench workbench) {

 		this.setPreferenceStore(RegExPlugin.getDefault().getPreferenceStore());

 	}

 

@@ -61,91 +59,91 @@
 		btn_EvalBoth.setSelection(getPreferenceStore().getDefaultBoolean("EvalBoth"));

 		btn_EvalSwitch.setSelection(getPreferenceStore().getDefaultBoolean("EvalSwitch"));

 	}

-	

+

 	public boolean performOk() {

-		getPreferenceStore().setValue("Pattern.CANON_EQ",btn_CanonicalEquivalence.getSelection());

-		getPreferenceStore().setValue("Pattern.CASE_INSENSITIVE",btn_CaseInsensitive.getSelection());

-		getPreferenceStore().setValue("Pattern.COMMENTS",btn_Comments.getSelection());

-		getPreferenceStore().setValue("Pattern.DOTALL",btn_DotallMode.getSelection());

-		getPreferenceStore().setValue("Pattern.MULTILINE",btn_MultilineMode.getSelection());

-		getPreferenceStore().setValue("Pattern.UNICODE_CASE",btn_UnicodeCase.getSelection());

-		getPreferenceStore().setValue("Pattern.UNIX_LINES",btn_UnixLines.getSelection());

-		getPreferenceStore().setValue("EvalRegEx",btn_EvalRegEx.getSelection());

-		getPreferenceStore().setValue("EvalSearch",btn_EvalSearch.getSelection());

-		getPreferenceStore().setValue("EvalBoth",btn_EvalBoth.getSelection());

-		getPreferenceStore().setValue("EvalSwitch",btn_EvalSwitch.getSelection());		

+		getPreferenceStore().setValue("Pattern.CANON_EQ", btn_CanonicalEquivalence.getSelection());

+		getPreferenceStore().setValue("Pattern.CASE_INSENSITIVE", btn_CaseInsensitive.getSelection());

+		getPreferenceStore().setValue("Pattern.COMMENTS", btn_Comments.getSelection());

+		getPreferenceStore().setValue("Pattern.DOTALL", btn_DotallMode.getSelection());

+		getPreferenceStore().setValue("Pattern.MULTILINE", btn_MultilineMode.getSelection());

+		getPreferenceStore().setValue("Pattern.UNICODE_CASE", btn_UnicodeCase.getSelection());

+		getPreferenceStore().setValue("Pattern.UNIX_LINES", btn_UnixLines.getSelection());

+		getPreferenceStore().setValue("EvalRegEx", btn_EvalRegEx.getSelection());

+		getPreferenceStore().setValue("EvalSearch", btn_EvalSearch.getSelection());

+		getPreferenceStore().setValue("EvalBoth", btn_EvalBoth.getSelection());

+		getPreferenceStore().setValue("EvalSwitch", btn_EvalSwitch.getSelection());

 		RegExPlugin.getDefault().savePluginPreferences();

 		return true;

 	}

 

-	protected Control createContents(Composite parent)  {

+	protected Control createContents(Composite parent) {

 

-		Group group=new Group(parent,SWT.SHADOW_ETCHED_IN);

+		Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);

 		group.setText("Default Pattern Flags");

-		GridLayout groupGridLayout=new GridLayout();

-		groupGridLayout.numColumns=2;

-		

+		GridLayout groupGridLayout = new GridLayout();

+		groupGridLayout.numColumns = 2;

+

 		group.setLayout(groupGridLayout);

 		group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

-		

-		btn_CanonicalEquivalence=new Button(group,SWT.CHECK);

+

+		btn_CanonicalEquivalence = new Button(group, SWT.CHECK);

 		btn_CanonicalEquivalence.setText("Canonical &Equivalence");

 		btn_CanonicalEquivalence.setData(new Integer(Pattern.CANON_EQ));

 		btn_CanonicalEquivalence.setSelection(getPreferenceStore().getBoolean("Pattern.CANON_EQ"));

-		

-		btn_CaseInsensitive=new Button(group,SWT.CHECK);

+

+		btn_CaseInsensitive = new Button(group, SWT.CHECK);

 		btn_CaseInsensitive.setText("Case &Insensitive");

 		btn_CaseInsensitive.setData(new Integer(Pattern.CASE_INSENSITIVE));

 		btn_CaseInsensitive.setSelection(getPreferenceStore().getBoolean("Pattern.CASE_INSENSITIVE"));

-				

-		btn_Comments=new Button(group,SWT.CHECK);

+

+		btn_Comments = new Button(group, SWT.CHECK);

 		btn_Comments.setText("&Comments");

 		btn_Comments.setData(new Integer(Pattern.COMMENTS));

 		btn_Comments.setSelection(getPreferenceStore().getBoolean("Pattern.COMMENTS"));

-					

-		btn_DotallMode=new Button(group,SWT.CHECK);

+

+		btn_DotallMode = new Button(group, SWT.CHECK);

 		btn_DotallMode.setText("&Dotall Mode");

-		btn_DotallMode.setData(new Integer(Pattern.DOTALL));		

+		btn_DotallMode.setData(new Integer(Pattern.DOTALL));

 		btn_DotallMode.setSelection(getPreferenceStore().getBoolean("Pattern.DOTALL"));

-				

-		btn_MultilineMode=new Button(group,SWT.CHECK);

+

+		btn_MultilineMode = new Button(group, SWT.CHECK);

 		btn_MultilineMode.setText("&Multiline Mode");

 		btn_MultilineMode.setData(new Integer(Pattern.MULTILINE));

 		btn_MultilineMode.setSelection(getPreferenceStore().getBoolean("Pattern.MULTILINE"));

-		

-		btn_UnicodeCase=new Button(group,SWT.CHECK);

+

+		btn_UnicodeCase = new Button(group, SWT.CHECK);

 		btn_UnicodeCase.setText("&Unicode Case");

 		btn_UnicodeCase.setData(new Integer(Pattern.UNICODE_CASE));

 		btn_UnicodeCase.setSelection(getPreferenceStore().getBoolean("Pattern.UNICODE_CASE"));

-		

-		btn_UnixLines=new Button(group,SWT.CHECK);

+

+		btn_UnixLines = new Button(group, SWT.CHECK);

 		btn_UnixLines.setText("Unix &Lines");

 		btn_UnixLines.setData(new Integer(Pattern.UNIX_LINES));

 		btn_UnixLines.setSelection(getPreferenceStore().getBoolean("Pattern.UNIX_LINES"));

 

-		Group evalGroup=new Group(parent,SWT.SHADOW_ETCHED_IN);

+		Group evalGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);

 		evalGroup.setText("Live Evaluation");

-		GridLayout evalGridLayout=new GridLayout();

-		evalGridLayout.numColumns=1;

+		GridLayout evalGridLayout = new GridLayout();

+		evalGridLayout.numColumns = 1;

 		evalGroup.setLayout(evalGridLayout);

 		evalGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

 

-		btn_EvalRegEx=new Button(evalGroup,SWT.RADIO);

+		btn_EvalRegEx = new Button(evalGroup, SWT.RADIO);

 		btn_EvalRegEx.setText("React On &Regular Expression Changes");

 		btn_EvalRegEx.setSelection(getPreferenceStore().getBoolean("EvalRegEx"));

-		

-		btn_EvalSearch=new Button(evalGroup,SWT.RADIO);

+

+		btn_EvalSearch = new Button(evalGroup, SWT.RADIO);

 		btn_EvalSearch.setText("React On &Search Text Changes");

 		btn_EvalSearch.setSelection(getPreferenceStore().getBoolean("EvalSearch"));

-				

-		btn_EvalBoth=new Button(evalGroup,SWT.RADIO);

+

+		btn_EvalBoth = new Button(evalGroup, SWT.RADIO);

 		btn_EvalBoth.setText("&React On Everything");

 		btn_EvalBoth.setSelection(getPreferenceStore().getBoolean("EvalBoth"));

-				

-		btn_EvalSwitch=new Button(evalGroup,SWT.CHECK);

-		btn_EvalSwitch.setText("Use Live &Evaluation");										

+

+		btn_EvalSwitch = new Button(evalGroup, SWT.CHECK);

+		btn_EvalSwitch.setText("Use Live &Evaluation");

 		btn_EvalSwitch.setSelection(getPreferenceStore().getBoolean("EvalSwitch"));

-		

+

 		return null;

 	}

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExView.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExView.java
index 3cb84cd..1224aec 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExView.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/RegExView.java
@@ -67,798 +67,764 @@
 import org.eclipse.ui.regex.view.actions.StandardTextFieldAction;

 import org.eclipse.ui.regex.view.actions.StyledTextActionHandler;

 

+public class RegExView extends ViewPart implements SelectionListener, IRegExListener, ILiveEvalListener,

+		IExpressionLoaderListener, IPropertyChangeListener {

 

-public class RegExView extends ViewPart implements SelectionListener,

-        IRegExListener, ILiveEvalListener, IExpressionLoaderListener, IPropertyChangeListener {

+	private StyledText txt_RegExp;

 

-    private StyledText txt_RegExp;

+	private StyledText txt_SearchText;

 

-    private StyledText txt_SearchText;

+	private StyledText txt_Result;

 

-    private StyledText txt_Result;

+	private Label lbl_RegExp;

 

-    private Label lbl_RegExp;

+	private Button btn_Find, btn_LiveEval;

 

-    private Button btn_Find, btn_LiveEval;

+	private Composite cmp_ButtonGroup;

 

-    private Composite cmp_ButtonGroup;

+	private MenuItem mit_CopyLiteral, mit_mReplace, mit_mFind, mit_mMatch, mit_PasteLiteral, mit_mSplit,

+			mit_EvalSelection;

 

-    private MenuItem mit_CopyLiteral, mit_mReplace, mit_mFind, mit_mMatch,

-            mit_PasteLiteral, mit_mSplit, mit_EvalSelection;

+	private int currentCarresPos = 0;

 

-    private int currentCarresPos = 0;

+	private final RegExModel regex;

 

-    private final RegExModel regex;

+	private LiveEval liveEval;

 

-    private LiveEval liveEval;

+	private IAction prevMatchAction;

 

-    private IAction prevMatchAction;

+	private IAction nextMatchAction;

 

-    private IAction nextMatchAction;

+	private IAction clearAction;

 

-    private IAction clearAction;

+	private IPreferenceStore prefs;

 

-    private IPreferenceStore prefs;

-    

-    private Menu men_PatternFlags;

+	private Menu men_PatternFlags;

 

-    private String[] modeLabels = new String[] { "Find", "Match", "Split", "Replace"};

+	private String[] modeLabels = new String[] { "Find", "Match", "Split", "Replace" };

 

-    private static final Color COLOR_WHITE = Display.getCurrent()

-            .getSystemColor(SWT.COLOR_WHITE);

+	private static final Color COLOR_WHITE = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);

 

-    private static final Color COLOR_RED = Display.getCurrent().getSystemColor(

-            SWT.COLOR_RED);

+	private static final Color COLOR_RED = Display.getCurrent().getSystemColor(SWT.COLOR_RED);

 

-    private Menu men_MatchMode;

+	private Menu men_MatchMode;

 

-    private MenuItem mit_MatchMode;

+	private MenuItem mit_MatchMode;

 

-    private AboutAction aboutAction;

+	private AboutAction aboutAction;

 

-    

-    public RegExView() {

-    

-        regex = RegExModel.getInstance();

-        prefs = RegExPlugin.getDefault().getPreferenceStore();

-        prefs.addPropertyChangeListener(this);

-        regex.addRegExListener(this);

+	public RegExView() {

 

-        ExpressionLoader.getInstance().addExpressionLoaderListener(this);

-       

-    }

+		regex = RegExModel.getInstance();

+		prefs = RegExPlugin.getDefault().getPreferenceStore();

+		prefs.addPropertyChangeListener(this);

+		regex.addRegExListener(this);

 

-    /* (non-Javadoc)

-     * @see org.eclipse.ui.IWorkbenchPart#dispose()

-     */

-    public void dispose() {

-        regex.removeRegExListener(this);

-        prefs.removePropertyChangeListener(this);

-        ExpressionLoader.getInstance().removeExpressionLoaderListener(this);

-    }

-    

-    

-    public void createPartControl(final Composite parent) {

+		ExpressionLoader.getInstance().addExpressionLoaderListener(this);

 

-        makeActions();

+	}

 

-        GridLayout gridLayout = new GridLayout();

-        gridLayout.numColumns = 1;

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.ui.IWorkbenchPart#dispose()

+	 */

+	public void dispose() {

+		regex.removeRegExListener(this);

+		prefs.removePropertyChangeListener(this);

+		ExpressionLoader.getInstance().removeExpressionLoaderListener(this);

+	}

 

-        parent.setLayout(gridLayout);

-        GridData gridData = new GridData();

-        parent.setLayoutData(gridData);

+	public void createPartControl(final Composite parent) {

 

-        lbl_RegExp = new Label(parent, SWT.LEFT);

-        lbl_RegExp.setText("Regular Expression");

+		makeActions();

 

-        txt_RegExp = new StyledText(parent, SWT.LEFT | SWT.BORDER | SWT.SINGLE);

+		GridLayout gridLayout = new GridLayout();

+		gridLayout.numColumns = 1;

 

-      

-            txt_RegExp.addKeyListener(new BracketMatchingKeyAdapter());

-            txt_RegExp.addKeyListener(new AssistKeyAdapter());

-        

+		parent.setLayout(gridLayout);

+		GridData gridData = new GridData();

+		parent.setLayoutData(gridData);

 

-        // GRO: Store/Restore last input value from PreferenceStore

-        IPreferenceStore preferenceStore = RegExPlugin.getDefault().getPreferenceStore();

-        String preferenceKey = "txt_RegExp";

-        txt_RegExp.addFocusListener(new SaveLastValueToPreferenceStoreFocusAdapter(preferenceStore, preferenceKey));

-        txt_RegExp.setText(preferenceStore.getString(preferenceKey));

-        

-        

-        txt_RegExp.addFocusListener(new FocusListener() {

+		lbl_RegExp = new Label(parent, SWT.LEFT);

+		lbl_RegExp.setText("Regular Expression");

 

-            private int caretOffset;

+		txt_RegExp = new StyledText(parent, SWT.LEFT | SWT.BORDER | SWT.SINGLE);

 

-            public void focusGained(FocusEvent e) {

-                ((StyledText) e.widget).setCaretOffset(caretOffset);

-            }

+		txt_RegExp.addKeyListener(new BracketMatchingKeyAdapter());

+		txt_RegExp.addKeyListener(new AssistKeyAdapter());

 

-            public void focusLost(FocusEvent e) {

-                caretOffset = ((StyledText) e.widget).getCaretOffset();

-            }

-        });

+		// GRO: Store/Restore last input value from PreferenceStore

+		IPreferenceStore preferenceStore = RegExPlugin.getDefault().getPreferenceStore();

+		String preferenceKey = "txt_RegExp";

+		txt_RegExp.addFocusListener(new SaveLastValueToPreferenceStoreFocusAdapter(preferenceStore, preferenceKey));

+		txt_RegExp.setText(preferenceStore.getString(preferenceKey));

 

-        txt_RegExp.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.regex.name"), prefs.getInt("font.regex.height"), prefs.getInt("font.regex.style"))));

-        txt_RegExp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

+		txt_RegExp.addFocusListener(new FocusListener() {

 

-        txt_RegExp.setMenu(new Menu(parent.getShell()));

-        setTextMenuItems(txt_RegExp);

-        new MenuItem(txt_RegExp.getMenu(), SWT.BAR);

-        setPatternFlagMenu(txt_RegExp.getMenu());

+			private int caretOffset;

 

-        txt_RegExp.getMenu().addMenuListener(new MenuListener() {

+			public void focusGained(FocusEvent e) {

+				((StyledText) e.widget).setCaretOffset(caretOffset);

+			}

 

-               	

-            public void menuHidden(MenuEvent e) {

-     

-            }

+			public void focusLost(FocusEvent e) {

+				caretOffset = ((StyledText) e.widget).getCaretOffset();

+			}

+		});

 

-            public void menuShown(MenuEvent e) {

-                if (txt_RegExp.getSelectionCount() > 0) {

-                	mit_EvalSelection.setEnabled(true);

-                } else {

-                	mit_EvalSelection.setEnabled(false);

-                }

+		txt_RegExp.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.regex.name"),

+				prefs.getInt("font.regex.height"), prefs.getInt("font.regex.style"))));

+		txt_RegExp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

 

-            }

-        });

+		txt_RegExp.setMenu(new Menu(parent.getShell()));

+		setTextMenuItems(txt_RegExp);

+		new MenuItem(txt_RegExp.getMenu(), SWT.BAR);

+		setPatternFlagMenu(txt_RegExp.getMenu());

 

-        // RegEx Menu: Match Mode

-        

-            men_MatchMode = new Menu(txt_RegExp.getMenu());

-            mit_MatchMode = new MenuItem(txt_RegExp.getMenu(),

-                                SWT.CASCADE);

-            mit_MatchMode.setText("Match mode");

-            mit_MatchMode.setMenu(men_MatchMode);

+		txt_RegExp.getMenu().addMenuListener(new MenuListener() {

 

-            mit_mFind = new MenuItem(men_MatchMode, SWT.RADIO);

-            mit_mFind.setText("Find sequence");

-            mit_mFind.setData(new Integer(RegExModel.MODE_FIND));

-            mit_mFind.setSelection(true);

-            mit_mFind.addSelectionListener(this);

+			public void menuHidden(MenuEvent e) {

 

-            mit_mMatch = new MenuItem(men_MatchMode, SWT.RADIO);

-            mit_mMatch.setText("Match complete text");

-            mit_mMatch.setData(new Integer(RegExModel.MODE_MATCH));

-            mit_mMatch.addSelectionListener(this);

+			}

 

-            mit_mSplit = new MenuItem(men_MatchMode, SWT.RADIO);

-            mit_mSplit.setText("Split");

-            mit_mSplit.setData(new Integer(RegExModel.MODE_SPLIT));

-            mit_mSplit.addSelectionListener(this);

-

-            mit_mReplace = new MenuItem(men_MatchMode, SWT.RADIO);

-            mit_mReplace.setText("Replace...");

-            mit_mReplace.setData(new Integer(RegExModel.MODE_REPLACE));

-            mit_mReplace.addSelectionListener(this);

-

-        

-

-        // RegEx Menu Item: Copy As String Literal

-        mit_CopyLiteral = new MenuItem(txt_RegExp.getMenu(), SWT.NONE);

-        mit_CopyLiteral.setText("Copy As String &Literal");

-        mit_CopyLiteral.addSelectionListener(this);

-

-        mit_PasteLiteral = new MenuItem(txt_RegExp.getMenu(), SWT.NONE);

-        mit_PasteLiteral.setText("&Paste String Literal");

-        mit_PasteLiteral.addSelectionListener(this);

-

-        

-        	new MenuItem(txt_RegExp.getMenu(), SWT.BAR);

-            mit_EvalSelection = new MenuItem(txt_RegExp.getMenu(), SWT.NONE);

-	        mit_EvalSelection.setText("Eval Selection Only");

-	        mit_EvalSelection.addSelectionListener(new SelectionListener() {

-	

-				public void widgetSelected(SelectionEvent e) {

-			        regex.setRegExp(txt_RegExp.getSelectionText());

-			        regex.setSearchText(txt_SearchText.getText());

-			        regex.process();

-					

+			public void menuShown(MenuEvent e) {

+				if (txt_RegExp.getSelectionCount() > 0) {

+					mit_EvalSelection.setEnabled(true);

+				} else {

+					mit_EvalSelection.setEnabled(false);

 				}

-	

-				public void widgetDefaultSelected(SelectionEvent e) {

-					// TODO Auto-generated method stub

-					

-				}});

-        

-        

-        

-        SashForm sashForm = new SashForm(parent, SWT.VERTICAL);

-        sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));

 

-        txt_SearchText = new StyledText(sashForm, SWT.LEFT | SWT.MULTI

-                | SWT.V_SCROLL | SWT.BORDER);

-        txt_SearchText.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.searchtext.name"), prefs.getInt("font.searchtext.height"), prefs.getInt("font.searchtext.style"))));

-        txt_SearchText.setWordWrap(true);

-        txt_SearchText.setLayoutData(new GridData(GridData.FILL_BOTH));

-        txt_SearchText.addVerifyKeyListener(new VerifyKeyListener() {

+			}

+		});

 

-            public void verifyKey(VerifyEvent event) {

-                if (event.keyCode == SWT.TAB) {

-                    txt_RegExp.setCaretOffset(currentCarresPos);

-                    currentCarresPos = txt_SearchText.getCaretOffset();

-                    txt_RegExp.setFocus();

-                    event.doit = false;

-                }

-            }

-        });

+		// RegEx Menu: Match Mode

 

-        txt_SearchText.setMenu(new Menu(parent.getShell()));

-        setTextMenuItems(txt_SearchText);

-        

-        

-        // GRO: Store/Restore last input value from PreferenceStore 

-        preferenceKey = "txt_SearchText";

-        txt_SearchText.addFocusListener(new SaveLastValueToPreferenceStoreFocusAdapter(preferenceStore, preferenceKey));

-        txt_SearchText.setText(preferenceStore.getString(preferenceKey));

+		men_MatchMode = new Menu(txt_RegExp.getMenu());

+		mit_MatchMode = new MenuItem(txt_RegExp.getMenu(), SWT.CASCADE);

+		mit_MatchMode.setText("Match mode");

+		mit_MatchMode.setMenu(men_MatchMode);

 

-      

+		mit_mFind = new MenuItem(men_MatchMode, SWT.RADIO);

+		mit_mFind.setText("Find sequence");

+		mit_mFind.setData(new Integer(RegExModel.MODE_FIND));

+		mit_mFind.setSelection(true);

+		mit_mFind.addSelectionListener(this);

 

-        txt_Result = new StyledText(sashForm, SWT.LEFT | SWT.MULTI

-                | SWT.V_SCROLL | SWT.BORDER | SWT.READ_ONLY);

+		mit_mMatch = new MenuItem(men_MatchMode, SWT.RADIO);

+		mit_mMatch.setText("Match complete text");

+		mit_mMatch.setData(new Integer(RegExModel.MODE_MATCH));

+		mit_mMatch.addSelectionListener(this);

 

-        txt_Result.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.result.name"), prefs.getInt("font.result.height"), prefs.getInt("font.result.style"))));

-        txt_Result.setWordWrap(true);

-        txt_Result.setLayoutData(new GridData(GridData.FILL_BOTH));

-        txt_Result.setBackground(Display.getCurrent().getSystemColor(

-                SWT.COLOR_WIDGET_BACKGROUND));

-        txt_Result.setMenu(new Menu(parent.getShell()));

-        setTextMenuItems(txt_Result);

+		mit_mSplit = new MenuItem(men_MatchMode, SWT.RADIO);

+		mit_mSplit.setText("Split");

+		mit_mSplit.setData(new Integer(RegExModel.MODE_SPLIT));

+		mit_mSplit.addSelectionListener(this);

 

-        cmp_ButtonGroup = new Composite(parent, 0);

-        RowLayout buttonRow = new RowLayout();

-        buttonRow.pack = false;

-        buttonRow.marginLeft = 0;

-        buttonRow.spacing = 20;

-        cmp_ButtonGroup.setLayout(buttonRow);

+		mit_mReplace = new MenuItem(men_MatchMode, SWT.RADIO);

+		mit_mReplace.setText("Replace...");

+		mit_mReplace.setData(new Integer(RegExModel.MODE_REPLACE));

+		mit_mReplace.addSelectionListener(this);

 

-        btn_Find = new Button(cmp_ButtonGroup, SWT.CENTER | SWT.FLAT);

-        btn_Find.setText("&Find");

-        btn_Find.addSelectionListener(this);

+		// RegEx Menu Item: Copy As String Literal

+		mit_CopyLiteral = new MenuItem(txt_RegExp.getMenu(), SWT.NONE);

+		mit_CopyLiteral.setText("Copy As String &Literal");

+		mit_CopyLiteral.addSelectionListener(this);

 

-        liveEval = new LiveEval(txt_RegExp, txt_SearchText);

-        liveEval.addLiveEvalListener(this);

+		mit_PasteLiteral = new MenuItem(txt_RegExp.getMenu(), SWT.NONE);

+		mit_PasteLiteral.setText("&Paste String Literal");

+		mit_PasteLiteral.addSelectionListener(this);

 

-        btn_LiveEval = new Button(cmp_ButtonGroup, SWT.CHECK | SWT.FLAT);

-        btn_LiveEval.setText("&Live Evaluation");

-        if (prefs.getBoolean("EvalSwitch")) {

-            btn_LiveEval.setSelection(true);

-            liveEval.start();

-        }

+		new MenuItem(txt_RegExp.getMenu(), SWT.BAR);

+		mit_EvalSelection = new MenuItem(txt_RegExp.getMenu(), SWT.NONE);

+		mit_EvalSelection.setText("Eval Selection Only");

+		mit_EvalSelection.addSelectionListener(new SelectionListener() {

 

-        btn_LiveEval.addSelectionListener(new SelectionAdapter() {

+			public void widgetSelected(SelectionEvent e) {

+				regex.setRegExp(txt_RegExp.getSelectionText());

+				regex.setSearchText(txt_SearchText.getText());

+				regex.process();

 

-            public void widgetSelected(SelectionEvent e) {

-                Button check = (Button) e.widget;

-                if (check.getSelection()) {

-                    liveEval.start();

-                } else {

-                    liveEval.stop();

-                }

-            }

-        });

+			}

 

-        StyledTextActionHandler styledTextActionHandler = new StyledTextActionHandler(

-                this.getViewSite().getActionBars());

-        styledTextActionHandler.addStyledText(txt_RegExp);

-        styledTextActionHandler.addStyledText(txt_SearchText);

-        styledTextActionHandler.addStyledText(txt_Result);

+			public void widgetDefaultSelected(SelectionEvent e) {

+				// TODO Auto-generated method stub

 

-        if (liveEval.isLiveEval()) {

-            processRegEx();

-            updateFoundStatus();

-        }

+			}

+		});

 

-    }

+		SashForm sashForm = new SashForm(parent, SWT.VERTICAL);

+		sashForm.setLayoutData(new GridData(GridData.FILL_BOTH));

 

-    public void updateFoundStatus() {

-        if (regex.foundMatches()) {

-            if (regex.getMatches().getMatchPos() > 0)

-                prevMatchAction.setEnabled(true);

-            else

-                prevMatchAction.setEnabled(false);

+		txt_SearchText = new StyledText(sashForm, SWT.LEFT | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);

+		txt_SearchText.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.searchtext.name"),

+				prefs.getInt("font.searchtext.height"), prefs.getInt("font.searchtext.style"))));

+		txt_SearchText.setWordWrap(true);

+		txt_SearchText.setLayoutData(new GridData(GridData.FILL_BOTH));

+		txt_SearchText.addVerifyKeyListener(new VerifyKeyListener() {

 

-            if (regex.getMatches().getMatchPos() < regex.getMatches()

-                    .getMatchCount() - 1)

-                nextMatchAction.setEnabled(true);

-            else

-                nextMatchAction.setEnabled(false);

-        } else {

-            prevMatchAction.setEnabled(false);

-            nextMatchAction.setEnabled(false);

-        }

-    }

+			public void verifyKey(VerifyEvent event) {

+				if (event.keyCode == SWT.TAB) {

+					txt_RegExp.setCaretOffset(currentCarresPos);

+					currentCarresPos = txt_SearchText.getCaretOffset();

+					txt_RegExp.setFocus();

+					event.doit = false;

+				}

+			}

+		});

 

-    private void makeActions() {

-        nextMatchAction = new NextMatchAction(this);

-        prevMatchAction = new PrevMatchAction(this);

-        clearAction = new ClearAction(this);

-        

-        

-        aboutAction = new AboutAction(this);

-		

-        getViewSite().getActionBars().getToolBarManager().add(clearAction);

-        getViewSite().getActionBars().getToolBarManager().add(new Separator());

-        getViewSite().getActionBars().getToolBarManager().add(prevMatchAction);

-        getViewSite().getActionBars().getToolBarManager().add(nextMatchAction);

-        //getViewSite().getActionBars().getMenuManager().add(registerAction);

-        getViewSite().getActionBars().getMenuManager().add(aboutAction);

-    }

+		txt_SearchText.setMenu(new Menu(parent.getShell()));

+		setTextMenuItems(txt_SearchText);

 

-    public void selectNextMatch() {

-        Match match = regex.getMatches().nextMatch();

-        if (match != null) {

-            StyledText searchText = txt_SearchText;

-            StyledText resultText = txt_Result;

-            searchText.setSelection(match.getStart(), match.getEnd());

+		// GRO: Store/Restore last input value from PreferenceStore

+		preferenceKey = "txt_SearchText";

+		txt_SearchText.addFocusListener(new SaveLastValueToPreferenceStoreFocusAdapter(preferenceStore, preferenceKey));

+		txt_SearchText.setText(preferenceStore.getString(preferenceKey));

 

-            String resultStr = resultText.getText();

-            Pattern patt = Pattern.compile("start=" + match.getStart()

-                    + ", end=" + match.getEnd());

-            Matcher matcher = patt.matcher(resultStr);

-            if (matcher.find()) {

-                resultText.setSelection(matcher.start(), matcher.end());

-            }

-        }

-    }

+		txt_Result = new StyledText(sashForm, SWT.LEFT | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER | SWT.READ_ONLY);

 

-    public void selectPreviousMatch() {

-        Match match = regex.getMatches().prevMatch();

+		txt_Result.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.result.name"),

+				prefs.getInt("font.result.height"), prefs.getInt("font.result.style"))));

+		txt_Result.setWordWrap(true);

+		txt_Result.setLayoutData(new GridData(GridData.FILL_BOTH));

+		txt_Result.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

+		txt_Result.setMenu(new Menu(parent.getShell()));

+		setTextMenuItems(txt_Result);

 

-        if (match != null) {

-            StyledText searchText = txt_SearchText;

-            StyledText resultText = txt_Result;

-            searchText.setSelection(match.getStart(), match.getEnd());

-            String resultStr = resultText.getText();

+		cmp_ButtonGroup = new Composite(parent, 0);

+		RowLayout buttonRow = new RowLayout();

+		buttonRow.pack = false;

+		buttonRow.marginLeft = 0;

+		buttonRow.spacing = 20;

+		cmp_ButtonGroup.setLayout(buttonRow);

 

-            Pattern patt = Pattern.compile("start=" + match.getStart()

-                    + ", end=" + match.getEnd());

-            Matcher matcher = patt.matcher(resultStr);

-            if (matcher.find()) {

-                resultText.setSelection(matcher.start(), matcher.end());

-            }

-        }

+		btn_Find = new Button(cmp_ButtonGroup, SWT.CENTER | SWT.FLAT);

+		btn_Find.setText("&Find");

+		btn_Find.addSelectionListener(this);

 

-    }

+		liveEval = new LiveEval(txt_RegExp, txt_SearchText);

+		liveEval.addLiveEvalListener(this);

 

-    public void clear(int mode) {

+		btn_LiveEval = new Button(cmp_ButtonGroup, SWT.CHECK | SWT.FLAT);

+		btn_LiveEval.setText("&Live Evaluation");

+		if (prefs.getBoolean("EvalSwitch")) {

+			btn_LiveEval.setSelection(true);

+			liveEval.start();

+		}

 

-        if (mode == ClearAction.MODE_REGEX || mode == ClearAction.MODE_ALL) {

-            txt_RegExp.setText("");

-        }

-        if (mode == ClearAction.MODE_SEARCH || mode == ClearAction.MODE_ALL) {

-            txt_SearchText.setText("");

-        }

-        if (mode == ClearAction.MODE_RESULT || mode == ClearAction.MODE_ALL) {

-            txt_Result.setText("");

-        }

+		btn_LiveEval.addSelectionListener(new SelectionAdapter() {

 

-        regex.reset();

+			public void widgetSelected(SelectionEvent e) {

+				Button check = (Button) e.widget;

+				if (check.getSelection()) {

+					liveEval.start();

+				} else {

+					liveEval.stop();

+				}

+			}

+		});

 

-    }

+		StyledTextActionHandler styledTextActionHandler = new StyledTextActionHandler(

+				this.getViewSite().getActionBars());

+		styledTextActionHandler.addStyledText(txt_RegExp);

+		styledTextActionHandler.addStyledText(txt_SearchText);

+		styledTextActionHandler.addStyledText(txt_Result);

 

-    private void setPatternFlagMenu(Menu menu) {

-        class FlagStatusAdapter extends SelectionAdapter {

+		if (liveEval.isLiveEval()) {

+			processRegEx();

+			updateFoundStatus();

+		}

 

-            public void widgetSelected(SelectionEvent e) {

-                MenuItem menItem = (MenuItem) e.widget;

-                Integer flag = (Integer) menItem.getData();

-                if (menItem.getSelection()) {

-                    regex.addPatternFlag(flag.intValue());

-                } else {

-                    regex.removePatternFlag(flag.intValue());

-                }

-                if (liveEval.isLiveEval()) {

-                    processRegEx();

-                    updateFoundStatus();

-                }

-                txt_RegExp.setToolTipText(regex.getPatternFlagsAsString());

-            }

-        }

-        FlagStatusAdapter flagStatusAdapter = new FlagStatusAdapter();

+	}

 

-        men_PatternFlags = new Menu(menu);

-        MenuItem mit_PatternFlags = new MenuItem(menu, SWT.CASCADE);

-        mit_PatternFlags.setText("Pattern &Flags");

-        mit_PatternFlags.setMenu(men_PatternFlags);

+	public void updateFoundStatus() {

+		if (regex.foundMatches()) {

+			if (regex.getMatches().getMatchPos() > 0)

+				prevMatchAction.setEnabled(true);

+			else

+				prevMatchAction.setEnabled(false);

 

-        MenuItem mit_Flags_CanonEq = new MenuItem(men_PatternFlags, SWT.CHECK);

-        mit_Flags_CanonEq.setText("Canonical &Equivalence");

-        mit_Flags_CanonEq.setData(new Integer(Pattern.CANON_EQ));

-        mit_Flags_CanonEq.setSelection(prefs.getBoolean("Pattern.CANON_EQ"));

-        mit_Flags_CanonEq.addSelectionListener(flagStatusAdapter);

+			if (regex.getMatches().getMatchPos() < regex.getMatches().getMatchCount() - 1)

+				nextMatchAction.setEnabled(true);

+			else

+				nextMatchAction.setEnabled(false);

+		} else {

+			prevMatchAction.setEnabled(false);

+			nextMatchAction.setEnabled(false);

+		}

+	}

 

-        MenuItem mit_Flags_CaseIns = new MenuItem(men_PatternFlags, SWT.CHECK);

-        mit_Flags_CaseIns.setText("Case &Insensitive");

-        mit_Flags_CaseIns.setData(new Integer(Pattern.CASE_INSENSITIVE));

-        mit_Flags_CaseIns.setSelection(prefs

-                .getBoolean("Pattern.CASE_INSENSITIVE"));

-        mit_Flags_CaseIns.addSelectionListener(flagStatusAdapter);

+	private void makeActions() {

+		nextMatchAction = new NextMatchAction(this);

+		prevMatchAction = new PrevMatchAction(this);

+		clearAction = new ClearAction(this);

 

-        MenuItem mit_Flags_Comments = new MenuItem(men_PatternFlags, SWT.CHECK);

-        mit_Flags_Comments.setText("&Comments");

-        mit_Flags_Comments.setData(new Integer(Pattern.COMMENTS));

-        mit_Flags_Comments.setSelection(prefs.getBoolean("Pattern.COMMENTS"));

-        mit_Flags_Comments.addSelectionListener(flagStatusAdapter);

+		aboutAction = new AboutAction(this);

 

-        MenuItem mit_Flags_Dotall = new MenuItem(men_PatternFlags, SWT.CHECK);

-        mit_Flags_Dotall.setText("&Dotall Mode");

-        mit_Flags_Dotall.setData(new Integer(Pattern.DOTALL));

-        mit_Flags_Dotall.setSelection(prefs.getBoolean("Pattern.DOTALL"));

-        mit_Flags_Dotall.addSelectionListener(flagStatusAdapter);

+		getViewSite().getActionBars().getToolBarManager().add(clearAction);

+		getViewSite().getActionBars().getToolBarManager().add(new Separator());

+		getViewSite().getActionBars().getToolBarManager().add(prevMatchAction);

+		getViewSite().getActionBars().getToolBarManager().add(nextMatchAction);

+		// getViewSite().getActionBars().getMenuManager().add(registerAction);

+		getViewSite().getActionBars().getMenuManager().add(aboutAction);

+	}

 

-        MenuItem mit_Flags_Multiline = new MenuItem(men_PatternFlags, SWT.CHECK);

-        mit_Flags_Multiline.setText("&Multiline Mode");

-        mit_Flags_Multiline.setData(new Integer(Pattern.MULTILINE));

-        mit_Flags_Multiline.setSelection(prefs.getBoolean("Pattern.MULTILINE"));

-        mit_Flags_Multiline.addSelectionListener(flagStatusAdapter);

+	public void selectNextMatch() {

+		Match match = regex.getMatches().nextMatch();

+		if (match != null) {

+			StyledText searchText = txt_SearchText;

+			StyledText resultText = txt_Result;

+			searchText.setSelection(match.getStart(), match.getEnd());

+

+			String resultStr = resultText.getText();

+			Pattern patt = Pattern.compile("start=" + match.getStart() + ", end=" + match.getEnd());

+			Matcher matcher = patt.matcher(resultStr);

+			if (matcher.find()) {

+				resultText.setSelection(matcher.start(), matcher.end());

+			}

+		}

+	}

+

+	public void selectPreviousMatch() {

+		Match match = regex.getMatches().prevMatch();

+

+		if (match != null) {

+			StyledText searchText = txt_SearchText;

+			StyledText resultText = txt_Result;

+			searchText.setSelection(match.getStart(), match.getEnd());

+			String resultStr = resultText.getText();

+

+			Pattern patt = Pattern.compile("start=" + match.getStart() + ", end=" + match.getEnd());

+			Matcher matcher = patt.matcher(resultStr);

+			if (matcher.find()) {

+				resultText.setSelection(matcher.start(), matcher.end());

+			}

+		}

+

+	}

+

+	public void clear(int mode) {

+

+		if (mode == ClearAction.MODE_REGEX || mode == ClearAction.MODE_ALL) {

+			txt_RegExp.setText("");

+		}

+		if (mode == ClearAction.MODE_SEARCH || mode == ClearAction.MODE_ALL) {

+			txt_SearchText.setText("");

+		}

+		if (mode == ClearAction.MODE_RESULT || mode == ClearAction.MODE_ALL) {

+			txt_Result.setText("");

+		}

+

+		regex.reset();

+

+	}

+

+	private void setPatternFlagMenu(Menu menu) {

+		class FlagStatusAdapter extends SelectionAdapter {

+

+			public void widgetSelected(SelectionEvent e) {

+				MenuItem menItem = (MenuItem) e.widget;

+				Integer flag = (Integer) menItem.getData();

+				if (menItem.getSelection()) {

+					regex.addPatternFlag(flag.intValue());

+				} else {

+					regex.removePatternFlag(flag.intValue());

+				}

+				if (liveEval.isLiveEval()) {

+					processRegEx();

+					updateFoundStatus();

+				}

+				txt_RegExp.setToolTipText(regex.getPatternFlagsAsString());

+			}

+		}

+		FlagStatusAdapter flagStatusAdapter = new FlagStatusAdapter();

+

+		men_PatternFlags = new Menu(menu);

+		MenuItem mit_PatternFlags = new MenuItem(menu, SWT.CASCADE);

+		mit_PatternFlags.setText("Pattern &Flags");

+		mit_PatternFlags.setMenu(men_PatternFlags);

+

+		MenuItem mit_Flags_CanonEq = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_CanonEq.setText("Canonical &Equivalence");

+		mit_Flags_CanonEq.setData(new Integer(Pattern.CANON_EQ));

+		mit_Flags_CanonEq.setSelection(prefs.getBoolean("Pattern.CANON_EQ"));

+		mit_Flags_CanonEq.addSelectionListener(flagStatusAdapter);

+

+		MenuItem mit_Flags_CaseIns = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_CaseIns.setText("Case &Insensitive");

+		mit_Flags_CaseIns.setData(new Integer(Pattern.CASE_INSENSITIVE));

+		mit_Flags_CaseIns.setSelection(prefs.getBoolean("Pattern.CASE_INSENSITIVE"));

+		mit_Flags_CaseIns.addSelectionListener(flagStatusAdapter);

+

+		MenuItem mit_Flags_Comments = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_Comments.setText("&Comments");

+		mit_Flags_Comments.setData(new Integer(Pattern.COMMENTS));

+		mit_Flags_Comments.setSelection(prefs.getBoolean("Pattern.COMMENTS"));

+		mit_Flags_Comments.addSelectionListener(flagStatusAdapter);

+

+		MenuItem mit_Flags_Dotall = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_Dotall.setText("&Dotall Mode");

+		mit_Flags_Dotall.setData(new Integer(Pattern.DOTALL));

+		mit_Flags_Dotall.setSelection(prefs.getBoolean("Pattern.DOTALL"));

+		mit_Flags_Dotall.addSelectionListener(flagStatusAdapter);

+

+		MenuItem mit_Flags_Multiline = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_Multiline.setText("&Multiline Mode");

+		mit_Flags_Multiline.setData(new Integer(Pattern.MULTILINE));

+		mit_Flags_Multiline.setSelection(prefs.getBoolean("Pattern.MULTILINE"));

+		mit_Flags_Multiline.addSelectionListener(flagStatusAdapter);

+

+		MenuItem mit_Flags_unicodeCase = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_unicodeCase.setText("&Unicode Case");

+		mit_Flags_unicodeCase.setData(new Integer(Pattern.UNICODE_CASE));

+		mit_Flags_unicodeCase.setSelection(prefs.getBoolean("Pattern.UNICODE_CASE"));

+		mit_Flags_unicodeCase.addSelectionListener(flagStatusAdapter);

+

+		MenuItem mit_Flags_unixLines = new MenuItem(men_PatternFlags, SWT.CHECK);

+		mit_Flags_unixLines.setText("Unix &Lines");

+		mit_Flags_unixLines.setData(new Integer(Pattern.UNIX_LINES));

+		mit_Flags_unixLines.setSelection(prefs.getBoolean("Pattern.UNIX_LINES"));

+		mit_Flags_unixLines.addSelectionListener(flagStatusAdapter);

+

+		new MenuItem(men_PatternFlags, SWT.BAR);

+		MenuItem mit_Flags_deactivateAll = new MenuItem(men_PatternFlags, SWT.NONE);

+		mit_Flags_deactivateAll.setText("Deactivate &All");

+		mit_Flags_deactivateAll.addSelectionListener(new SelectionAdapter() {

 

-        MenuItem mit_Flags_unicodeCase = new MenuItem(men_PatternFlags,

-                SWT.CHECK);

-        mit_Flags_unicodeCase.setText("&Unicode Case");

-        mit_Flags_unicodeCase.setData(new Integer(Pattern.UNICODE_CASE));

-        mit_Flags_unicodeCase.setSelection(prefs

-                .getBoolean("Pattern.UNICODE_CASE"));

-        mit_Flags_unicodeCase.addSelectionListener(flagStatusAdapter);

+			public void widgetSelected(SelectionEvent e) {

+				MenuItem menItem = (MenuItem) e.widget;

+				Menu menu = menItem.getParent();

+				MenuItem[] menItems = menu.getItems();

+				for (int i = 0; i < menItems.length; i++) {

+					menItems[i].setSelection(false);

+				}

+				regex.resetPatternFlag();

+			}

+		});

 

-        MenuItem mit_Flags_unixLines = new MenuItem(men_PatternFlags, SWT.CHECK);

-        mit_Flags_unixLines.setText("Unix &Lines");

-        mit_Flags_unixLines.setData(new Integer(Pattern.UNIX_LINES));

-        mit_Flags_unixLines

-                .setSelection(prefs.getBoolean("Pattern.UNIX_LINES"));

-        mit_Flags_unixLines.addSelectionListener(flagStatusAdapter);

+	}

 

-        new MenuItem(men_PatternFlags, SWT.BAR);

-        MenuItem mit_Flags_deactivateAll = new MenuItem(men_PatternFlags,

-                SWT.NONE);

-        mit_Flags_deactivateAll.setText("Deactivate &All");

-        mit_Flags_deactivateAll.addSelectionListener(new SelectionAdapter() {

+	public void setFocus() {

+		txt_RegExp.setFocus();

+	}

 

-            public void widgetSelected(SelectionEvent e) {

-                MenuItem menItem = (MenuItem) e.widget;

-                Menu menu = menItem.getParent();

-                MenuItem[] menItems = menu.getItems();

-                for (int i = 0; i < menItems.length; i++) {

-                    menItems[i].setSelection(false);

-                }

-                regex.resetPatternFlag();

-            }

-        });

+	private void setTextMenuItems(StyledText text) {

+		MenuItem mitCut = new MenuItem(text.getMenu(), SWT.NONE);

+		mitCut.setText("Cu&t");

+		mitCut.setData(new StandardTextFieldAction(text, StandardTextFieldAction.CUT));

+		mitCut.addSelectionListener(this);

 

-    }

+		MenuItem mitCopy = new MenuItem(text.getMenu(), SWT.NONE);

+		mitCopy.setText("&Copy");

+		mitCopy.setData(new StandardTextFieldAction(text, StandardTextFieldAction.COPY));

+		mitCopy.addSelectionListener(this);

 

-    public void setFocus() {

-        txt_RegExp.setFocus();

-    }

+		MenuItem mitPaste = new MenuItem(text.getMenu(), SWT.NONE);

+		mitPaste.setText("&Paste");

+		mitPaste.setData(new StandardTextFieldAction(text, StandardTextFieldAction.PASTE));

+		mitPaste.addSelectionListener(this);

 

-    private void setTextMenuItems(StyledText text) {

-        MenuItem mitCut = new MenuItem(text.getMenu(), SWT.NONE);

-        mitCut.setText("Cu&t");

-        mitCut.setData(new StandardTextFieldAction(text,

-                StandardTextFieldAction.CUT));

-        mitCut.addSelectionListener(this);

+		MenuItem mitSelectAll = new MenuItem(text.getMenu(), SWT.NONE);

+		mitSelectAll.setText("Select &All");

+		mitSelectAll.setData(new StandardTextFieldAction(text, StandardTextFieldAction.SELECT_ALL));

+		mitSelectAll.addSelectionListener(this);

+	}

 

-        MenuItem mitCopy = new MenuItem(text.getMenu(), SWT.NONE);

-        mitCopy.setText("&Copy");

-        mitCopy.setData(new StandardTextFieldAction(text,

-                StandardTextFieldAction.COPY));

-        mitCopy.addSelectionListener(this);

+	public void widgetSelected(SelectionEvent e) {

+		Widget widget = e.widget;

+		Object data = widget.getData();

 

-        MenuItem mitPaste = new MenuItem(text.getMenu(), SWT.NONE);

-        mitPaste.setText("&Paste");

-        mitPaste.setData(new StandardTextFieldAction(text,

-                StandardTextFieldAction.PASTE));

-        mitPaste.addSelectionListener(this);

+		// selected one of the standard text field menu commands

+		// Cut, Copy, Paste, Select All

+		if (data instanceof StandardTextFieldAction) {

+			((StandardTextFieldAction) data).perform();

+		}

 

-        MenuItem mitSelectAll = new MenuItem(text.getMenu(), SWT.NONE);

-        mitSelectAll.setText("Select &All");

-        mitSelectAll.setData(new StandardTextFieldAction(text,

-                StandardTextFieldAction.SELECT_ALL));

-        mitSelectAll.addSelectionListener(this);

-    }

+		// Selected MenuItem "Copy As String Literal"

+		if (widget == mit_CopyLiteral) {

+			Clipboard clipboard = new Clipboard(e.display);

+			TextTransfer textTransfer = TextTransfer.getInstance();

+			clipboard.setContents(new Object[] { regex.getRegExAsLiteral() }, new Transfer[] { textTransfer });

+			clipboard.dispose();

+		}

 

-    public void widgetSelected(SelectionEvent e) {

-        Widget widget = e.widget;

-        Object data = widget.getData();

+		if (widget == mit_mFind || widget == mit_mMatch || widget == mit_mReplace || widget == mit_mSplit) {

+			MenuItem menuItem = (MenuItem) widget;

+			if (menuItem.getSelection()) {

+				int mode = ((Integer) data).intValue();

+				setMatchMode(mode);

+				if (liveEval.isLiveEval()) {

+					processRegEx();

+					updateFoundStatus();

+				}

+			}

+		}

 

-        // selected one of the standard text field menu commands

-        // Cut, Copy, Paste, Select All

-        if (data instanceof StandardTextFieldAction) {

-            ((StandardTextFieldAction) data).perform();

-        }

+		if (widget == mit_PasteLiteral) {

+			pasteLiteral(e.display);

+		}

 

-        // Selected MenuItem "Copy As String Literal"

-        if (widget == mit_CopyLiteral) {

-            Clipboard clipboard = new Clipboard(e.display);

-            TextTransfer textTransfer = TextTransfer.getInstance();

-            clipboard.setContents(new Object[] { regex.getRegExAsLiteral() },

-                    new Transfer[] { textTransfer });

-            clipboard.dispose();

-        }

+		// Selected MenuItem "Replace ..."

+		if (widget == mit_mReplace) {

+			MenuItem menuItem = (MenuItem) widget;

+			if (menuItem.getSelection())

+				activateReplaceMode();

+		}

 

-        if (widget == mit_mFind || widget == mit_mMatch

-                || widget == mit_mReplace || widget == mit_mSplit) {

-            MenuItem menuItem = (MenuItem) widget;

-            if (menuItem.getSelection()) {

-                int mode = ((Integer) data).intValue();

-                setMatchMode(mode);

-                if (liveEval.isLiveEval()) {

-                    processRegEx();

-                    updateFoundStatus();

-                }

-            }

-        }

+		if (widget == btn_Find) {

+			processRegEx();

+			updateFoundStatus();

+		}

 

-        if (widget == mit_PasteLiteral) {

-            pasteLiteral(e.display);

-        }

+	}

 

-        // Selected MenuItem "Replace ..."

-        if (widget == mit_mReplace) {

-            MenuItem menuItem = (MenuItem) widget;

-            if (menuItem.getSelection())

-                activateReplaceMode();

-        }

-        

-        if (widget == btn_Find) {

-        	processRegEx();

-        	updateFoundStatus();

-        }

+	private void setMatchMode(int mode) {

+		regex.setMatchMode(mode);

+		btn_Find.setText(modeLabels[mode]);

+		MenuItem[] modeItems = men_MatchMode.getItems();

+		if (!modeItems[mode].getSelection()) {

+			for (int i = 0; i < modeItems.length; i++) {

+				modeItems[i].setSelection(false);

+			}

+			modeItems[mode].setSelection(true);

+		}

+	}

 

-    }

+	private void pasteLiteral(Display display) {

+		Clipboard clipboard = new Clipboard(display);

+		TextTransfer textTransfer = TextTransfer.getInstance();

+		String clipboardText = (String) clipboard.getContents(textTransfer);

+		clipboard.dispose();

 

-    private void setMatchMode(int mode) {

-        regex.setMatchMode(mode);

-        btn_Find.setText(modeLabels[mode]);

-        MenuItem[] modeItems = men_MatchMode.getItems();

-        if (!modeItems[mode].getSelection()) {

-            for (int i = 0; i < modeItems.length; i++) {

-                modeItems[i].setSelection(false);

-            }

-            modeItems[mode].setSelection(true);

-        }

-     }

+		if (clipboardText != null) {

+			StringBuffer out = new StringBuffer();

+			char[] chars = clipboardText.toCharArray();

+			boolean lastWasBackslash = false;

+			for (int i = 0; i < chars.length; i++) {

+				if (chars[i] == '\\') {

+					if (lastWasBackslash) {

+						out.append(chars[i]);

+						lastWasBackslash = false;

+					} else {

+						lastWasBackslash = true;

+					}

+				} else {

+					out.append(chars[i]);

+				}

 

-    private void pasteLiteral(Display display) {

-        Clipboard clipboard = new Clipboard(display);

-        TextTransfer textTransfer = TextTransfer.getInstance();

-        String clipboardText = (String) clipboard.getContents(textTransfer);

-        clipboard.dispose();

+			}

 

-        if (clipboardText != null) {

-            StringBuffer out = new StringBuffer();

-            char[] chars = clipboardText.toCharArray();

-            boolean lastWasBackslash = false;

-            for (int i = 0; i < chars.length; i++) {

-                if (chars[i] == '\\') {

-                    if (lastWasBackslash) {

-                        out.append(chars[i]);

-                        lastWasBackslash = false;

-                    } else {

-                        lastWasBackslash = true;

-                    }

-                } else {

-                    out.append(chars[i]);

-                }

+			txt_RegExp.insert(out.toString());

+		}

+	}

 

-            }

+	private void activateReplaceMode() {

+		InputDialog inputDialog = new InputDialog(getViewSite().getShell(), "Replace Match by ...",

+				"Enter a value which should be used to replace every instance of a found match:", regex.getReplace(),

+				new IInputValidator() {

 

-            txt_RegExp.insert(out.toString());

-        }

-    }

+					public String isValid(String newText) {

+						// TODO Auto-generated method stub

+						return null;

+					}

+				});

+		int retCode = inputDialog.open();

 

-    private void activateReplaceMode() {

-        InputDialog inputDialog = new InputDialog(

-                getViewSite().getShell(),

-                "Replace Match by ...",

-                "Enter a value which should be used to replace every instance of a found match:",

-                regex.getReplace(), new IInputValidator() {

+		if (retCode == Window.OK) {

+			String replace = inputDialog.getValue();

 

-                    public String isValid(String newText) {

-                        // TODO Auto-generated method stub

-                        return null;

-                    }

-                });

-        int retCode = inputDialog.open();

+			regex.setMatchMode(RegExModel.MODE_REPLACE);

+			regex.setReplace(replace);

 

-        if (retCode == Window.OK) {

-            String replace = inputDialog.getValue();

+			btn_Find.setText(modeLabels[RegExModel.MODE_REPLACE]);

 

-            regex.setMatchMode(RegExModel.MODE_REPLACE);

-            regex.setReplace(replace);

+			if (liveEval.isLiveEval()) {

+				processRegEx();

+				updateFoundStatus();

+			}

+		}

+	}

 

-            btn_Find.setText(modeLabels[RegExModel.MODE_REPLACE]);

+	public void widgetDefaultSelected(SelectionEvent e) {

+		// do nothing

+	}

 

-            if (liveEval.isLiveEval()) {

-                processRegEx();

-                updateFoundStatus();

-            }

-        }

-    }

+	private void processRegEx() {

+		updateModel();

+		regex.process();

+	}

 

-    public void widgetDefaultSelected(SelectionEvent e) {

-        // do nothing

-    }

+	public void updateModel() {

+		regex.setRegExp(txt_RegExp.getText());

+		regex.setSearchText(txt_SearchText.getText());

+	}

 

-    private void processRegEx() {

-        updateModel();

-        regex.process();

-    }

-    

-    public void updateModel() {

-        regex.setRegExp(txt_RegExp.getText());

-        regex.setSearchText(txt_SearchText.getText());       

-    }

-    

-    public void updateView(Expression state) {

-        updateView(state.getName(), state.getRegex(), state.getSearchText(), state.getMatchMode(), state.getPatternFlag());

-        updateModel();

-    }

-    

-    public void updateView(String descr, String regEx, String search, int matchMode, int patternFlags) {

-        txt_RegExp.setText(regEx);

-        txt_SearchText.setText(search);

-        setMatchMode(matchMode);

-        setPatternFlags(patternFlags);

-        setRegExDecription(descr);

-    }

+	public void updateView(Expression state) {

+		updateView(state.getName(), state.getRegex(), state.getSearchText(), state.getMatchMode(),

+				state.getPatternFlag());

+		updateModel();

+	}

 

+	public void updateView(String descr, String regEx, String search, int matchMode, int patternFlags) {

+		txt_RegExp.setText(regEx);

+		txt_SearchText.setText(search);

+		setMatchMode(matchMode);

+		setPatternFlags(patternFlags);

+		setRegExDecription(descr);

+	}

 

+	private void setRegExDecription(String descr) {

 

-    private void setRegExDecription(String descr) {

-        

-        regex.setDescription(descr);

-    }

+		regex.setDescription(descr);

+	}

 

-    private void setPatternFlags(int patternFlags) {

-        MenuItem[] flagItems = men_PatternFlags.getItems();

-        for (int i = 0; i < flagItems.length; i++) {

-            if (flagItems[i].getData() == null)

-                continue;

-            if ((patternFlags & ((Integer) flagItems[i].getData()).intValue()) != 0) {

-                flagItems[i].setSelection(true);

-            } else {

-                flagItems[i].setSelection(false);

-            }

-        }

-        

-    }

+	private void setPatternFlags(int patternFlags) {

+		MenuItem[] flagItems = men_PatternFlags.getItems();

+		for (int i = 0; i < flagItems.length; i++) {

+			if (flagItems[i].getData() == null)

+				continue;

+			if ((patternFlags & ((Integer) flagItems[i].getData()).intValue()) != 0) {

+				flagItems[i].setSelection(true);

+			} else {

+				flagItems[i].setSelection(false);

+			}

+		}

 

-    private void displayReplace(ReplaceResult replaceResult) {

-        StringBuffer out = new StringBuffer("Replaced "

-                + replaceResult.getMatches().getMatchCount()

-                + " match(es):\n\n");

-        out.append(replaceResult.getResultText());

-        txt_Result.setText(out.toString());

-    }

+	}

 

-    private void displaySplit(String[] splitResult) {

-        StringBuffer out = new StringBuffer("Split text into "

-                + splitResult.length + " parts:\n\n");

-        for (int i = 0; i < splitResult.length; i++) {

-            out.append("part ");

-            out.append(i);

-            out.append(" = ");

-            out.append(splitResult[i]);

-            out.append("\n\n");

-        }

-        out.append(txt_Result.getText());

-        txt_Result.setText(out.toString());

-    }

+	private void displayReplace(ReplaceResult replaceResult) {

+		StringBuffer out = new StringBuffer(

+				"Replaced " + replaceResult.getMatches().getMatchCount() + " match(es):\n\n");

+		out.append(replaceResult.getResultText());

+		txt_Result.setText(out.toString());

+	}

 

-    private void displayMatches(Matches matches) {

-        StringBuffer out = new StringBuffer("Found " + matches.getMatchCount()

-                + " match(es):\n\n");

-        txt_SearchText.setStyleRange(null);

+	private void displaySplit(String[] splitResult) {

+		StringBuffer out = new StringBuffer("Split text into " + splitResult.length + " parts:\n\n");

+		for (int i = 0; i < splitResult.length; i++) {

+			out.append("part ");

+			out.append(i);

+			out.append(" = ");

+			out.append(splitResult[i]);

+			out.append("\n\n");

+		}

+		out.append(txt_Result.getText());

+		txt_Result.setText(out.toString());

+	}

 

-        StyleRange[] styleRanges = new StyleRange[matches.getMatchCount()];

-        int c = 0;

+	private void displayMatches(Matches matches) {

+		StringBuffer out = new StringBuffer("Found " + matches.getMatchCount() + " match(es):\n\n");

+		txt_SearchText.setStyleRange(null);

 

-        for (Iterator i = matches.iterator(); i.hasNext();) {

-            Match match = (Match) i.next();

+		StyleRange[] styleRanges = new StyleRange[matches.getMatchCount()];

+		int c = 0;

 

-            styleRanges[c++] = new StyleRange(match.getStart(), match.getEnd()

-                    - match.getStart(), COLOR_RED, COLOR_WHITE);

+		for (Iterator i = matches.iterator(); i.hasNext();) {

+			Match match = (Match) i.next();

 

-            out.append("start=");

-            out.append(match.getStart());

-            out.append(", end=");

-            out.append(match.getEnd());

-            out.append("\n");

-            for (Iterator groups = match.getGroups().iterator(); groups

-                    .hasNext();) {

-                Group group = (Group) groups.next();

-                out.append("Group(");

-                out.append(group.getIndex());

-                out.append(") = ");

-                out.append(group.getText());

-                out.append("\n");

-            }

+			styleRanges[c++] = new StyleRange(match.getStart(), match.getEnd() - match.getStart(), COLOR_RED,

+					COLOR_WHITE);

 

-            out.append("\n");

+			out.append("start=");

+			out.append(match.getStart());

+			out.append(", end=");

+			out.append(match.getEnd());

+			out.append("\n");

+			for (Iterator groups = match.getGroups().iterator(); groups.hasNext();) {

+				Group group = (Group) groups.next();

+				out.append("Group(");

+				out.append(group.getIndex());

+				out.append(") = ");

+				out.append(group.getText());

+				out.append("\n");

+			}

 

-        }

-        txt_SearchText.setStyleRanges(styleRanges);

-        txt_Result.setText(out.toString());

-    }

+			out.append("\n");

 

+		}

+		txt_SearchText.setStyleRanges(styleRanges);

+		txt_Result.setText(out.toString());

+	}

 

 	public void foundMatches(Matches matches) {

-        displayMatches(matches);		

+		displayMatches(matches);

 	}

 

-

 	public void foundNoMatches() {

-        txt_SearchText.setStyleRange(null);

-        txt_Result.setText("No matches found!");

+		txt_SearchText.setStyleRange(null);

+		txt_Result.setText("No matches found!");

 	}

 

-

 	public void expressionError(String errMsg) {

-        txt_Result.setText("A Syntax Error occured: \\n" + errMsg);		

+		txt_Result.setText("A Syntax Error occured: \\n" + errMsg);

 	}

 

 	public void doneWithReplace(ReplaceResult result) {

-        displayReplace(result);

+		displayReplace(result);

 	}

 

 	public void doneWithSplit(String[] result) {

-        displaySplit(result);		

+		displaySplit(result);

 	}

 

-

 	public void evalActivated() {

-        btn_LiveEval.setSelection(true);

-        processRegEx();

-        updateFoundStatus();

+		btn_LiveEval.setSelection(true);

+		processRegEx();

+		updateFoundStatus();

 	}

 

-

 	public void evalDeactivated() {

-		 btn_LiveEval.setSelection(false);	

+		btn_LiveEval.setSelection(false);

 	}

 

-

 	public void evalDone() {

 		updateFoundStatus();

 	}

 

-

 	public void doEval() {

-		processRegEx();	

+		processRegEx();

 	}

 

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.ui.regex.IRegExListener#updateRequested()

+	 */

+	public void updateRequested() {

+		updateModel();

+	}

 

-    /* (non-Javadoc)

-     * @see org.eclipse.ui.regex.IRegExListener#updateRequested()

-     */

-    public void updateRequested() {

-        updateModel();

-    }

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.ui.regex.view.IExpressionLoaderListener#loadExpression(org.

+	 * eclipse.ui.regex.view.Expression)

+	 */

+	public void loadExpression(Expression expression) {

+		updateView(expression);

+	}

 

-    /* (non-Javadoc)

-     * @see org.eclipse.ui.regex.view.IExpressionLoaderListener#loadExpression(org.eclipse.ui.regex.view.Expression)

-     */

-    public void loadExpression(Expression expression) {

-        updateView(expression);

-    }

+	protected void setRegExFont(FontData fontData) {

+		txt_RegExp.setFont(new Font(Display.getCurrent(), fontData));

+	}

 

-    protected void setRegExFont(FontData fontData) {

-        txt_RegExp.setFont(new Font(Display.getCurrent(), fontData));

-    }

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see

+	 * org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.

+	 * jface.util.PropertyChangeEvent)

+	 */

+	public void propertyChange(PropertyChangeEvent event) {

+		if (event.getProperty().startsWith("font.")) {

+			txt_RegExp.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.regex.name"),

+					prefs.getInt("font.regex.height"), prefs.getInt("font.regex.style"))));

+			txt_SearchText.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.searchtext.name"),

+					prefs.getInt("font.searchtext.height"), prefs.getInt("font.searchtext.style"))));

+			txt_Result.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.result.name"),

+					prefs.getInt("font.result.height"), prefs.getInt("font.result.style"))));

+		}

 

-    /* (non-Javadoc)

-     * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)

-     */

-    public void propertyChange(PropertyChangeEvent event) {

-       if (event.getProperty().startsWith("font.")) {

-           txt_RegExp.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.regex.name"), prefs.getInt("font.regex.height"), prefs.getInt("font.regex.style")))); 

-           txt_SearchText.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.searchtext.name"), prefs.getInt("font.searchtext.height"), prefs.getInt("font.searchtext.style")))); 

-           txt_Result.setFont(new Font(Display.getCurrent(), new FontData(prefs.getString("font.result.name"), prefs.getInt("font.result.height"), prefs.getInt("font.result.style")))); 

-       }

-        

-    }

- 

-    

+	}

+

 }
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/SaveLastValueToPreferenceStoreFocusAdapter.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/SaveLastValueToPreferenceStoreFocusAdapter.java
index ca0860c..fe1e674 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/SaveLastValueToPreferenceStoreFocusAdapter.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/SaveLastValueToPreferenceStoreFocusAdapter.java
@@ -18,12 +18,13 @@
 import org.eclipse.swt.widgets.Text;
 
 /**
- * Saves the last text value from a widget when focus is lost to {@link IPreferenceStore}.
- * PreferenceStore will be automatically saved by
+ * Saves the last text value from a widget when focus is lost to
+ * {@link IPreferenceStore}. PreferenceStore will be automatically saved by
  * {@link org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)}.
  * <p>
- * The current version support only {@link StyledText}, but it can be easily extended, if
- * needed.
+ * The current version support only {@link StyledText}, but it can be easily
+ * extended, if needed.
+ * 
  * @author Andreas Groll
  */
 public class SaveLastValueToPreferenceStoreFocusAdapter extends FocusAdapter {
@@ -33,11 +34,14 @@
 
 	/**
 	 * Constructor.
-	 * @param preferenceStore PreferenceStore to store value.
-	 * @param preferenceKey Name of the key to store value.
+	 * 
+	 * @param preferenceStore
+	 *            PreferenceStore to store value.
+	 * @param preferenceKey
+	 *            Name of the key to store value.
 	 */
 	public SaveLastValueToPreferenceStoreFocusAdapter(final IPreferenceStore preferenceStore,
-		final String preferenceKey) {
+			final String preferenceKey) {
 
 		this.preferenceStore = preferenceStore;
 		this.preferenceKey = preferenceKey;
@@ -52,12 +56,13 @@
 		// Init
 		String value = null;
 
-		// Current version supports only StyledText and Text, but can be extended, if needed
+		// Current version supports only StyledText and Text, but can be extended, if
+		// needed
 		if (e.widget instanceof StyledText) {
-			StyledText styledText = (StyledText)e.widget;
+			StyledText styledText = (StyledText) e.widget;
 			value = styledText.getText();
 		} else if (e.widget instanceof Text) {
-			Text text = (Text)e.widget;
+			Text text = (Text) e.widget;
 			value = text.getText();
 		} else {
 			// Unusupported widget type
diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/AboutAction.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/AboutAction.java
index 59e96fb..1c9c36f 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/AboutAction.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/AboutAction.java
@@ -18,32 +18,30 @@
 import org.eclipse.ui.regex.RegExPlugin;

 import org.eclipse.ui.regex.view.RegExView;

 

-

 public class AboutAction extends Action {

 

 	private RegExView view;

-	

-    public AboutAction(RegExView view) {

+

+	public AboutAction(RegExView view) {

 		setText("About");

 		this.view = view;

-    }

-    

-    /* (non-Javadoc)

-     * @see org.eclipse.jface.action.Action#run()

-     */

-    public void run() {

-    	Dictionary d = RegExPlugin.getDefault().getBundle().getHeaders();

-    	String version = (String) d.get(org.osgi.framework.Constants.BUNDLE_VERSION);

-    	

+	}

+

+	/*

+	 * (non-Javadoc)

+	 * 

+	 * @see org.eclipse.jface.action.Action#run()

+	 */

+	public void run() {

+		Dictionary d = RegExPlugin.getDefault().getBundle().getHeaders();

+		String version = (String) d.get(org.osgi.framework.Constants.BUNDLE_VERSION);

+

 		String msg = "Regular Expression Tester " + version + "\n";

 		msg += "(C) 2006-2012 by Stephan Brosinski <sbrosinski@gmail.com>\n\n";

 		msg += "https://github.com/sbrosinski/RegexTester \n";

-		

 

-		MessageDialog.openInformation(view.getSite().getShell(), "About RegexTester", msg);     

-        

-        

-    }

-    

+		MessageDialog.openInformation(view.getSite().getShell(), "About RegexTester", msg);

+

+	}

 

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearAction.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearAction.java
index 2254ebd..da00412 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearAction.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearAction.java
@@ -17,15 +17,14 @@
 import org.eclipse.ui.regex.view.RegExView;

 

 public class ClearAction extends Action {

-	public static final int	MODE_REGEX	= 0;

-	public static final int	MODE_SEARCH	= 1;

-	public static final int	MODE_RESULT	= 2;

-	public static final int	MODE_ALL	= 3;

+	public static final int MODE_REGEX = 0;

+	public static final int MODE_SEARCH = 1;

+	public static final int MODE_RESULT = 2;

+	public static final int MODE_ALL = 3;

 

 	private static ImageDescriptor image = RegExPlugin.getDefault().getImageDescriptor("clear_co.gif");

 	private int mode = MODE_ALL;

 	private RegExView view;

-	

 

 	public ClearAction(RegExView regExView) {

 		super("ClearAction", image);

@@ -35,12 +34,12 @@
 	}

 

 	public void setMode(int aMode) {

-		mode =aMode;

+		mode = aMode;

 	}

-	

+

 	public void run() {

-	    view.clear(mode);

-	    view.updateFoundStatus();

+		view.clear(mode);

+		view.updateFoundStatus();

 	}

 

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearActionMenuCreator.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearActionMenuCreator.java
index 68d1fea..bed0f7b 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearActionMenuCreator.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/ClearActionMenuCreator.java
@@ -19,69 +19,65 @@
 import org.eclipse.swt.widgets.Menu;

 import org.eclipse.swt.widgets.MenuItem;

 

-

 public class ClearActionMenuCreator implements IMenuCreator {

 

 	Menu menu;

 	ClearAction clearAction;

 	ClearSelection clearSelection = new ClearSelection();

-	

+

 	class ClearSelection extends SelectionAdapter {

 		public void widgetSelected(SelectionEvent e) {

 			MenuItem menuItem = (MenuItem) e.widget;

 			boolean selected = menuItem.getSelection();

-			int mode=((Integer)menuItem.getData()).intValue();

-			

+			int mode = ((Integer) menuItem.getData()).intValue();

+

 			if (selected) {

 				clearAction.setMode(mode);

 			}

-		}			

-	}	

-	

+		}

+	}

+

 	public ClearActionMenuCreator(ClearAction action) {

 		clearAction = action;

 	}

 

 	public void dispose() {

 		if (menu != null) {

-			menu.dispose();		

+			menu.dispose();

 		}

 	}

 

-

 	public Menu getMenu(Control parent) {

 		if (menu != null) {

 			return menu;

 		}

-		

+

 		menu = new Menu(parent);

 

-		MenuItem mitClearBoth= new MenuItem(menu,SWT.RADIO);

+		MenuItem mitClearBoth = new MenuItem(menu, SWT.RADIO);

 		mitClearBoth.setData(new Integer(ClearAction.MODE_ALL));

 		mitClearBoth.setText("Everything");

 		mitClearBoth.addSelectionListener(clearSelection);

 		mitClearBoth.setSelection(true);

-		

+

 		MenuItem mitClearRegEx = new MenuItem(menu, SWT.RADIO);

 		mitClearRegEx.setText("Regular Expression");

 		mitClearRegEx.setData(new Integer(ClearAction.MODE_REGEX));

 		mitClearRegEx.addSelectionListener(clearSelection);

-	

-		MenuItem mitClearSearch= new MenuItem(menu,SWT.RADIO);

+

+		MenuItem mitClearSearch = new MenuItem(menu, SWT.RADIO);

 		mitClearSearch.setData(new Integer(ClearAction.MODE_SEARCH));

 		mitClearSearch.setText("Search Text");

 		mitClearSearch.addSelectionListener(clearSelection);

-		

-		MenuItem mitClearResult= new MenuItem(menu,SWT.RADIO);

+

+		MenuItem mitClearResult = new MenuItem(menu, SWT.RADIO);

 		mitClearResult.setData(new Integer(ClearAction.MODE_RESULT));

 		mitClearResult.setText("Result");

 		mitClearResult.addSelectionListener(clearSelection);

-		

-		

+

 		return menu;

 	}

 

-

 	public Menu getMenu(Menu parent) {

 		return null;

 	}

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/NextMatchAction.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/NextMatchAction.java
index 878cc62..e9d15be 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/NextMatchAction.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/NextMatchAction.java
@@ -18,19 +18,19 @@
 import org.eclipse.ui.regex.view.RegExView;

 

 public class NextMatchAction extends Action {

-	private static ImageDescriptor image  = RegExPlugin.getDefault().getImageDescriptor("forward_nav.gif");

+	private static ImageDescriptor image = RegExPlugin.getDefault().getImageDescriptor("forward_nav.gif");

 	private RegExView view;

-	

-	public NextMatchAction(RegExView regExView) { 

+

+	public NextMatchAction(RegExView regExView) {

 		super("NextMatchAction", image);

 		view = regExView;

 		setEnabled(false);

 		setToolTipText("Show Next Match");

 	}

-	

+

 	public void run() {

-	    view.selectNextMatch();

-	    view.updateFoundStatus();

+		view.selectNextMatch();

+		view.updateFoundStatus();

 	}

-	

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/PrevMatchAction.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/PrevMatchAction.java
index ff49112..1c0a7d1 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/PrevMatchAction.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/PrevMatchAction.java
@@ -18,19 +18,19 @@
 import org.eclipse.ui.regex.view.RegExView;

 

 public class PrevMatchAction extends Action {

-	private static ImageDescriptor image  = RegExPlugin.getDefault().getImageDescriptor("backward_nav.gif");

+	private static ImageDescriptor image = RegExPlugin.getDefault().getImageDescriptor("backward_nav.gif");

 	private RegExView view;

-	

-	public PrevMatchAction(RegExView regExView) { 

+

+	public PrevMatchAction(RegExView regExView) {

 		super("PrevMatchAction", image);

 		view = regExView;

 		setEnabled(false);

 		setToolTipText("Show Previous Match");

 	}

-	

+

 	public void run() {

-	    view.selectPreviousMatch();

-	    view.updateFoundStatus();

+		view.selectPreviousMatch();

+		view.updateFoundStatus();

 	}

-	

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StandardTextFieldAction.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StandardTextFieldAction.java
index 3173827..0607eef 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StandardTextFieldAction.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StandardTextFieldAction.java
@@ -13,27 +13,30 @@
 

 import org.eclipse.swt.custom.StyledText;

 

-

 public class StandardTextFieldAction {

-	

+

 	private StyledText styledText;

 	private int type;

-	

-	public static final int COPY 	   = 1;

-	public static final int CUT 	   = 2;

-	public static final int PASTE	   = 3;

+

+	public static final int COPY = 1;

+	public static final int CUT = 2;

+	public static final int PASTE = 3;

 	public static final int SELECT_ALL = 4;

-	

-	public StandardTextFieldAction(StyledText styledText,int type) {

+

+	public StandardTextFieldAction(StyledText styledText, int type) {

 		this.styledText = styledText;

 		this.type = type;

 	}

-	

+

 	public void perform() {

-		if (type == COPY) 		styledText.copy();

-		if (type == CUT) 		styledText.cut();

-		if (type == PASTE)	 	styledText.paste();

-		if (type == SELECT_ALL) styledText.selectAll();

+		if (type == COPY)

+			styledText.copy();

+		if (type == CUT)

+			styledText.cut();

+		if (type == PASTE)

+			styledText.paste();

+		if (type == SELECT_ALL)

+			styledText.selectAll();

 	}

-	

+

 }

diff --git a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StyledTextActionHandler.java b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StyledTextActionHandler.java
index 6b7638d..99d8179 100644
--- a/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StyledTextActionHandler.java
+++ b/bundles/org.eclipse.ui.regex/src/org/eclipse/ui/regex/view/actions/StyledTextActionHandler.java
@@ -14,7 +14,7 @@
  * so it works with StyledText widgets instead

  * 

  */

- 

+

 package org.eclipse.ui.regex.view.actions;

 

 import org.eclipse.jface.action.Action;

@@ -32,19 +32,20 @@
 import org.eclipse.ui.IActionBars;

 import org.eclipse.ui.actions.ActionFactory;

 

-

 /**

- * Handles the redirection of the global Cut, Copy, Paste, and

- * Select All actions to either the current inline text control

- * or the part's supplied action handler.

+ * Handles the redirection of the global Cut, Copy, Paste, and Select All

+ * actions to either the current inline text control or the part's supplied

+ * action handler.

  * <p>

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

- * </p><p>

+ * </p>

+ * <p>

  * Example usage:

+ * 

  * <pre>

  * textActionHandler = new TextActionHandler(this.getViewSite().getActionBars());

- * textActionHandler.addText((Text)textCellEditor1.getControl());

- * textActionHandler.addText((Text)textCellEditor2.getControl());

+ * textActionHandler.addText((Text) textCellEditor1.getControl());

+ * textActionHandler.addText((Text) textCellEditor2.getControl());

  * textActionHandler.setSelectAllAction(selectAllAction);

  * </pre>

  * </p>

@@ -55,22 +56,22 @@
 	private CopyActionHandler textCopyAction = new CopyActionHandler();

 	private PasteActionHandler textPasteAction = new PasteActionHandler();

 	private SelectAllActionHandler textSelectAllAction = new SelectAllActionHandler();

-	

+

 	private IAction deleteAction;

 	private IAction cutAction;

 	private IAction copyAction;

 	private IAction pasteAction;

 	private IAction selectAllAction;

-	

+

 	private IPropertyChangeListener deleteActionListener = new PropertyChangeListener(textDeleteAction);

 	private IPropertyChangeListener cutActionListener = new PropertyChangeListener(textCutAction);

 	private IPropertyChangeListener copyActionListener = new PropertyChangeListener(textCopyAction);

 	private IPropertyChangeListener pasteActionListener = new PropertyChangeListener(textPasteAction);

 	private IPropertyChangeListener selectAllActionListener = new PropertyChangeListener(textSelectAllAction);

-	

+

 	private Listener textControlListener = new TextControlListener();

 	private StyledText activeTextControl;

-	

+

 	private MouseAdapter mouseAdapter = new MouseAdapter() {

 		public void mouseUp(MouseEvent e) {

 			updateActionsEnableState();

@@ -81,34 +82,36 @@
 			updateActionsEnableState();

 		}

 	};

-	

+

 	private class TextControlListener implements Listener {

 		public void handleEvent(Event event) {

 			switch (event.type) {

-				case SWT.Activate:

-					activeTextControl = (StyledText) event.widget;

-					updateActionsEnableState();

-					break;

-				case SWT.Deactivate:

-					// added so only one of the styled text fields can

-					// have a selection, which I believe should be the default

-					// behaviour

-					activeTextControl.setSelection(0,0);

-					activeTextControl = null;

-					updateActionsEnableState();

-					break;

-				default:

-					break;

+			case SWT.Activate:

+				activeTextControl = (StyledText) event.widget;

+				updateActionsEnableState();

+				break;

+			case SWT.Deactivate:

+				// added so only one of the styled text fields can

+				// have a selection, which I believe should be the default

+				// behaviour

+				activeTextControl.setSelection(0, 0);

+				activeTextControl = null;

+				updateActionsEnableState();

+				break;

+			default:

+				break;

 			}

 		}

 	}

-	

+

 	private class PropertyChangeListener implements IPropertyChangeListener {

 		private IAction actionHandler;

+

 		protected PropertyChangeListener(IAction actionHandler) {

 			super();

 			this.actionHandler = actionHandler;

 		}

+

 		public void propertyChange(PropertyChangeEvent event) {

 			if (activeTextControl != null)

 				return;

@@ -125,11 +128,12 @@
 			setId("TextDeleteActionHandler");//$NON-NLS-1$

 			setEnabled(false);

 		}

+

 		public void runWithEvent(Event event) {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

-				//this method doesn't exits in StyledText ??

-				//activeTextControl.clearSelection();

-				activeTextControl.setSelection(0,0);

+				// this method doesn't exits in StyledText ??

+				// activeTextControl.clearSelection();

+				activeTextControl.setSelection(0, 0);

 				return;

 			}

 			if (deleteAction != null) {

@@ -137,9 +141,11 @@
 				return;

 			}

 		}

+

 		public void updateEnabledState() {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

-				//if condition also had: activeTextControl.getCaretPosition() < activeTextControl.getCharCount() removed

+				// if condition also had: activeTextControl.getCaretPosition() <

+				// activeTextControl.getCharCount() removed

 				// because method doesn't exist in StyledText

 				setEnabled(activeTextControl.getSelectionCount() > 0);

 				return;

@@ -151,13 +157,14 @@
 			setEnabled(false);

 		}

 	}

-	

+

 	private class CutActionHandler extends Action {

 		protected CutActionHandler() {

 			super("Cut"); //$NON-NLS-1$

 			setId("TextCutActionHandler");//$NON-NLS-1$

 			setEnabled(false);

 		}

+

 		public void runWithEvent(Event event) {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				activeTextControl.cut();

@@ -168,6 +175,7 @@
 				return;

 			}

 		}

+

 		public void updateEnabledState() {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				setEnabled(activeTextControl.getSelectionCount() > 0);

@@ -180,13 +188,14 @@
 			setEnabled(false);

 		}

 	}

-	

+

 	private class CopyActionHandler extends Action {

 		protected CopyActionHandler() {

 			super("Copy"); //$NON-NLS-1$

 			setId("TextCopyActionHandler");//$NON-NLS-1$

 			setEnabled(false);

 		}

+

 		public void runWithEvent(Event event) {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				activeTextControl.copy();

@@ -197,6 +206,7 @@
 				return;

 			}

 		}

+

 		public void updateEnabledState() {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				setEnabled(activeTextControl.getSelectionCount() > 0);

@@ -209,13 +219,14 @@
 			setEnabled(false);

 		}

 	}

-	

+

 	private class PasteActionHandler extends Action {

 		protected PasteActionHandler() {

 			super("Paste"); //$NON-NLS-1$

 			setId("TextPasteActionHandler");//$NON-NLS-1$

 			setEnabled(false);

 		}

+

 		public void runWithEvent(Event event) {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				activeTextControl.paste();

@@ -226,6 +237,7 @@
 				return;

 			}

 		}

+

 		public void updateEnabledState() {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				setEnabled(true);

@@ -238,13 +250,14 @@
 			setEnabled(false);

 		}

 	}

-	

+

 	private class SelectAllActionHandler extends Action {

 		protected SelectAllActionHandler() {

 			super("TextAction.selectAll"); //$NON-NLS-1$

 			setId("TextSelectAllActionHandler");//$NON-NLS-1$

 			setEnabled(false);

 		}

+

 		public void runWithEvent(Event event) {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				activeTextControl.selectAll();

@@ -255,6 +268,7 @@
 				return;

 			}

 		}

+

 		public void updateEnabledState() {

 			if (activeTextControl != null && !activeTextControl.isDisposed()) {

 				setEnabled(true);

@@ -267,194 +281,204 @@
 			setEnabled(false);

 		}

 	}

-/**

- * Creates a <code>Text</code> control action handler

- * for the global Cut, Copy, Paste, Delete, and Select All 

- * of the action bar.

- *

- * @param actionBar the action bar to register global

- *    action handlers for Cut, Copy, Paste, Delete, 

- * 	  and Select All

- */

-public StyledTextActionHandler(IActionBars actionBar) {

-	super();

-	actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction);

-	actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction);

-	actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction);

-	actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), textSelectAllAction);

-	actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(), textDeleteAction);

-}

-/**

- * Add a <code>Text</code> control to the handler

- * so that the Cut, Copy, Paste, Delete, and Select All 

- * actions are redirected to it when active.

- *

- * @param textControl the inline <code>Text</code> control

- */

-public void addStyledText(StyledText textControl) {

-	if (textControl == null)

-		return;

 

-	activeTextControl = textControl;

-	textControl.addListener(SWT.Activate, textControlListener);

-	textControl.addListener(SWT.Deactivate, textControlListener);

+	/**

+	 * Creates a <code>Text</code> control action handler for the global Cut, Copy,

+	 * Paste, Delete, and Select All of the action bar.

+	 *

+	 * @param actionBar

+	 *            the action bar to register global action handlers for Cut, Copy,

+	 *            Paste, Delete, and Select All

+	 */

+	public StyledTextActionHandler(IActionBars actionBar) {

+		super();

+		actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction);

+		actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction);

+		actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction);

+		actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), textSelectAllAction);

+		actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(), textDeleteAction);

+	}

 

-	// We really want a selection listener but it is not supported so we

-	// use a key listener and a mouse listener to know when selection changes

-	// may have occured

-	textControl.addKeyListener(keyAdapter);

-	textControl.addMouseListener(mouseAdapter);	

-	

-}

-/**

- * Dispose of this action handler

- */

-public void dispose() {

-	setCutAction(null);

-	setCopyAction(null);

-	setPasteAction(null);

-	setSelectAllAction(null);

-	setDeleteAction(null);

-}

-/**

- * Removes a <code>Text</code> control from the handler

- * so that the Cut, Copy, Paste, Delete, and Select All 

- * actions are no longer redirected to it when active.

- *

- * @param textControl the inline <code>Text</code> control

- */

-public void removeStyledText(StyledText textControl) {

-	if (textControl == null)

-		return;

+	/**

+	 * Add a <code>Text</code> control to the handler so that the Cut, Copy, Paste,

+	 * Delete, and Select All actions are redirected to it when active.

+	 *

+	 * @param textControl

+	 *            the inline <code>Text</code> control

+	 */

+	public void addStyledText(StyledText textControl) {

+		if (textControl == null)

+			return;

 

-	textControl.removeListener(SWT.Activate, textControlListener);

-	textControl.removeListener(SWT.Deactivate, textControlListener);

+		activeTextControl = textControl;

+		textControl.addListener(SWT.Activate, textControlListener);

+		textControl.addListener(SWT.Deactivate, textControlListener);

 

-	textControl.removeMouseListener(mouseAdapter);

-	textControl.removeKeyListener(keyAdapter);

-	

-	activeTextControl = null;

-	updateActionsEnableState();

-}

-/**

- * Set the default <code>IAction</code> handler for the Copy

- * action. This <code>IAction</code> is run only if no active

- * inline text control.

- *

- * @param action the <code>IAction</code> to run for the

- *    Copy action, or <code>null</null> if not interested.

- */

-public void setCopyAction(IAction action) {

-	if (copyAction == action)

-		return;

+		// We really want a selection listener but it is not supported so we

+		// use a key listener and a mouse listener to know when selection changes

+		// may have occured

+		textControl.addKeyListener(keyAdapter);

+		textControl.addMouseListener(mouseAdapter);

 

-	if (copyAction != null)

-		copyAction.removePropertyChangeListener(copyActionListener);

-		

-	copyAction = action;

+	}

 

-	if (copyAction != null)

-		copyAction.addPropertyChangeListener(copyActionListener);

+	/**

+	 * Dispose of this action handler

+	 */

+	public void dispose() {

+		setCutAction(null);

+		setCopyAction(null);

+		setPasteAction(null);

+		setSelectAllAction(null);

+		setDeleteAction(null);

+	}

 

-	textCopyAction.updateEnabledState();

-}

-/**

- * Set the default <code>IAction</code> handler for the Cut

- * action. This <code>IAction</code> is run only if no active

- * inline text control.

- *

- * @param action the <code>IAction</code> to run for the

- *    Cut action, or <code>null</null> if not interested.

- */

-public void setCutAction(IAction action) {

-	if (cutAction == action)

-		return;

+	/**

+	 * Removes a <code>Text</code> control from the handler so that the Cut, Copy,

+	 * Paste, Delete, and Select All actions are no longer redirected to it when

+	 * active.

+	 *

+	 * @param textControl

+	 *            the inline <code>Text</code> control

+	 */

+	public void removeStyledText(StyledText textControl) {

+		if (textControl == null)

+			return;

 

-	if (cutAction != null)

-		cutAction.removePropertyChangeListener(cutActionListener);

-		

-	cutAction = action;

+		textControl.removeListener(SWT.Activate, textControlListener);

+		textControl.removeListener(SWT.Deactivate, textControlListener);

 

-	if (cutAction != null)

-		cutAction.addPropertyChangeListener(cutActionListener);

+		textControl.removeMouseListener(mouseAdapter);

+		textControl.removeKeyListener(keyAdapter);

 

-	textCutAction.updateEnabledState();

-}

-/**

- * Set the default <code>IAction</code> handler for the Paste

- * action. This <code>IAction</code> is run only if no active

- * inline text control.

- *

- * @param action the <code>IAction</code> to run for the

- *    Paste action, or <code>null</null> if not interested.

- */

-public void setPasteAction(IAction action) {

-	if (pasteAction == action)

-		return;

+		activeTextControl = null;

+		updateActionsEnableState();

+	}

 

-	if (pasteAction != null)

-		pasteAction.removePropertyChangeListener(pasteActionListener);

-		

-	pasteAction = action;

+	/**

+	 * Set the default <code>IAction</code> handler for the Copy action. This

+	 * <code>IAction</code> is run only if no active inline text control.

+	 *

+	 * @param action

+	 *            the <code>IAction</code> to run for the Copy action, or

+	 *            <code>null</null> if not interested.

+	 */

+	public void setCopyAction(IAction action) {

+		if (copyAction == action)

+			return;

 

-	if (pasteAction != null)

-		pasteAction.addPropertyChangeListener(pasteActionListener);

+		if (copyAction != null)

+			copyAction.removePropertyChangeListener(copyActionListener);

 

-	textPasteAction.updateEnabledState();

-}

-/**

- * Set the default <code>IAction</code> handler for the Select All

- * action. This <code>IAction</code> is run only if no active

- * inline text control.

- *

- * @param action the <code>IAction</code> to run for the

- *    Select All action, or <code>null</null> if not interested.

- */

-public void setSelectAllAction(IAction action) {

-	if (selectAllAction == action)

-		return;

+		copyAction = action;

 

-	if (selectAllAction != null)

-		selectAllAction.removePropertyChangeListener(selectAllActionListener);

-		

-	selectAllAction = action;

+		if (copyAction != null)

+			copyAction.addPropertyChangeListener(copyActionListener);

 

-	if (selectAllAction != null)

-		selectAllAction.addPropertyChangeListener(selectAllActionListener);

+		textCopyAction.updateEnabledState();

+	}

 

-	textSelectAllAction.updateEnabledState();

-}

-/**

- * Set the default <code>IAction</code> handler for the Delete

- * action. This <code>IAction</code> is run only if no active

- * inline text control.

- *

- * @param action the <code>IAction</code> to run for the

- *    Delete action, or <code>null</null> if not interested.

- */

-public void setDeleteAction(IAction action) {

-	if (deleteAction == action)

-		return;

+	/**

+	 * Set the default <code>IAction</code> handler for the Cut action. This

+	 * <code>IAction</code> is run only if no active inline text control.

+	 *

+	 * @param action

+	 *            the <code>IAction</code> to run for the Cut action, or

+	 *            <code>null</null> if not interested.

+	 */

+	public void setCutAction(IAction action) {

+		if (cutAction == action)

+			return;

 

-	if (deleteAction != null)

-		deleteAction.removePropertyChangeListener(deleteActionListener);

-		

-	deleteAction = action;

+		if (cutAction != null)

+			cutAction.removePropertyChangeListener(cutActionListener);

 

-	if (deleteAction != null)

-		deleteAction.addPropertyChangeListener(deleteActionListener);

+		cutAction = action;

 

-	textDeleteAction.updateEnabledState();

-}

-/**

- * Update the enable state of the Cut, Copy,

- * Paste, Delete, and Select All action handlers

- */

-private void updateActionsEnableState() {

-	textCutAction.updateEnabledState();

-	textCopyAction.updateEnabledState();

-	textPasteAction.updateEnabledState();

-	textSelectAllAction.updateEnabledState();

-	textDeleteAction.updateEnabledState();

-}

+		if (cutAction != null)

+			cutAction.addPropertyChangeListener(cutActionListener);

+

+		textCutAction.updateEnabledState();

+	}

+

+	/**

+	 * Set the default <code>IAction</code> handler for the Paste action. This

+	 * <code>IAction</code> is run only if no active inline text control.

+	 *

+	 * @param action

+	 *            the <code>IAction</code> to run for the Paste action, or

+	 *            <code>null</null> if not interested.

+	 */

+	public void setPasteAction(IAction action) {

+		if (pasteAction == action)

+			return;

+

+		if (pasteAction != null)

+			pasteAction.removePropertyChangeListener(pasteActionListener);

+

+		pasteAction = action;

+

+		if (pasteAction != null)

+			pasteAction.addPropertyChangeListener(pasteActionListener);

+

+		textPasteAction.updateEnabledState();

+	}

+

+	/**

+	 * Set the default <code>IAction</code> handler for the Select All action. This

+	 * <code>IAction</code> is run only if no active inline text control.

+	 *

+	 * @param action

+	 *            the <code>IAction</code> to run for the Select All action, or

+	 *            <code>null</null> if not interested.

+	 */

+	public void setSelectAllAction(IAction action) {

+		if (selectAllAction == action)

+			return;

+

+		if (selectAllAction != null)

+			selectAllAction.removePropertyChangeListener(selectAllActionListener);

+

+		selectAllAction = action;

+

+		if (selectAllAction != null)

+			selectAllAction.addPropertyChangeListener(selectAllActionListener);

+

+		textSelectAllAction.updateEnabledState();

+	}

+

+	/**

+	 * Set the default <code>IAction</code> handler for the Delete action. This

+	 * <code>IAction</code> is run only if no active inline text control.

+	 *

+	 * @param action

+	 *            the <code>IAction</code> to run for the Delete action, or

+	 *            <code>null</null> if not interested.

+	 */

+	public void setDeleteAction(IAction action) {

+		if (deleteAction == action)

+			return;

+

+		if (deleteAction != null)

+			deleteAction.removePropertyChangeListener(deleteActionListener);

+

+		deleteAction = action;

+

+		if (deleteAction != null)

+			deleteAction.addPropertyChangeListener(deleteActionListener);

+

+		textDeleteAction.updateEnabledState();

+	}

+

+	/**

+	 * Update the enable state of the Cut, Copy, Paste, Delete, and Select All

+	 * action handlers

+	 */

+	private void updateActionsEnableState() {

+		textCutAction.updateEnabledState();

+		textCopyAction.updateEnabledState();

+		textPasteAction.updateEnabledState();

+		textSelectAllAction.updateEnabledState();

+		textDeleteAction.updateEnabledState();

+	}

 }