[109468] get rid of subclasses of StructuredTextEditor
diff --git a/bundles/org.eclipse.jst.jsp.ui/plugin.properties b/bundles/org.eclipse.jst.jsp.ui/plugin.properties
index 7acd612..055c54a 100644
--- a/bundles/org.eclipse.jst.jsp.ui/plugin.properties
+++ b/bundles/org.eclipse.jst.jsp.ui/plugin.properties
@@ -63,3 +63,23 @@
 AddBookmark.tooltip=Add Bookmark...
 ## EL Error Message
 JSPEL_Syntax_Error=JSP EL Syntax Error
+##
+CleanupDocument_label=Cleanup Document...
+CleanupDocument_tooltip=Cleanup Document
+ToggleComment_label=Toggle Comment
+ToggleComment_tooltip=Toggle Comment
+AddBlockComment_label=Add Block Comment
+AddBlockComment_tooltip=Add Block Comment
+RemoveBlockComment_label=Remove Block Comment
+RemoveBlockComment_tooltip=Remove Block Comment
+FindOccurrences_label=Occurrences in File
+RenameElement_label=Rename
+MoveElement_label=Move
+StructureSelectEnclosing_label=Enclosing Element
+StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
+StructureSelectNext_label=Next Element
+StructureSelectNext_tooltip=Expand selection to include next sibling
+StructureSelectPrevious_label=Previous Element
+StructureSelectPrevious_tooltip=Expand selection to include previous sibling
+StructureSelectHistory_label=Restore Last Selection
+StructureSelectHistory_tooltip=Restore last selection
diff --git a/bundles/org.eclipse.jst.jsp.ui/plugin.xml b/bundles/org.eclipse.jst.jsp.ui/plugin.xml
index 00e7cf0..41b7f2d 100644
--- a/bundles/org.eclipse.jst.jsp.ui/plugin.xml
+++ b/bundles/org.eclipse.jst.jsp.ui/plugin.xml
@@ -8,7 +8,7 @@
 			icon="icons//full/obj16/sourceEditor.gif"
 			extensions="jsp, jsf, jspf, jspx, tag, tagf"
 			contributorClass="org.eclipse.jst.jsp.ui.internal.editor.ActionContributorJSP"
-			class="org.eclipse.jst.jsp.ui.internal.editor.StructuredTextEditorJSP"
+			class="org.eclipse.wst.sse.ui.StructuredTextEditor"
 			symbolicFontName="org.eclipse.wst.sse.ui.textfont"
 			id="org.eclipse.jst.jsp.core.jspsource.source">
 			<contentTypeBinding
@@ -277,39 +277,48 @@
 	<!-- JSP Editor specific actions                                                          -->
 	<!--======================================================================================-->
 	<extension point="org.eclipse.ui.commands">
-		<scope
-			name="%scope.structured.text.editor.jsp.name"
-			parent="org.eclipse.ui.textEditorScope"
-			description="%scope.structured.text.editor.jsp.description"
-			id="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope" />
-
-		<!-- dmw 6/6 removed from 'scope'      parentId="org.eclipse.ui.textEditorScope" -->
 		<!-- rename refactor -->
 		<command
 			name="%command.jsp.refactor.rename.name"
 			description="%command.jsp.refactor.rename.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.jst.jsp.ui.refactor.rename" />
 
-		<keyBinding
-			string="Alt+Shift+R"
-			scope="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope"
-			command="org.eclipse.jst.jsp.ui.refactor.rename"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration" />
-
 		<!-- move refactor -->
 		<command
 			name="%command.jsp.refactor.move.name"
 			description="%command.jsp.refactor.move.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.jst.jsp.ui.refactor.move" />
+	</extension>
+	
+	<!-- Keybinding scope for jsp source editor -->
+	<extension point="org.eclipse.ui.contexts">
+		<context
+			name="%scope.structured.text.editor.jsp.name"
+			parentId="org.eclipse.ui.textEditorScope"
+			description="%scope.structured.text.editor.jsp.description"
+			id="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope">
+		</context>
+	</extension>
+	
+	<!-- Keybindings for jsp source editor -->
+	<extension point="org.eclipse.ui.bindings">
+		<!-- rename refactor -->
+		<key
+			sequence="Alt+Shift+R"
+			contextId="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope"
+			commandId="org.eclipse.jst.jsp.ui.refactor.rename"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
 
-		<keyBinding
-			string="Alt+Shift+V"
-			scope="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope"
-			command="org.eclipse.jst.jsp.ui.refactor.move"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration" />
-
+		<!-- move refactor -->
+		<key
+			sequence="Alt+Shift+V"
+			contextId="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope"
+			commandId="org.eclipse.jst.jsp.ui.refactor.move"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
 	</extension>
 
 	<!--======================================================================================-->
@@ -434,5 +443,95 @@
 		</viewerContribution>
 	</extension>
 
-
+	<extension point="org.eclipse.ui.editorActions">
+		<editorContribution
+			id="org.eclipse.jst.jsp.core.jspsource.source.editorActions"
+			targetID="org.eclipse.jst.jsp.core.jspsource.source">
+			<action
+				id="CleanupDocument"
+				label="%CleanupDocument_label"
+				definitionId="org.eclipse.wst.sse.ui.cleanup.document"
+				tooltip="%CleanupDocument_tooltip"
+				class="org.eclipse.wst.html.ui.internal.edit.ui.CleanupActionHTMLDelegate"
+				actionID="CleanupDocument">
+			</action>
+			<action
+				id="ToggleComment"
+				label="%ToggleComment_label"
+				definitionId="org.eclipse.wst.sse.ui.toggle.comment"
+				tooltip="%ToggleComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXMLDelegate"
+				actionID="ToggleComment">
+			</action>
+			<action
+				id="AddBlockComment"
+				label="%AddBlockComment_label"
+				definitionId="org.eclipse.wst.sse.ui.add.block.comment"
+				tooltip="%AddBlockComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXMLDelegate"
+				actionID="AddBlockComment">
+			</action>
+			<action
+				id="RemoveBlockComment"
+				label="%RemoveBlockComment_label"
+				definitionId="org.eclipse.wst.sse.ui.remove.block.comment"
+				tooltip="%RemoveBlockComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXMLDelegate"
+				actionID="RemoveBlockComment">
+			</action>
+			<action
+				id="RenameElement"
+				label="%RenameElement_label"
+				definitionId="org.eclipse.jst.jsp.ui.refactor.rename"
+				class="org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameElementActionDelegate"
+				actionID="RenameElement">
+			</action>
+			<action
+				id="MoveElement"
+				label="%MoveElement_label"
+				definitionId="org.eclipse.jst.jsp.ui.refactor.move"
+				class="org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPMoveElementActionDelegate"
+				actionID="MoveElement">
+			</action>
+			<action
+				id="FindOccurrences"
+				label="%FindOccurrences_label"
+				definitionId="org.eclipse.wst.sse.ui.search.find.occurrences"
+				class="org.eclipse.jst.jsp.ui.internal.java.search.JSPFindOccurrencesActionDelegate"
+				actionID="FindOccurrences">
+			</action>
+			<action
+				id="StructureSelectEnclosing"
+				label="%StructureSelectEnclosing_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing"
+				tooltip="%StructureSelectEnclosing_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectEnclosingXMLActionDelegate"
+				actionID="StructureSelectEnclosing">
+			</action>
+			<action
+				id="StructureSelectNext"
+				label="%StructureSelectNext_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.next"
+				tooltip="%StructureSelectNext_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectNextXMLActionDelegate"
+				actionID="StructureSelectNext">
+			</action>
+			<action
+				id="StructureSelectPrevious"
+				label="%StructureSelectPrevious_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.previous"
+				tooltip="%StructureSelectPrevious_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectPreviousXMLActionDelegate"
+				actionID="StructureSelectPrevious">
+			</action>
+			<action
+				id="StructureSelectHistory"
+				label="%StructureSelectHistory_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.last"
+				tooltip="%StructureSelectHistory_tooltip"
+				class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate"
+				actionID="StructureSelectHistory">
+			</action>
+		</editorContribution>
+	</extension>
 </plugin>
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties
index 49adba2..a447662 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties
@@ -15,9 +15,9 @@
 ## Welcome!
 Sample_JSP_doc=<%@ page \n\tlanguage=\"java\" \n\tcontentType=\"text/html; charset=ISO-8859-1\"\n%>\n<jsp:include flush=\"true\" page=\"titleBar.jsp\"/>\n\n<%-- Use below tags ONLY for JSP 1.1 --%>\n<%\n\tSystem.out.println(\"Welcome!\");\n%>\n<%-- Use below tags ONLY for JSP 1.2 --%>\n<jsp:scriptlet>\n\tSystem.out.println(\"Welcome!\");\n</jsp:scriptlet>
 JSP_Delimiters_UI_=JSP Delimiters
-Refactor_label=R&efactor
-RenameElement_label=Re&name
-MoveElement_label=Mo&ve
+Refactor_label=Refactor
+RenameElement_label=Rename
+MoveElement_label=Move
 MoveElementWizard=Move the selected elements
 #
 OK=OK
@@ -45,19 +45,19 @@
 NewJSPTemplatesWizardPage_5=Preview
 NewJSPTemplatesWizardPage_6=Templates are 'New JSP' templates found in the <a>JSP Templates</a> preference page.
 # Copied from sse.ui
-CleanupDocument_label=C&leanup Document...
+CleanupDocument_label=Cleanup Document...
 CleanupDocument_tooltip=Cleanup Document
 CleanupDocument_description=Cleanup Document
-ToggleComment_label=Togg&le Comment
+ToggleComment_label=Toggle Comment
 ToggleComment_tooltip=Toggle Comment
 ToggleComment_description=Toggle Comment
-AddBlockComment_label=Add &Block Comment
+AddBlockComment_label=Add Block Comment
 AddBlockComment_tooltip=Add Block Comment
 AddBlockComment_description=Add Block Comment
-RemoveBlockComment_label=Remove Bloc&k Comment
+RemoveBlockComment_label=Remove Block Comment
 RemoveBlockComment_tooltip=Remove Block Comment
 RemoveBlockComment_description=Remove Block Comment
-FindOccurrences_label=O&ccurrences in File
+FindOccurrences_label=Occurrences in File
 OccurrencesSearchQuery_0={0} - {1} Occurrences in {2}
 OccurrencesSearchQuery_2=file
 Content_Assist_not_availab_UI_=Content Assist not available at the current location
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java
deleted file mode 100644
index 38ecd66..0000000
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsp.ui.internal.editor;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jst.jsp.ui.internal.IActionConstantsJSP;
-import org.eclipse.jst.jsp.ui.internal.JSPUIMessages;
-import org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPMoveElementAction;
-import org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameElementAction;
-import org.eclipse.jst.jsp.ui.internal.java.search.JSPFindOccurrencesAction;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.wst.html.ui.internal.edit.ui.CleanupActionHTML;
-import org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesAction;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionProvider;
-import org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXML;
-
-public class StructuredTextEditorJSP extends StructuredTextEditor {
-	private final static String UNDERSCORE = "_"; //$NON-NLS-1$
-	
-	protected void createActions() {
-		super.createActions();
-
-		ResourceBundle resourceBundle = JSPUIMessages.getResourceBundle();
-
-		Action action = new CleanupActionHTML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT, action);
-
-		action = new ToggleCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.TOGGLE_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT, action);
-
-		action = new AddBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.ADD_BLOCK_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT, action);
-
-		action = new RemoveBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.REMOVE_BLOCK_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT, action);
-
-		FindOccurrencesActionProvider foAction = new FindOccurrencesActionProvider(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES + UNDERSCORE, this);
-		foAction.addAction(new HTMLFindOccurrencesAction(resourceBundle, "", this)); //$NON-NLS-1$
-		foAction.addAction(new JSPFindOccurrencesAction(resourceBundle, "", this)); //$NON-NLS-1$
-		foAction.setActionDefinitionId(ActionDefinitionIds.FIND_OCCURRENCES);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, foAction);
-		markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, true);
-
-		JSPRenameElementAction renameAction = new JSPRenameElementAction(JSPUIMessages.getResourceBundle(), IActionConstantsJSP.ACTION_NAME_RENAME_ELEMENT + UNDERSCORE, this);
-		setAction(IActionConstantsJSP.ACTION_NAME_RENAME_ELEMENT, renameAction);
-		markAsSelectionDependentAction(IActionConstantsJSP.ACTION_NAME_RENAME_ELEMENT, true);
-
-		JSPMoveElementAction moveAction = new JSPMoveElementAction(JSPUIMessages.getResourceBundle(), IActionConstantsJSP.ACTION_NAME_MOVE_ELEMENT + UNDERSCORE, this);
-		setAction(IActionConstantsJSP.ACTION_NAME_MOVE_ELEMENT, moveAction);
-		markAsSelectionDependentAction(IActionConstantsJSP.ACTION_NAME_MOVE_ELEMENT, true);
-	}
-
-	protected void addContextMenuActions(IMenuManager menu) {
-
-		super.addContextMenuActions(menu);
-
-		if (getSourceViewer().isEditable()) {
-			String label = JSPUIMessages.Refactor_label; //$NON-NLS-1$ = "Format"
-			MenuManager subMenu = new MenuManager(label, "Refactor"); //$NON-NLS-1$
-			addAction(subMenu, IActionConstantsJSP.ACTION_NAME_RENAME_ELEMENT);
-			addAction(subMenu, IActionConstantsJSP.ACTION_NAME_MOVE_ELEMENT);
-			subMenu.add(new GroupMarker(GROUP_NAME_ADDITIONS));
-			menu.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, subMenu);
-		}
-	}
-
-	protected void initializeEditor() {
-		super.initializeEditor();
-		setHelpContextId(IHelpContextIds.JSP_SOURCEVIEW_HELPID);
-	}
-}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java
deleted file mode 100644
index 8d21c72..0000000
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsp.ui.internal.java.refactoring;
-
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
-import org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor;
-import org.eclipse.jdt.internal.corext.util.CodeFormatterUtil;
-import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
-import org.eclipse.jdt.internal.ui.refactoring.reorg.CreateTargetQueries;
-import org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgMoveWizard;
-import org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgQueries;
-import org.eclipse.jdt.ui.PreferenceConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jst.jsp.ui.internal.JSPUIMessages;
-import org.eclipse.jst.jsp.ui.internal.Logger;
-import org.eclipse.ltk.core.refactoring.participants.MoveRefactoring;
-import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
-
-/**
- * A TextEditorAction that launches JDT move element wizard
- * 
- * Still relies heavily on internal API
- * will change post 3.0 with public move support
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817 
- * @author pavery
- */
-public class JSPMoveElementAction extends TextEditorAction {
-
-	public JSPMoveElementAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
-
-		super(bundle, prefix, editor);
-	}
-	
-	public boolean isEnabled() {
-		// always enabled, just print appropriate status to window
-		// if for some reason the action can't run (like multiple java elements selected)
-		
-		return true;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.ui.texteditor.TextEditorAction#update()
-	 */
-	public void update() {
-		super.update();
-		PlatformStatusLineUtil.clearStatusLine();
-	}
-	
-	private IJavaElement[] getSelectedElements() {
-		
-		IJavaElement[] elements = new IJavaElement[0];
-		if (getTextEditor() != null)
-			elements = JSPJavaSelectionProvider.getSelection(getTextEditor());
-		return elements;
-	}
-	
-	private IResource[] getResources(IJavaElement[] elements) {
-
-		IResource[] resources = new IResource[elements.length];
-		for (int i = 0; i < elements.length; i++) {
-			try {
-				resources[i] = elements[i].getPrimaryElement().getCorrespondingResource();//elements[i].getResource();
-			} catch (JavaModelException e) {
-				Logger.logException(e);
-			}
-		}
-		return resources;
-	}
-
-	/**
-	 * will change post 3.0 with public move support
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
-	 */
-	public void run() {
-		IJavaElement[] elements = getSelectedElements();
-		if(elements.length > 0) {	
-			
-			// need to check if it's movable
-			try {
-				JavaMoveProcessor processor= JavaMoveProcessor.create(getResources(elements), elements/*, getCodeGenerationSettings()*/);
-				Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-				
-				MoveRefactoring refactoring= new MoveRefactoring(processor);
-			
-				RefactoringWizard wizard= createWizard(refactoring);
-				
-				/*
-				 * We want to get the shell from the refactoring dialog but it's not
-				 * known at this point, so we pass the wizard and then, once the dialog
-				 * is open, we will have access to its shell.
-				 */
-				
-				processor.setCreateTargetQueries(new CreateTargetQueries(wizard));
-				processor.setReorgQueries(new ReorgQueries(wizard));
-				//String openRefactoringWizMsg = RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"); //$NON-NLS-1$
-				String openRefactoringWizMsg = JSPUIMessages.MoveElementWizard; //"Move the selected elements"; //$NON-NLS-1$
-				new RefactoringStarter().activate(refactoring, wizard, parent, openRefactoringWizMsg, true);
-				
-				PlatformStatusLineUtil.clearStatusLine();
-				
-			} catch (JavaModelException e) {
-				Logger.logException(e);
-			}
-		}
-		else  {
-			PlatformStatusLineUtil.displayErrorMessage(JSPUIMessages.JSPMoveElementAction_0); //$NON-NLS-1$
-		}
-	}
-
-	// these methods are copied from internal JDT class org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings
-	/**
-	 * will change post 3.0 with public move support
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
-	 */
-	public static CodeGenerationSettings getCodeGenerationSettings() {
-		
-		IPreferenceStore store= PreferenceConstants.getPreferenceStore();
-		
-		CodeGenerationSettings res= new CodeGenerationSettings();
-		res.createComments= store.getBoolean(PreferenceConstants.CODEGEN_ADD_COMMENTS);
-		res.useKeywordThis= store.getBoolean(PreferenceConstants.CODEGEN_KEYWORD_THIS);
-		res.importOrder= getImportOrderPreference(store);
-		res.importThreshold= getImportNumberThreshold(store);
-		res.tabWidth= CodeFormatterUtil.getTabWidth();
-		return res;
-	}
-
-	/**
-	 * will change post 3.0 with public move support
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
-	 */
-	public static int getImportNumberThreshold(IPreferenceStore prefs) {
-		int threshold= prefs.getInt(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
-		if (threshold < 0) {
-			threshold= Integer.MAX_VALUE;
-		}
-		return threshold;
-	}
-
-	/**
-	 * will change post 3.0 with public move support
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
-	 */
-	public static String[] getImportOrderPreference(IPreferenceStore prefs) {
-		String str= prefs.getString(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
-		if (str != null) {
-			return unpackList(str, ";"); //$NON-NLS-1$
-		}
-		return new String[0];
-	}
-
-	/**
-	 * will change post 3.0 with public move support
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
-	 */
-	private static String[] unpackList(String str, String separator) {
-		StringTokenizer tok= new StringTokenizer(str, separator); //$NON-NLS-1$
-		int nTokens= tok.countTokens();
-		String[] res= new String[nTokens];
-		for (int i= 0; i < nTokens; i++) {
-			res[i]= tok.nextToken().trim();
-		}
-		return res;
-	}
-	
-	/**
-	 * will change post 3.0 with public move support
-	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
-	 */
-	private RefactoringWizard createWizard(MoveRefactoring refactoring) {
-		return new ReorgMoveWizard(refactoring);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java
new file mode 100644
index 0000000..53a3d01
--- /dev/null
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.jst.jsp.ui.internal.java.refactoring;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor;
+import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter;
+import org.eclipse.jdt.internal.ui.refactoring.reorg.CreateTargetQueries;
+import org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgMoveWizard;
+import org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgQueries;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jst.jsp.ui.internal.JSPUIMessages;
+import org.eclipse.jst.jsp.ui.internal.Logger;
+import org.eclipse.ltk.core.refactoring.participants.MoveRefactoring;
+import org.eclipse.ltk.ui.refactoring.RefactoringWizard;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
+
+/**
+ * An action delegate that launches JDT move element wizard
+ * 
+ * Still relies heavily on internal API
+ * will change post 3.0 with public move support
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817 
+ */
+public class JSPMoveElementActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
+
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(JSPUIMessages.MoveElement_label);
+			action.setToolTipText(JSPUIMessages.MoveElement_label);
+		}
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void run(IAction action) {
+		IJavaElement[] elements = getSelectedElements();
+		if (elements.length > 0) {
+
+			// need to check if it's movable
+			try {
+				JavaMoveProcessor processor = JavaMoveProcessor.create(getResources(elements), elements/*
+																										 * ,
+																										 * getCodeGenerationSettings()
+																										 */);
+				Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+				MoveRefactoring refactoring = new MoveRefactoring(processor);
+
+				RefactoringWizard wizard = createWizard(refactoring);
+
+				/*
+				 * We want to get the shell from the refactoring dialog but
+				 * it's not known at this point, so we pass the wizard and
+				 * then, once the dialog is open, we will have access to its
+				 * shell.
+				 */
+
+				processor.setCreateTargetQueries(new CreateTargetQueries(wizard));
+				processor.setReorgQueries(new ReorgQueries(wizard));
+				// String openRefactoringWizMsg =
+				// RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring");
+				// //$NON-NLS-1$
+				String openRefactoringWizMsg = JSPUIMessages.MoveElementWizard; // "Move
+																				// the
+																				// selected
+																				// elements";
+																				// //$NON-NLS-1$
+				new RefactoringStarter().activate(refactoring, wizard, parent, openRefactoringWizMsg, true);
+
+				PlatformStatusLineUtil.clearStatusLine();
+
+			}
+			catch (JavaModelException e) {
+				Logger.logException(e);
+			}
+		}
+		else {
+			PlatformStatusLineUtil.displayErrorMessage(JSPUIMessages.JSPMoveElementAction_0); //$NON-NLS-1$
+		}
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		PlatformStatusLineUtil.clearStatusLine();
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	private IJavaElement[] getSelectedElements() {
+
+		IJavaElement[] elements = new IJavaElement[0];
+		if (fEditor instanceof ITextEditor)
+			elements = JSPJavaSelectionProvider.getSelection((ITextEditor) fEditor);
+		return elements;
+	}
+
+	private IResource[] getResources(IJavaElement[] elements) {
+		IResource[] resources = new IResource[elements.length];
+		for (int i = 0; i < elements.length; i++) {
+			try {
+				resources[i] = elements[i].getPrimaryElement().getCorrespondingResource();// elements[i].getResource();
+			}
+			catch (JavaModelException e) {
+				Logger.logException(e);
+			}
+		}
+		return resources;
+	}
+	
+	/**
+	 * will change post 3.0 with public move support
+	 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817
+	 */
+	private RefactoringWizard createWizard(MoveRefactoring refactoring) {
+		return new ReorgMoveWizard(refactoring);
+	}
+}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java
similarity index 66%
rename from bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java
rename to bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java
index 6348bbc..f487fc5 100644
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * Copyright (c) 2005 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,10 +7,10 @@
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     
  *******************************************************************************/
-package org.eclipse.jst.jsp.ui.internal.java.refactoring;
 
-import java.util.ResourceBundle;
+package org.eclipse.jst.jsp.ui.internal.java.refactoring;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.IJavaElement;
@@ -18,50 +18,47 @@
 import org.eclipse.jdt.core.IPackageFragment;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.ui.refactoring.RenameSupport;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jst.jsp.ui.internal.JSPUIMessages;
 import org.eclipse.jst.jsp.ui.internal.Logger;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
 import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
 
 /**
- * A TextEditorAction that launches JDT rename element wizard
- * 
- * @author pavery
+ * An action delegate that launches JDT rename element wizard
  */
-public class JSPRenameElementAction extends TextEditorAction {
+public class JSPRenameElementActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+	
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
 
-	public JSPRenameElementAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+	}
 
-		super(bundle, prefix, editor);
-	}
-	
-	public boolean isEnabled() {
-		// always enabled, just print appropriate status to window
-		// if for some reason the action can't run (like multiple java elements selected)
-		return true;
-	}
-	
-	/**
-	 * @see org.eclipse.ui.texteditor.TextEditorAction#update()
-	 */
-	public void update() {
-		super.update();
-		PlatformStatusLineUtil.clearStatusLine();
-	}
-	
-	private IJavaElement getSelectedElement() {
-		IJavaElement element = null;
-		if (getTextEditor() != null) {
-			IJavaElement[] elements = JSPJavaSelectionProvider.getSelection(getTextEditor());
-			if (elements.length == 1)
-				element = elements[0];
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(JSPUIMessages.RenameElement_label);
+			action.setToolTipText(JSPUIMessages.RenameElement_label);
 		}
-		return element;
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
 	}
 	
-	public void run() {
+	public void run(IAction action) {
 		IJavaElement element = getSelectedElement();
 		if(element != null) {
 			RenameSupport renameSupport = null;
@@ -91,4 +88,22 @@
 			PlatformStatusLineUtil.addOneTimeClearListener();
 		}
 	}
-}
\ No newline at end of file
+	
+	public void selectionChanged(IAction action, ISelection selection) {
+		PlatformStatusLineUtil.clearStatusLine();
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	private IJavaElement getSelectedElement() {
+		IJavaElement element = null;
+		if (fEditor instanceof ITextEditor) {
+			IJavaElement[] elements = JSPJavaSelectionProvider.getSelection((ITextEditor)fEditor);
+			if (elements.length == 1)
+				element = elements[0];
+		}
+		return element;
+	}
+}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java
deleted file mode 100644
index ae8db05..0000000
--- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.jsp.ui.internal.java.search;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation;
-import org.eclipse.jst.jsp.core.internal.java.JSPTranslation;
-import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter;
-import org.eclipse.jst.jsp.core.internal.provisional.text.IJSPPartitionTypes;
-import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.search.BasicFindOccurrencesAction;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-
-/**
- * <p>
- * Finds occurrences of Java elements in a JSP file using JSPSearchSupport.
- * </p>
- * 
- * @author pavery
- */
-public class JSPFindOccurrencesAction extends BasicFindOccurrencesAction implements IJavaSearchConstants {
-
-	private IFile fJSPFile = null;
-
-	public JSPFindOccurrencesAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
-
-		super(bundle, prefix, editor);
-	}
-
-
-	public ISearchQuery getSearchQuery() {
-		return new JSPSearchQuery(getJspFile(), getJavaElement());
-	}
-
-	public void update() {
-
-		super.update();
-// temporary, workaround to disable function, since using the function 
-// can easily cause deadlock to occur.
-//		 See https://bugs.eclipse.org/bugs/show_bug.cgi?id=103662		
-		setEnabled(false);
-//		if (isEnabled()) {
-//			// do java element check here...
-//			// should already be in a jsp/java partition
-//			IJavaElement[] elements = getJavaElementsForCurrentSelection();
-//			// we can only find occurrences of one element
-//			setEnabled(elements.length == 1);
-//		}
-	}
-
-	/**
-	 * uses JSPTranslation to get currently selected Java elements.
-	 * 
-	 * @return currently selected IJavaElements
-	 */
-	public IJavaElement[] getJavaElementsForCurrentSelection() {
-		IJavaElement[] elements = new IJavaElement[0];
-		StructuredTextEditor editor = (StructuredTextEditor) getTextEditor();
-		// get JSP translation object for this viewer's document
-		IStructuredModel model = editor.getModel();
-		if (model != null && model instanceof IDOMModel) {
-			IDOMDocument xmlDoc = ((IDOMModel) model).getDocument();
-			JSPTranslationAdapter adapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
-			if (adapter != null) {
-				JSPTranslation translation = adapter.getJSPTranslation();
-				ISelection s = editor.getSelectionProvider().getSelection();
-				if (s instanceof ITextSelection) {
-					ITextSelection selection = (ITextSelection) s;
-					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102211
-					elements = translation.getElementsFromJspRange(selection.getOffset(), selection.getOffset()+selection.getLength());
-				}
-			}
-		}
-		return elements;
-	}
-
-	public String[] getPartitionTypes() {
-		return new String[]{IJSPPartitionTypes.JSP_DEFAULT, IJSPPartitionTypes.JSP_CONTENT_JAVA};
-	}
-
-	public String[] getRegionTypes() {
-		return new String[]{DOMRegionContext.BLOCK_TEXT, DOMJSPRegionContexts.JSP_CONTENT};
-	}
-
-	private IFile getJspFile() {
-		if (this.fJSPFile == null)
-			this.fJSPFile = ((StructuredTextEditor) getTextEditor()).getFileInEditor();
-		return this.fJSPFile;
-	}
-
-	private IJavaElement getJavaElement() {
-		IJavaElement[] elements = getJavaElementsForCurrentSelection();
-		return elements.length > 0 ? elements[0] : null;
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java
new file mode 100644
index 0000000..2eaeec0
--- /dev/null
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.jst.jsp.ui.internal.java.search;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesProcessor;
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionDelegate;
+
+/**
+ * Sets up FindOccurrencesActionDelegate for jsp find occurrences processors
+ */
+public class JSPFindOccurrencesActionDelegate extends FindOccurrencesActionDelegate {
+	private List fProcessors;
+
+	protected List getProcessors() {
+		if (fProcessors == null) {
+			fProcessors = new ArrayList();
+			HTMLFindOccurrencesProcessor htmlProcessor = new HTMLFindOccurrencesProcessor();
+			fProcessors.add(htmlProcessor);
+//			 temporary, workaround to disable function, since using the function 
+//			 can easily cause deadlock to occur.
+//					 See https://bugs.eclipse.org/bugs/show_bug.cgi?id=103662
+//			JSPFindOccurrencesProcessor jspProcessor = new JSPFindOccurrencesProcessor();
+//			fProcessors.add(jspProcessor);
+		}
+		return fProcessors;
+	}
+}
diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java
new file mode 100644
index 0000000..a8742cb
--- /dev/null
+++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.jst.jsp.ui.internal.java.search;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation;
+import org.eclipse.jst.jsp.core.internal.java.JSPTranslation;
+import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter;
+import org.eclipse.jst.jsp.core.internal.provisional.text.IJSPPartitionTypes;
+import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+
+/**
+ * Configures a FindOccurrencesProcessor with JSP partitions and regions
+ */
+public class JSPFindOccurrencesProcessor extends FindOccurrencesProcessor {
+
+	protected String[] getPartitionTypes() {
+		return new String[]{IJSPPartitionTypes.JSP_DEFAULT, IJSPPartitionTypes.JSP_CONTENT_JAVA};
+	}
+
+	protected String[] getRegionTypes() {
+		return new String[]{DOMRegionContext.BLOCK_TEXT, DOMJSPRegionContexts.JSP_CONTENT};
+	}
+
+	protected ISearchQuery getSearchQuery(IFile file, IStructuredDocument document, String regionText, String regionType, ITextSelection textSelection) {
+		return new JSPSearchQuery(file, getJavaElement(document, textSelection));
+	}
+
+	private IJavaElement getJavaElement(IDocument document, ITextSelection textSelection) {
+		IJavaElement[] elements = getJavaElementsForCurrentSelection(document, textSelection);
+		return elements.length > 0 ? elements[0] : null;
+	}
+
+	/**
+	 * uses JSPTranslation to get currently selected Java elements.
+	 * 
+	 * @return currently selected IJavaElements
+	 */
+	private IJavaElement[] getJavaElementsForCurrentSelection(IDocument document, ITextSelection selection) {
+		IJavaElement[] elements = new IJavaElement[0];
+		// get JSP translation object for this viewer's document
+		IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
+		try {
+			if (model != null && model instanceof IDOMModel) {
+				IDOMDocument xmlDoc = ((IDOMModel) model).getDocument();
+				JSPTranslationAdapter adapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class);
+				if (adapter != null) {
+					JSPTranslation translation = adapter.getJSPTranslation();
+
+					// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102211
+					elements = translation.getElementsFromJspRange(selection.getOffset(), selection.getOffset() + selection.getLength());
+				}
+			}
+		}
+		finally {
+			if (model != null)
+				model.releaseFromRead();
+		}
+		return elements;
+	}
+}
diff --git a/bundles/org.eclipse.wst.css.ui/plugin.properties b/bundles/org.eclipse.wst.css.ui/plugin.properties
index 09f29ff..337418b 100644
--- a/bundles/org.eclipse.wst.css.ui/plugin.properties
+++ b/bundles/org.eclipse.wst.css.ui/plugin.properties
@@ -31,5 +31,16 @@
 AddBookmark.label=Add Boo&kmark...
 AddBookmark.tooltip=Add Bookmark...
 ##
+CleanupDocument_label=Cleanup Document...
+CleanupDocument_tooltip=Cleanup Document
+StructureSelectEnclosing_label=Enclosing Element
+StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
+StructureSelectNext_label=Next Element
+StructureSelectNext_tooltip=Expand selection to include next sibling
+StructureSelectPrevious_label=Previous Element
+StructureSelectPrevious_tooltip=Expand selection to include previous sibling
+StructureSelectHistory_label=Restore Last Selection
+StructureSelectHistory_tooltip=Restore last selection
+##
 All_CSS_context_type_Extension_Element.name=All CSS
 CSS_New_context_type_Extension_Element.name=New CSS
diff --git a/bundles/org.eclipse.wst.css.ui/plugin.xml b/bundles/org.eclipse.wst.css.ui/plugin.xml
index 0110f76..f94c994 100644
--- a/bundles/org.eclipse.wst.css.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.css.ui/plugin.xml
@@ -7,7 +7,7 @@
 			name="%CSS_Source_Page_Editor.name"
 			icon="icons/full/obj16/sourceEditor.gif"
 			contributorClass="org.eclipse.wst.css.ui.internal.ActionContributorCSS"
-			class="org.eclipse.wst.css.ui.internal.StructuredTextEditorCSS"
+			class="org.eclipse.wst.sse.ui.StructuredTextEditor"
 			symbolicFontName="org.eclipse.wst.sse.ui.textfont"
 			id="org.eclipse.wst.css.core.csssource.source">
 			<contentTypeBinding
@@ -163,4 +163,52 @@
 			translations="$nl$/templates/cssdefault-templates.properties">
 		</include>
 	</extension>
+
+	<!-- CSS editor actions -->
+	<extension point="org.eclipse.ui.editorActions">
+		<editorContribution
+			id="org.eclipse.wst.css.core.csssource.source.editorActions"
+			targetID="org.eclipse.wst.css.core.csssource.source">
+			<action
+				id="CleanupDocument"
+				label="%CleanupDocument_label"
+				definitionId="org.eclipse.wst.sse.ui.cleanup.document"
+				tooltip="%CleanupDocument_tooltip"
+				class="org.eclipse.wst.css.ui.internal.edit.ui.CleanupActionCSSDelegate"
+				actionID="CleanupDocument">
+			</action>
+			<action
+				id="StructureSelectEnclosing"
+				label="%StructureSelectEnclosing_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing"
+				tooltip="%StructureSelectEnclosing_tooltip"
+				class="org.eclipse.wst.css.ui.internal.selection.StructuredSelectEnclosingCSSActionDelegate"
+				actionID="StructureSelectEnclosing">
+			</action>
+			<action
+				id="StructureSelectNext"
+				label="%StructureSelectNext_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.next"
+				tooltip="%StructureSelectNext_tooltip"
+				class="org.eclipse.wst.css.ui.internal.selection.StructuredSelectNextCSSActionDelegate"
+				actionID="StructureSelectNext">
+			</action>
+			<action
+				id="StructureSelectPrevious"
+				label="%StructureSelectPrevious_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.previous"
+				tooltip="%StructureSelectPrevious_tooltip"
+				class="org.eclipse.wst.css.ui.internal.selection.StructuredSelectPreviousCSSActionDelegate"
+				actionID="StructureSelectPrevious">
+			</action>
+			<action
+				id="StructureSelectHistory"
+				label="%StructureSelectHistory_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.last"
+				tooltip="%StructureSelectHistory_tooltip"
+				class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate"
+				actionID="StructureSelectHistory">
+			</action>
+		</editorContribution>
+	</extension>
 </plugin>
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/StructuredTextEditorCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/StructuredTextEditorCSS.java
deleted file mode 100644
index ae948fb..0000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/StructuredTextEditorCSS.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this
- * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.css.ui.internal.edit.ui.CleanupActionCSS;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.css.ui.internal.selection.StructureSelectEnclosingCSSAction;
-import org.eclipse.wst.css.ui.internal.selection.StructureSelectNextCSSAction;
-import org.eclipse.wst.css.ui.internal.selection.StructureSelectPreviousCSSAction;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.eclipse.wst.sse.ui.internal.selection.StructureSelectHistoryAction;
-
-public class StructuredTextEditorCSS extends StructuredTextEditor {
-	private static final String UNDERSCORE = "_"; //$NON-NLS-1$
-	
-	protected void createActions() {
-		super.createActions();
-
-		Action action = new CleanupActionCSS(CSSUIMessages.getResourceBundle(), StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT, action);
-
-		SelectionHistory selectionHistory = new SelectionHistory(this);
-		action = new StructureSelectEnclosingCSSAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_ENCLOSING);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_ENCLOSING, action);
-
-		action = new StructureSelectNextCSSAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_NEXT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_NEXT, action);
-
-		action = new StructureSelectPreviousCSSAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_PREVIOUS);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_PREVIOUS, action);
-
-		action = new StructureSelectHistoryAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_HISTORY);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_HISTORY, action);
-		selectionHistory.setHistoryAction((StructureSelectHistoryAction) action);
-	}
-
-	protected void initializeEditor() {
-		super.initializeEditor();
-		setHelpContextId(IHelpContextIds.CSS_SOURCEVIEW_HELPID);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSS.java
deleted file mode 100644
index 197f91e..0000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSS.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and
- * is available at http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal.edit.ui;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.core.internal.cleanup.CleanupProcessorCSS;
-import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
-import org.eclipse.wst.sse.ui.internal.actions.CleanupAction;
-
-public class CleanupActionCSS extends CleanupAction {
-	protected IStructuredCleanupProcessor fCleanupProcessor;
-
-	public CleanupActionCSS(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected Dialog getCleanupDialog(Shell shell) {
-		if (fCleanupDialog == null)
-			fCleanupDialog = new CleanupDialogCSS(shell);
-
-		return fCleanupDialog;
-	}
-
-	protected IStructuredCleanupProcessor getCleanupProcessor() {
-		if (fCleanupProcessor == null)
-			fCleanupProcessor = new CleanupProcessorCSS();
-
-		return fCleanupProcessor;
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java
new file mode 100644
index 0000000..3befdfe
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java
@@ -0,0 +1,124 @@
+package org.eclipse.wst.css.ui.internal.edit.ui;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.wst.css.core.internal.cleanup.CleanupProcessorCSS;
+import org.eclipse.wst.css.ui.internal.CSSUIMessages;
+import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
+
+/**
+ * Cleanup action delegate for CSS editor
+ */
+public class CleanupActionCSSDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+	private IStructuredCleanupProcessor fCleanupProcessor;
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
+
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+		fCleanupProcessor = null;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(CSSUIMessages.CleanupDocument_label);
+			action.setToolTipText(CSSUIMessages.CleanupDocument_tooltip);
+			action.setDescription(CSSUIMessages.CleanupDocument_description);
+		}
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void run(IAction action) {
+		if (fEditor instanceof StructuredTextEditor) {
+			final StructuredTextEditor editor = (StructuredTextEditor) fEditor;
+			Dialog cleanupDialog = new CleanupDialogCSS(editor.getSite().getShell());
+			if (cleanupDialog.open() == Window.OK) {
+				// setup runnable
+				Runnable runnable = new Runnable() {
+					public void run() {
+						IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
+						if (cleanupProcessor != null) {
+							IStructuredModel model = null;
+							try {
+								model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
+								if (model != null)
+									cleanupProcessor.cleanupModel(model);
+							}
+							finally {
+								if (model != null)
+									model.releaseFromEdit();
+							}
+						}
+					}
+				};
+
+				// TODO: make independent of 'model'.
+				IStructuredModel model = null;
+				try {
+					model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
+					if (model != null) {
+						// begin recording
+						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+						model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
+
+						// tell the model that we are about to make a big
+						// model change
+						model.aboutToChangeModel();
+
+						// run
+						BusyIndicator.showWhile(editor.getTextViewer().getControl().getDisplay(), runnable);
+					}
+				}
+				finally {
+					if (model != null) {
+						// tell the model that we are done with the big
+						// model
+						// change
+						model.changedModel();
+
+						// end recording
+						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+						model.endRecording(this, selection.getOffset(), selection.getLength());
+						model.releaseFromEdit();
+					}
+				}
+			}
+		}
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// do nothing
+	}
+
+	IStructuredCleanupProcessor getCleanupProcessor() {
+		if (fCleanupProcessor == null)
+			fCleanupProcessor = new CleanupProcessorCSS();
+
+		return fCleanupProcessor;
+	}
+}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java
deleted file mode 100644
index 0c4412e..0000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectCSSAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and
- * is available at http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.eclipse.wst.sse.ui.internal.selection.StructureSelectAction;
-
-public abstract class StructureSelectCSSAction extends StructureSelectAction {
-	public StructureSelectCSSAction(StructuredTextEditor editor, SelectionHistory history) {
-		super(editor, history);
-	}
-
-	public void run() {
-		Region currentRegion = new Region(fViewer.getSelectedRange().x, fViewer.getSelectedRange().y);
-		if (currentRegion.getLength() == fViewer.getDocument().getLength())
-			return;
-
-		IndexedRegion cursorIndexedRegion = getCursorIndexedRegion();
-		if (cursorIndexedRegion instanceof ICSSNode) {
-			ICSSNode cursorNode = (ICSSNode) cursorIndexedRegion;
-
-			Region cursorNodeRegion = new Region(cursorIndexedRegion.getStartOffset(), cursorIndexedRegion.getEndOffset() - cursorIndexedRegion.getStartOffset());
-
-			Region newRegion = null;
-			if (cursorNodeRegion.getOffset() >= currentRegion.getOffset() && cursorNodeRegion.getOffset() <= currentRegion.getOffset() + currentRegion.getLength() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentRegion.getOffset() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentRegion.getOffset() + currentRegion.getLength())
-				newRegion = getNewSelectionRegion(cursorNode, currentRegion);
-			else
-				newRegion = cursorNodeRegion;
-
-			if (newRegion != null) {
-				fHistory.remember(currentRegion);
-				try {
-					fHistory.ignoreSelectionChanges();
-					fEditor.selectAndReveal(newRegion.getOffset(), newRegion.getLength());
-				} finally {
-					fHistory.listenToSelectionChanges();
-				}
-			}
-		}
-	}
-
-	abstract protected Region getNewSelectionRegion(ICSSNode node, Region region);
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java
deleted file mode 100644
index c97c02f..0000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectEnclosingCSSAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and
- * is available at http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.w3c.dom.Node;
-
-public class StructureSelectEnclosingCSSAction extends StructureSelectCSSAction {
-	public StructureSelectEnclosingCSSAction(StructuredTextEditor editor, SelectionHistory history) {
-		super(editor, history);
-		setText(CSSUIMessages.StructureSelectEnclosing_label);
-		setToolTipText(CSSUIMessages.StructureSelectEnclosing_tooltip);
-		setDescription(CSSUIMessages.StructureSelectEnclosing_description);
-	}
-
-	protected IndexedRegion getCursorIndexedRegion() {
-		return getIndexedRegion(fViewer.getSelectedRange().x);
-	}
-
-	protected Region getNewSelectionRegion(Node node, Region region) {
-		return null;
-	}
-
-	protected Region getNewSelectionRegion(ICSSNode node, Region region) {
-		Region newRegion = null;
-
-		ICSSNode newNode = node.getParentNode();
-
-		if (newNode instanceof IndexedRegion) {
-			IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-			newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
-		}
-
-		return newRegion;
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java
deleted file mode 100644
index 9a012a7..0000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectNextCSSAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and
- * is available at http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.w3c.dom.Node;
-
-public class StructureSelectNextCSSAction extends StructureSelectCSSAction {
-	public StructureSelectNextCSSAction(StructuredTextEditor editor, SelectionHistory history) {
-		super(editor, history);
-		setText(CSSUIMessages.StructureSelectNext_label);
-		setToolTipText(CSSUIMessages.StructureSelectNext_tooltip);
-		setDescription(CSSUIMessages.StructureSelectNext_description);
-	}
-
-	protected IndexedRegion getCursorIndexedRegion() {
-		int offset = fViewer.getSelectedRange().x + fViewer.getSelectedRange().y - 1;
-
-		if (offset < 0)
-			offset = 0;
-
-		return getIndexedRegion(offset);
-	}
-
-	protected Region getNewSelectionRegion(Node node, Region region) {
-		return null;
-	}
-
-	protected Region getNewSelectionRegion(ICSSNode node, Region region) {
-		Region newRegion = null;
-
-		ICSSNode newNode = node.getNextSibling();
-		if (newNode == null) {
-			newNode = node.getParentNode();
-
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
-			}
-		} else {
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(region.getOffset(), newIndexedRegion.getEndOffset() - region.getOffset());
-			}
-		}
-
-		return newRegion;
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java
deleted file mode 100644
index e09775c..0000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructureSelectPreviousCSSAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and
- * is available at http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors: IBM Corporation - initial API and implementation
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.w3c.dom.Node;
-
-public class StructureSelectPreviousCSSAction extends StructureSelectCSSAction {
-	public StructureSelectPreviousCSSAction(StructuredTextEditor editor, SelectionHistory history) {
-		super(editor, history);
-		setText(CSSUIMessages.StructureSelectPrevious_label);
-		setToolTipText(CSSUIMessages.StructureSelectPrevious_tooltip);
-		setDescription(CSSUIMessages.StructureSelectPrevious_description);
-	}
-
-	protected IndexedRegion getCursorIndexedRegion() {
-		return getIndexedRegion(fViewer.getSelectedRange().x);
-	}
-
-	protected Region getNewSelectionRegion(Node node, Region region) {
-		return null;
-	}
-
-	protected Region getNewSelectionRegion(ICSSNode node, Region region) {
-		Region newRegion = null;
-
-		ICSSNode newNode = node.getPreviousSibling();
-		if (newNode == null) {
-			newNode = node.getParentNode();
-
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
-			}
-		} else {
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(newIndexedRegion.getStartOffset(), region.getOffset() + region.getLength() - newIndexedRegion.getStartOffset());
-			}
-		}
-
-		return newRegion;
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java
new file mode 100644
index 0000000..fa1a720
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.eclipse.wst.css.ui.internal.CSSUIMessages;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
+
+/**
+ * Selects enclosing CSS element
+ */
+public class StructuredSelectEnclosingCSSActionDelegate extends StructuredSelectActionDelegate {
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(CSSUIMessages.StructureSelectEnclosing_label);
+			action.setToolTipText(CSSUIMessages.StructureSelectEnclosing_tooltip);
+			action.setDescription(CSSUIMessages.StructureSelectEnclosing_description);
+		}
+	}
+
+	protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
+		IndexedRegion indexedRegion = null;
+
+		indexedRegion = getIndexedRegion(document, textSelection.getOffset());
+
+		return indexedRegion;
+	}
+
+	protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
+		Region newRegion = null;
+		if (indexedRegion instanceof ICSSNode) {
+			ICSSNode cursorNode = (ICSSNode) indexedRegion;
+			Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
+			int currentOffset = textSelection.getOffset();
+			int currentEndOffset = currentOffset + textSelection.getLength();
+			if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
+				ICSSNode newNode = cursorNode.getParentNode();
+
+				if (newNode instanceof IndexedRegion) {
+					IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+					newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+				}
+			}
+			else
+				newRegion = cursorNodeRegion;
+		}
+		return newRegion;
+	}
+}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java
new file mode 100644
index 0000000..7f2d69e
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.eclipse.wst.css.ui.internal.CSSUIMessages;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
+
+/**
+ * Selects next CSS element
+ */
+public class StructuredSelectNextCSSActionDelegate extends StructuredSelectActionDelegate {
+
+	protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
+		int offset = textSelection.getOffset() + textSelection.getLength();
+		if (offset < 0)
+			offset = 0;
+
+		IndexedRegion indexedRegion = null;
+
+		indexedRegion = getIndexedRegion(document, offset);
+
+		return indexedRegion;
+	}
+
+	protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
+		Region newRegion = null;
+
+		if (indexedRegion instanceof ICSSNode) {
+			ICSSNode cursorNode = (ICSSNode) indexedRegion;
+
+			Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
+			int currentOffset = textSelection.getOffset();
+			int currentEndOffset = currentOffset + textSelection.getLength();
+			if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
+				ICSSNode newNode = cursorNode.getNextSibling();
+				if (newNode == null) {
+					newNode = cursorNode.getParentNode();
+
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+					}
+				}
+				else {
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(currentOffset, newIndexedRegion.getEndOffset() - currentOffset);
+					}
+				}
+			}
+			else
+				newRegion = cursorNodeRegion;
+		}
+		return newRegion;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(CSSUIMessages.StructureSelectNext_label);
+			action.setToolTipText(CSSUIMessages.StructureSelectNext_tooltip);
+			action.setDescription(CSSUIMessages.StructureSelectNext_description);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java
new file mode 100644
index 0000000..78289a2
--- /dev/null
+++ b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.css.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
+import org.eclipse.wst.css.ui.internal.CSSUIMessages;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
+
+/**
+ * Selects previous CSS element
+ */
+public class StructuredSelectPreviousCSSActionDelegate extends StructuredSelectActionDelegate {
+
+	protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
+		IndexedRegion indexedRegion = null;
+
+		indexedRegion = getIndexedRegion(document, textSelection.getOffset());
+
+		return indexedRegion;
+	}
+
+	protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
+		Region newRegion = null;
+		if (indexedRegion instanceof ICSSNode) {
+			ICSSNode cursorNode = (ICSSNode) indexedRegion;
+
+			Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
+			int currentOffset = textSelection.getOffset();
+			int currentEndOffset = currentOffset + textSelection.getLength();
+			if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
+				ICSSNode newNode = cursorNode.getPreviousSibling();
+				if (newNode == null) {
+					newNode = cursorNode.getParentNode();
+
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+					}
+				}
+				else {
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(newIndexedRegion.getStartOffset(), currentEndOffset - newIndexedRegion.getStartOffset());
+					}
+				}
+			}
+			else
+				newRegion = cursorNodeRegion;
+		}
+		return newRegion;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(CSSUIMessages.StructureSelectPrevious_label);
+			action.setToolTipText(CSSUIMessages.StructureSelectPrevious_tooltip);
+			action.setDescription(CSSUIMessages.StructureSelectPrevious_description);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.html.ui/plugin.properties b/bundles/org.eclipse.wst.html.ui/plugin.properties
index a62d575..7a3747a 100644
--- a/bundles/org.eclipse.wst.html.ui/plugin.properties
+++ b/bundles/org.eclipse.wst.html.ui/plugin.properties
@@ -32,4 +32,22 @@
 AddTask.label=Add &Task...
 AddTask.tooltip=Add Task...
 AddBookmark.label=Add Boo&kmark...
-AddBookmark.tooltip=Add Bookmark...
\ No newline at end of file
+AddBookmark.tooltip=Add Bookmark...
+##
+CleanupDocument_label=Cleanup Document...
+CleanupDocument_tooltip=Cleanup Document
+ToggleComment_label=Toggle Comment
+ToggleComment_tooltip=Toggle Comment
+AddBlockComment_label=Add Block Comment
+AddBlockComment_tooltip=Add Block Comment
+RemoveBlockComment_label=Remove Block Comment
+RemoveBlockComment_tooltip=Remove Block Comment
+FindOccurrences_label=Occurrences in File
+StructureSelectEnclosing_label=Enclosing Element
+StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
+StructureSelectNext_label=Next Element
+StructureSelectNext_tooltip=Expand selection to include next sibling
+StructureSelectPrevious_label=Previous Element
+StructureSelectPrevious_tooltip=Expand selection to include previous sibling
+StructureSelectHistory_label=Restore Last Selection
+StructureSelectHistory_tooltip=Restore last selection
diff --git a/bundles/org.eclipse.wst.html.ui/plugin.xml b/bundles/org.eclipse.wst.html.ui/plugin.xml
index 7d37429..c1ffab9 100644
--- a/bundles/org.eclipse.wst.html.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.html.ui/plugin.xml
@@ -12,7 +12,7 @@
 			icon="icons/full/obj16/sourceEditor.gif"
 			default="true"
 			contributorClass="org.eclipse.wst.html.ui.internal.edit.ui.ActionContributorHTML"
-			class="org.eclipse.wst.html.ui.internal.provisional.StructuredTextEditorHTML"
+			class="org.eclipse.wst.sse.ui.StructuredTextEditor"
 			symbolicFontName="org.eclipse.wst.sse.ui.textfont"
 			id="org.eclipse.wst.html.core.htmlsource.source">
 			<contentTypeBinding
@@ -389,4 +389,82 @@
 			</action>
 		</viewerContribution>
 	</extension>
+	
+	<extension point="org.eclipse.ui.editorActions">
+		<editorContribution
+			id="org.eclipse.wst.html.core.htmlsource.source.editorActions"
+			targetID="org.eclipse.wst.html.core.htmlsource.source">
+			<action
+				id="CleanupDocument"
+				label="%CleanupDocument_label"
+				definitionId="org.eclipse.wst.sse.ui.cleanup.document"
+				tooltip="%CleanupDocument_tooltip"
+				class="org.eclipse.wst.html.ui.internal.edit.ui.CleanupActionHTMLDelegate"
+				actionID="CleanupDocument">
+			</action>
+			<action
+				id="ToggleComment"
+				label="%ToggleComment_label"
+				definitionId="org.eclipse.wst.sse.ui.toggle.comment"
+				tooltip="%ToggleComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXMLDelegate"
+				actionID="ToggleComment">
+			</action>
+			<action
+				id="AddBlockComment"
+				label="%AddBlockComment_label"
+				definitionId="org.eclipse.wst.sse.ui.add.block.comment"
+				tooltip="%AddBlockComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXMLDelegate"
+				actionID="AddBlockComment">
+			</action>
+			<action
+				id="RemoveBlockComment"
+				label="%RemoveBlockComment_label"
+				definitionId="org.eclipse.wst.sse.ui.remove.block.comment"
+				tooltip="%RemoveBlockComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXMLDelegate"
+				actionID="RemoveBlockComment">
+			</action>
+			<action
+				id="FindOccurrences"
+				label="%FindOccurrences_label"
+				definitionId="org.eclipse.wst.sse.ui.search.find.occurrences"
+				class="org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesActionDelegate"
+				actionID="FindOccurrences">
+			</action>
+			<action
+				id="StructureSelectEnclosing"
+				label="%StructureSelectEnclosing_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing"
+				tooltip="%StructureSelectEnclosing_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectEnclosingXMLActionDelegate"
+				actionID="StructureSelectEnclosing">
+			</action>
+			<action
+				id="StructureSelectNext"
+				label="%StructureSelectNext_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.next"
+				tooltip="%StructureSelectNext_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectNextXMLActionDelegate"
+				actionID="StructureSelectNext">
+			</action>
+			<action
+				id="StructureSelectPrevious"
+				label="%StructureSelectPrevious_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.previous"
+				tooltip="%StructureSelectPrevious_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectPreviousXMLActionDelegate"
+				actionID="StructureSelectPrevious">
+			</action>
+			<action
+				id="StructureSelectHistory"
+				label="%StructureSelectHistory_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.last"
+				tooltip="%StructureSelectHistory_tooltip"
+				class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate"
+				actionID="StructureSelectHistory">
+			</action>
+		</editorContribution>
+	</extension>
 </plugin>
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties
index 0853392..efddd5d 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/HTMLUIPluginResources.properties
@@ -30,19 +30,19 @@
 Creating_files_encoding=Creating files encoding preference
 MESSAGE_HTML_VALIDATION_MESSAGE_UI_=HTML Syntax : {0}
 # Copied from sse.ui
-CleanupDocument_label=C&leanup Document...
+CleanupDocument_label=Cleanup Document...
 CleanupDocument_tooltip=Cleanup Document
 CleanupDocument_description=Cleanup Document
-ToggleComment_label=Togg&le Comment
+ToggleComment_label=Toggle Comment
 ToggleComment_tooltip=Toggle Comment
 ToggleComment_description=Toggle Comment
-AddBlockComment_label=Add &Block Comment
+AddBlockComment_label=Add Block Comment
 AddBlockComment_tooltip=Add Block Comment
 AddBlockComment_description=Add Block Comment
-RemoveBlockComment_label=Remove Bloc&k Comment
+RemoveBlockComment_label=Remove Block Comment
 RemoveBlockComment_tooltip=Remove Block Comment
 RemoveBlockComment_description=Remove Block Comment
-FindOccurrences_label=O&ccurrences in File
+FindOccurrences_label=Occurrences in File
 Creating_files=Creating files
 Encoding_desc=The following encoding will apply:
 Preferred_markup_case_UI_=Preferred markup case for content assist, and code generation
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTML.java
deleted file mode 100644
index 1e4f233..0000000
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTML.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.html.ui.internal.edit.ui;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.html.core.internal.cleanup.HTMLCleanupProcessorImpl;
-import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
-import org.eclipse.wst.sse.ui.internal.actions.CleanupAction;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-
-public class CleanupActionHTML extends CleanupAction {
-	protected IStructuredCleanupProcessor fCleanupProcessor;
-
-	public CleanupActionHTML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected Dialog getCleanupDialog(Shell shell) {
-		if (fCleanupDialog == null) {
-			fCleanupDialog = new CleanupDialogHTML(shell);
-		}
-		
-		((CleanupDialogHTML)fCleanupDialog).setisXHTMLType(isXHTML());
-		return fCleanupDialog;
-	}
-
-	protected IStructuredCleanupProcessor getCleanupProcessor() {
-		if (fCleanupProcessor == null)
-			fCleanupProcessor = new HTMLCleanupProcessorImpl();
-
-		return fCleanupProcessor;
-	}
-	
-	private boolean isXHTML() {
-		boolean isxhtml = false;
-		ITextEditor textEditor = getTextEditor();
-		if (textEditor != null) {
-			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
-			IStructuredModel model = null;
-			try {
-				model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
-				if (model instanceof IDOMModel) {
-					IDOMDocument domDocument = ((IDOMModel)model).getDocument();
-					if (domDocument != null)
-						isxhtml = domDocument.isXMLType();
-				}
-			} finally {
-				if (model != null) {
-					model.releaseFromRead();
-				}
-			}
-		}
-		return isxhtml;
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTMLDelegate.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTMLDelegate.java
new file mode 100644
index 0000000..4f259b8
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/edit/ui/CleanupActionHTMLDelegate.java
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.html.ui.internal.edit.ui;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.html.core.internal.cleanup.HTMLCleanupProcessorImpl;
+import org.eclipse.wst.html.ui.internal.HTMLUIMessages;
+import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+
+/**
+ * Cleanup action delegate for HTML editor
+ */
+public class CleanupActionHTMLDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+	private IStructuredCleanupProcessor fCleanupProcessor;
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
+
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+		fCleanupProcessor = null;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(HTMLUIMessages.CleanupDocument_label);
+			action.setToolTipText(HTMLUIMessages.CleanupDocument_tooltip);
+			action.setDescription(HTMLUIMessages.CleanupDocument_description);
+		}
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void run(IAction action) {
+		if (fEditor instanceof StructuredTextEditor) {
+			final StructuredTextEditor editor = (StructuredTextEditor) fEditor;
+			CleanupDialogHTML cleanupDialog = new CleanupDialogHTML(editor.getSite().getShell());
+			cleanupDialog.setisXHTMLType(isXHTML());
+			if (cleanupDialog.open() == Window.OK) {
+				// setup runnable
+				Runnable runnable = new Runnable() {
+					public void run() {
+						IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
+						if (cleanupProcessor != null) {
+							IStructuredModel model = null;
+							try {
+								model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
+								if (model != null)
+									cleanupProcessor.cleanupModel(model);
+							}
+							finally {
+								if (model != null)
+									model.releaseFromEdit();
+							}
+						}
+					}
+				};
+
+				// TODO: make independent of 'model'.
+				IStructuredModel model = null;
+				try {
+					model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
+					if (model != null) {
+						// begin recording
+						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+						model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
+
+						// tell the model that we are about to make a big
+						// model change
+						model.aboutToChangeModel();
+
+						// run
+						BusyIndicator.showWhile(editor.getTextViewer().getControl().getDisplay(), runnable);
+					}
+				}
+				finally {
+					if (model != null) {
+						// tell the model that we are done with the big
+						// model
+						// change
+						model.changedModel();
+
+						// end recording
+						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+						model.endRecording(this, selection.getOffset(), selection.getLength());
+						model.releaseFromEdit();
+					}
+				}
+			}
+		}
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// do nothing
+	}
+
+	IStructuredCleanupProcessor getCleanupProcessor() {
+		if (fCleanupProcessor == null)
+			fCleanupProcessor = new HTMLCleanupProcessorImpl();
+
+		return fCleanupProcessor;
+	}
+
+	private boolean isXHTML() {
+		boolean isxhtml = false;
+		if (fEditor instanceof ITextEditor) {
+			ITextEditor textEditor = (ITextEditor) fEditor;
+			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
+			IStructuredModel model = null;
+			try {
+				model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
+				if (model instanceof IDOMModel) {
+					IDOMDocument domDocument = ((IDOMModel) model).getDocument();
+					if (domDocument != null)
+						isxhtml = domDocument.isXMLType();
+				}
+			}
+			finally {
+				if (model != null) {
+					model.releaseFromRead();
+				}
+			}
+		}
+		return isxhtml;
+	}
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/provisional/StructuredTextEditorHTML.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/provisional/StructuredTextEditorHTML.java
deleted file mode 100644
index 045adf4..0000000
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/provisional/StructuredTextEditorHTML.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.html.ui.internal.provisional;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.html.ui.internal.HTMLUIMessages;
-import org.eclipse.wst.html.ui.internal.edit.ui.CleanupActionHTML;
-import org.eclipse.wst.html.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesAction;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionProvider;
-import org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXML;
-
-public class StructuredTextEditorHTML extends StructuredTextEditor {
-	private final static String UNDERSCORE = "_"; //$NON-NLS-1$
-	
-	protected void createActions() {
-		super.createActions();
-
-		ResourceBundle resourceBundle = HTMLUIMessages.getResourceBundle();
-
-		Action action = new CleanupActionHTML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT, action);
-
-		action = new ToggleCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.TOGGLE_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT, action);
-
-		action = new AddBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.ADD_BLOCK_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT, action);
-
-		action = new RemoveBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.REMOVE_BLOCK_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT, action);
-		
-		FindOccurrencesActionProvider foAction = new FindOccurrencesActionProvider(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES + UNDERSCORE, this);
-		foAction.addAction(new HTMLFindOccurrencesAction(resourceBundle, "", this)); //$NON-NLS-1$
-		foAction.setActionDefinitionId(ActionDefinitionIds.FIND_OCCURRENCES);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, foAction);
-		markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, true);
-	}
-	protected void initializeEditor() {
-		super.initializeEditor();
-		setHelpContextId(IHelpContextIds.HTML_SOURCEVIEW_HELPID);
-	}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesActionDelegate.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesActionDelegate.java
new file mode 100644
index 0000000..23c2c49
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesActionDelegate.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.html.ui.internal.search;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionDelegate;
+
+/**
+ * Sets up FindOccurrencesActionDelegate for html find occurrences processors
+ */
+public class HTMLFindOccurrencesActionDelegate extends FindOccurrencesActionDelegate {
+	private List fProcessors;
+
+	protected List getProcessors() {
+		if (fProcessors == null) {
+			fProcessors = new ArrayList();
+			HTMLFindOccurrencesProcessor htmlProcessor = new HTMLFindOccurrencesProcessor();
+			fProcessors.add(htmlProcessor);
+		}
+		return fProcessors;
+	}
+}
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesProcessor.java
similarity index 62%
rename from bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java
rename to bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesProcessor.java
index 62bfb88..4a3e740 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesAction.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/search/HTMLFindOccurrencesProcessor.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * Copyright (c) 2005 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,37 +7,26 @@
  * 
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     
  *******************************************************************************/
+
 package org.eclipse.wst.html.ui.internal.search;
 
-import java.util.ResourceBundle;
-
-import org.eclipse.ui.texteditor.ITextEditor;
 import org.eclipse.wst.html.core.internal.provisional.text.IHTMLPartitionTypes;
-import org.eclipse.wst.sse.ui.internal.search.BasicFindOccurrencesAction;
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor;
 import org.eclipse.wst.xml.core.internal.provisional.text.IXMLPartitions;
 import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
 
-
 /**
- * Configures a BasicFindOccurrencesAction with HTML partitions and regions
- * 
- * @author pavery
+ * Configures a FindOccurrencesProcessor with HTML partitions and regions
  */
-public class HTMLFindOccurrencesAction extends BasicFindOccurrencesAction {
+public class HTMLFindOccurrencesProcessor extends FindOccurrencesProcessor {
 
-	public HTMLFindOccurrencesAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	public String[] getPartitionTypes() {
-
+	protected String[] getPartitionTypes() {
 		return new String[]{IHTMLPartitionTypes.HTML_DEFAULT, IXMLPartitions.XML_DEFAULT};
 	}
 
-	public String[] getRegionTypes() {
-
+	protected String[] getRegionTypes() {
 		return new String[]{DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE};
 	}
-
-}
\ No newline at end of file
+}
diff --git a/bundles/org.eclipse.wst.sse.ui/plugin.xml b/bundles/org.eclipse.wst.sse.ui/plugin.xml
index 7921a6e..f8c0b89 100644
--- a/bundles/org.eclipse.wst.sse.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.sse.ui/plugin.xml
@@ -112,185 +112,188 @@
 		<extension-point id="dragSourceTransfers" name="Drag Source Transfers"/>
 	-->
 	<extension point="org.eclipse.ui.commands">
-		<scope
-			name="%scope.structuredTextEditor.name"
-			parent="org.eclipse.ui.textEditorScope"
-			description="%scope.structuredTextEditor.description"
-			id="org.eclipse.wst.sse.ui.structuredTextEditorScope">
-		</scope>
-		<!--    dmw 6/6 (and 11/10 :) removed from 'scope'  parentId="org.eclipse.ui.textEditorScope" -->
-		<!-- afw 11/11 added scope back in because these are keybindings for structuredtexteditors only -->
-
 		<!-- Edit commands -->
 		<command
 			name="%ActionDefinition.selectEnclosing.name"
 			description="%ActionDefinition.selectEnclosing.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.structure.select.enclosing">
 		</command>
 		<command
 			name="%ActionDefinition.selectNext.name"
 			description="%ActionDefinition.selectNext.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.structure.select.next">
 		</command>
 		<command
 			name="%ActionDefinition.selectPrevious.name"
 			description="%ActionDefinition.selectPrevious.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.structure.select.previous">
 		</command>
 		<command
 			name="%ActionDefinition.selectLast.name"
 			description="%ActionDefinition.selectLast.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.structure.select.last">
 		</command>
 		<command
 			name="%ActionDefinition.showJavadoc.name"
 			description="%ActionDefinition.showJavadoc.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.show.javadoc">
 		</command>
 		<command
 			name="%ActionDefinition.quickFix.name"
 			description="%ActionDefinition.quickFix.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.edit.text.java.correction.assist.proposals">
 		</command>
 		<!-- Source commands -->
 		<command
 			name="%command.toggle.comment.name"
 			description="%command.toggle.comment.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.toggle.comment">
 		</command>
 		<command
 			name="%command.add.block.comment.name"
 			description="%command.add.block.comment.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.add.block.comment">
 		</command>
 		<command
 			name="%command.remove.block.comment.name"
 			description="%command.remove.block.comment.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.remove.block.comment">
 		</command>
 		<command
 			name="%command.cleanup.document.name"
 			description="%command.cleanup.document.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.cleanup.document">
 		</command>
 		<command
 			name="%command.format.document.name"
 			description="%command.format.document.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.format.document">
 		</command>
 		<command
 			name="%command.format.active.elements.name"
 			description="%command.format.active.elements.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.format.active.elements">
 		</command>
 		<!-- Navigate commands -->
 		<command
 			name="%command.open.file.from.source.name"
 			description="%command.open.file.from.source.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.open.file.from.source">
 		</command>
 		<!-- Find Occurrences -->
 		<command
 			name="%command.search.find.occurrences.name"
 			description="%command.search.find.occurrences.description"
-			category="org.eclipse.ui.category.edit"
+			categoryId="org.eclipse.ui.category.edit"
 			id="org.eclipse.wst.sse.ui.search.find.occurrences">
 		</command>
+	</extension>
+	<!-- Keybinding scope for source editor -->
+	<extension point="org.eclipse.ui.contexts">
+		<context
+			name="%scope.structuredTextEditor.name"
+			parentId="org.eclipse.ui.textEditorScope"
+			description="%scope.structuredTextEditor.description"
+			id="org.eclipse.wst.sse.ui.structuredTextEditorScope">
+		</context>
+	</extension>
+	<!-- Keybindings for source editor -->
+	<extension point="org.eclipse.ui.bindings">
 		<!-- Edit commands -->
-		<keyBinding
-			string="Alt+Shift+ARROW_UP"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.structure.select.enclosing"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Alt+Shift+ARROW_RIGHT"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.structure.select.next"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Alt+Shift+ARROW_LEFT"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.structure.select.previous"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Alt+Shift+ARROW_DOWN"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.structure.select.last"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="F2"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.show.javadoc"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Ctrl+1"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.edit.text.java.correction.assist.proposals"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
+		<key
+			sequence="Alt+Shift+ARROW_UP"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.structure.select.enclosing"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Alt+Shift+ARROW_RIGHT"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.structure.select.next"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Alt+Shift+ARROW_LEFT"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.structure.select.previous"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Alt+Shift+ARROW_DOWN"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.structure.select.last"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="F2"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.show.javadoc"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Ctrl+1"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.edit.text.java.correction.assist.proposals"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
 		<!-- Source commands -->
-		<keyBinding
-			string="Ctrl+Shift+C"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.toggle.comment"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Ctrl+Shift+/"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.add.block.comment"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Ctrl+Shift+\"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.remove.block.comment"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Ctrl+Shift+F"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.format.document"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
-		<keyBinding
-			string="Ctrl+I"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.format.active.elements"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
+		<key
+			sequence="Ctrl+Shift+C"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.toggle.comment"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Ctrl+Shift+/"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.add.block.comment"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Ctrl+Shift+\"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.remove.block.comment"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Ctrl+Shift+F"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.format.document"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
+		<key
+			sequence="Ctrl+I"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.format.active.elements"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
 		<!-- Navigate commands -->
-		<keyBinding
-			string="F3"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.open.file.from.source"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
+		<key
+			sequence="F3"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.open.file.from.source"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
 		<!-- Find Occurrences -->
-		<keyBinding
-			string="Ctrl+Shift+A"
-			scope="org.eclipse.wst.sse.ui.structuredTextEditorScope"
-			command="org.eclipse.wst.sse.ui.search.find.occurrences"
-			configuration="org.eclipse.ui.defaultAcceleratorConfiguration">
-		</keyBinding>
+		<key
+			sequence="Ctrl+Shift+A"
+			contextId="org.eclipse.wst.sse.ui.structuredTextEditorScope"
+			commandId="org.eclipse.wst.sse.ui.search.find.occurrences"
+			schemeId="org.eclipse.ui.defaultAcceleratorConfiguration">
+		</key>
 	</extension>
 	<!-- Font and colors contributions -->
 	<extension point="org.eclipse.ui.themes">
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
index 84d7294..066a810 100644
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java
@@ -185,10 +185,6 @@
 import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
 import org.eclipse.wst.sse.ui.internal.provisional.extensions.breakpoint.NullSourceEditingTextTools;
 import org.eclipse.wst.sse.ui.internal.selection.SelectionHistory;
-import org.eclipse.wst.sse.ui.internal.selection.StructureSelectEnclosingAction;
-import org.eclipse.wst.sse.ui.internal.selection.StructureSelectHistoryAction;
-import org.eclipse.wst.sse.ui.internal.selection.StructureSelectNextAction;
-import org.eclipse.wst.sse.ui.internal.selection.StructureSelectPreviousAction;
 import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher;
 import org.eclipse.wst.sse.ui.internal.util.Assert;
 import org.eclipse.wst.sse.ui.internal.view.events.INodeSelectionListener;
@@ -861,7 +857,8 @@
 	/** The text context menu manager to be disposed. */
 	private MenuManager fTextContextMenuManager;
 	private String fViewerConfigurationTargetId;
-
+	/** The selection history of the editor */
+	private SelectionHistory fSelectionHistory;
 	private boolean fUpdateMenuTextPending;
 	int hoverX = -1;
 	int hoverY = -1;
@@ -1201,24 +1198,6 @@
 		setAction(StructuredTextEditorActionConstants.ACTION_NAME_OPEN_FILE, action);
 
 		fShowPropertiesAction = new ShowPropertiesAction();
-
-		SelectionHistory selectionHistory = new SelectionHistory(this);
-		action = new StructureSelectEnclosingAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_ENCLOSING);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_ENCLOSING, action);
-
-		action = new StructureSelectNextAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_NEXT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_NEXT, action);
-
-		action = new StructureSelectPreviousAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_PREVIOUS);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_PREVIOUS, action);
-
-		action = new StructureSelectHistoryAction(this, selectionHistory);
-		action.setActionDefinitionId(ActionDefinitionIds.STRUCTURE_SELECT_HISTORY);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_STRUCTURE_SELECT_HISTORY, action);
-		selectionHistory.setHistoryAction((StructureSelectHistoryAction) action);
 	}
 
 	protected LineChangeHover createChangeHover() {
@@ -1448,6 +1427,12 @@
 			System.out.println("Average time per call: " + (adapterTime / adapterRequests)); //$NON-NLS-1$
 		}
 
+//		 dispose of selection history
+		if (fSelectionHistory != null) {
+			fSelectionHistory.dispose();
+			fSelectionHistory = null;
+		}
+
 		// dispose of document folding support
 		if (fProjectionModelUpdater != null) {
 			fProjectionModelUpdater.uninstall();
@@ -1795,6 +1780,11 @@
 		else if (IShowInTargetList.class.equals(required)) {
 			return new ShowInTargetListAdapter();
 		}
+		else if (SelectionHistory.class.equals(required)) {
+			if (fSelectionHistory == null)
+				fSelectionHistory = new SelectionHistory(this);
+			return fSelectionHistory;
+		}
 		else {
 			if (result == null && getInternalModel() != null) {
 				result = getInternalModel().getAdapter(required);
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/StructuredTextEditor.java
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicFindOccurrencesAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicFindOccurrencesAction.java
deleted file mode 100644
index f78d008..0000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/BasicFindOccurrencesAction.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.search.ui.ISearchQuery;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-
-
-/**
- * <p>
- * Finds occurrences of a specified region type w/ region text in an
- * IStructuredDocument. Clients must implement getPartitionTypes() and
- * getRegionTypes() to indicate which partition types and region types it can
- * operate on.
- * </p>
- * 
- * <p>
- * Clients should override <code>getSearchQuery()</code> in order to provide
- * their own type of "search" (eg. searching for XML start tags, searching for
- * Java elements, etc...)
- * </p>
- * 
- * @author pavery
- */
-public class BasicFindOccurrencesAction extends TextEditorAction {
-	private IStructuredDocument fDocument = null;
-
-	private IFile fFile = null;
-	private String fMatchRegionType = null;
-	private String fMatchText = null;
-
-	public BasicFindOccurrencesAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	/**
-	 * @param editor
-	 * @param sdRegion
-	 * @param r
-	 * @param type
-	 */
-	private void configure(StructuredTextEditor editor, IStructuredDocumentRegion sdRegion, ITextRegion r, String type) {
-
-		this.fFile = editor.getFileInEditor();
-		this.fDocument = (IStructuredDocument) editor.getDocumentProvider().getDocument(editor.getEditorInput());
-		this.fMatchText = sdRegion.getText(r);
-		this.fMatchRegionType = type;
-	}
-
-	/**
-	 * @param partitionType
-	 * @return <code>true</code> if this action can operate on this type of
-	 *         partition, otherwise <code>false</code>.
-	 */
-	public boolean enabledForParitition(String partitionType) {
-
-		String[] accept = getPartitionTypes();
-		for (int i = 0; i < accept.length; i++) {
-			if (partitionType.equals(accept[i]))
-				return true;
-		}
-		return false;
-	}
-
-	/**
-	 * @param regionType
-	 * @return <code>true</code> if this action can operate on this region
-	 *         type (ITextRegion), otherwise false.
-	 */
-	public boolean enabledForRegionType(String regionType) {
-
-		String[] accept = getRegionTypes();
-		for (int i = 0; i < accept.length; i++) {
-			if (regionType.equals(accept[i]))
-				return true;
-		}
-		return false;
-	}
-
-	/**
-	 * Clients should override this to enable find occurrences on certain
-	 * partition(s).
-	 */
-	protected String[] getPartitionTypes() {
-		return new String[0];
-	}
-
-	/**
-	 * Clients should override this to enable find occurrences on different
-	 * region type(s).
-	 */
-	protected String[] getRegionTypes() {
-		return new String[0];
-	}
-
-	/**
-	 * Clients should override to provide their own search for the file.
-	 * 
-	 */
-	public ISearchQuery getSearchQuery() {
-		return new OccurrencesSearchQuery(this.fFile, this.fDocument, this.fMatchText, this.fMatchRegionType);
-	}
-
-	public void run() {
-
-		if (this.fDocument != null && this.fMatchText != null && this.fMatchRegionType != null)
-			NewSearchUI.runQuery(getSearchQuery());
-
-		unconfigure();
-	}
-
-	private void unconfigure() {
-
-		this.fFile = null;
-		this.fDocument = null;
-	}
-
-	/**
-	 * Enables and initialzies the action, or disables.
-	 * 
-	 * @see org.eclipse.ui.texteditor.TextEditorAction#update()
-	 */
-	public void update() {
-
-		super.update();
-
-		// determine if action should be enabled or not
-		ITextEditor editor = getTextEditor();
-		ISelection selection = editor.getSelectionProvider().getSelection();
-		if (selection instanceof ITextSelection) {
-			ITextSelection textSelection = (ITextSelection) selection;
-			IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
-			if (document instanceof IStructuredDocument) {
-				IStructuredDocumentRegion sdRegion = ((IStructuredDocument) document).getRegionAtCharacterOffset(textSelection.getOffset());
-				if (sdRegion != null) {
-					ITextRegion r = sdRegion.getRegionAtCharacterOffset(textSelection.getOffset());
-					if (r != null) {
-						String type = r.getType();
-						if (enabledForRegionType(type) && editor instanceof StructuredTextEditor) {
-							configure((StructuredTextEditor) editor, sdRegion, r, type);
-							setEnabled(true);
-						}
-						else {
-							unconfigure();
-							setEnabled(false);
-						}
-					}
-				}
-			}
-		}
-	}
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java
new file mode 100644
index 0000000..f8bb41c
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionDelegate.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.sse.ui.internal.search;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITypedRegion;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
+import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
+
+/**
+ * Performs the appropriate FindOccurrencesProcessor action call based on
+ * selection. Clients can add processors for different partitions via
+ * <code>getProcessors</code>
+ * 
+ */
+abstract public class FindOccurrencesActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
+
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(SSEUIMessages.FindOccurrences_label);
+		}
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void run(IAction action) {
+		boolean okay = false;
+		if (fEditor instanceof ITextEditor) {
+			ITextEditor textEditor = (ITextEditor) fEditor;
+			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
+			if (document != null) {
+				ITextSelection textSelection = getTextSelection(textEditor);
+				FindOccurrencesProcessor findOccurrenceProcessor = getProcessorForCurrentSelection(document, textSelection);
+				if (findOccurrenceProcessor != null) {
+					if (textEditor.getEditorInput() instanceof IFileEditorInput) {
+						IFile file = ((IFileEditorInput) textEditor.getEditorInput()).getFile();
+						okay = findOccurrenceProcessor.findOccurrences(document, textSelection, file);
+					}
+				}
+			}
+		}
+		if (okay) {
+			// clear status message
+			PlatformStatusLineUtil.clearStatusLine();
+		}
+		else {
+			String errorMessage = SSEUIMessages.FindOccurrencesActionProvider_0; //$NON-NLS-1$
+			PlatformStatusLineUtil.displayErrorMessage(errorMessage);
+			PlatformStatusLineUtil.addOneTimeClearListener();
+		}
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// clear status message
+		PlatformStatusLineUtil.clearStatusLine();
+	}
+
+	/**
+	 * Get the appropriate find occurrences processor
+	 * 
+	 * @param document -
+	 *            assumes not null
+	 * @param textSelection
+	 * @return
+	 */
+	private FindOccurrencesProcessor getProcessorForCurrentSelection(IDocument document, ITextSelection textSelection) {
+		// check if we have an action that's enabled on the current partition
+		ITypedRegion tr = getPartition(document, textSelection);
+		String partition = tr != null ? tr.getType() : ""; //$NON-NLS-1$
+
+		Iterator it = getProcessors().iterator();
+		FindOccurrencesProcessor action = null;
+		while (it.hasNext()) {
+			action = (FindOccurrencesProcessor) it.next();
+			// we just choose the first action that can handle the partition
+			if (action.enabledForParitition(partition))
+				return action;
+		}
+		return null;
+	}
+
+	private ITypedRegion getPartition(IDocument document, ITextSelection textSelection) {
+		ITypedRegion region = null;
+		if (textSelection != null) {
+			try {
+				region = document.getPartition(textSelection.getOffset());
+			}
+			catch (BadLocationException e) {
+				region = null;
+			}
+		}
+		return region;
+	}
+
+	private ITextSelection getTextSelection(ITextEditor textEditor) {
+		ITextSelection textSelection = null;
+		ISelection selection = textEditor.getSelectionProvider().getSelection();
+		if (selection instanceof ITextSelection && !selection.isEmpty()) {
+			textSelection = (ITextSelection) selection;
+		}
+		return textSelection;
+	}
+
+	abstract protected List getProcessors();
+}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionProvider.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionProvider.java
deleted file mode 100644
index 9326ae8..0000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesActionProvider.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.search;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil;
-
-/**
- * Performs the appropriate FindOccurrences action call based on selection.
- * Clients can add actions for different partitions via
- * <code>addAction(BasicFindOccurrencesAction action)</code>
- * 
- * @author pavery
- */
-public class FindOccurrencesActionProvider extends TextEditorAction {
-
-	private List fActions = null;
-
-	public FindOccurrencesActionProvider(ResourceBundle bundle, String prefix, ITextEditor editor) {
-
-		super(bundle, prefix, editor);
-	}
-
-	public void addAction(BasicFindOccurrencesAction action) {
-
-		getActions().add(action);
-	}
-
-	private BasicFindOccurrencesAction getActionForCurrentSelection() {
-
-		// check if we have an action that's enabled on the current partition
-		ITypedRegion tr = getPartition();
-		String partition = tr != null ? tr.getType() : ""; //$NON-NLS-1$
-
-		Iterator it = getActions().iterator();
-		BasicFindOccurrencesAction action = null;
-		while (it.hasNext()) {
-			action = (BasicFindOccurrencesAction) it.next();
-			// we just choose the first action that can handle the partition
-			if (action.enabledForParitition(partition))
-				return action;
-		}
-		return null;
-	}
-
-	private List getActions() {
-		if (this.fActions == null)
-			this.fActions = new ArrayList();
-		return this.fActions;
-	}
-
-	private IDocument getDocument() {
-		return getTextEditor().getDocumentProvider().getDocument(getTextEditor().getEditorInput());
-	}
-
-	private ITypedRegion getPartition() {
-		ITextSelection sel = getTextSelection();
-		ITypedRegion region = null;
-		if (sel != null) {
-			try {
-				region = getDocument().getPartition(sel.getOffset());
-			} catch (BadLocationException e) {
-				region = null;
-			}
-		}
-		return region;
-	}
-
-	private ITextSelection getTextSelection() {
-		ISelection selection = getTextEditor().getSelectionProvider().getSelection();
-		if (selection instanceof ITextSelection && !selection.isEmpty()) {
-			ITextSelection textSel = (ITextSelection) selection;
-			return textSel;
-		}
-		return null;
-	}
-
-	/**
-	 * @see org.eclipse.jface.action.Action#isEnabled()
-	 */
-	public boolean isEnabled() {
-		// always enabled
-		return true;
-	}
-
-
-	/**
-	 * @see org.eclipse.jface.action.Action#run()
-	 */
-	public void run() {
-
-		BasicFindOccurrencesAction action = getActionForCurrentSelection();
-		String errorMessage = SSEUIMessages.FindOccurrencesActionProvider_0; //$NON-NLS-1$
-		if (action != null) {
-			action.update();
-			if (action.isEnabled()) {
-				// first of all activate the view
-				NewSearchUI.activateSearchResultView();
-
-				// run the action
-				action.run();
-
-				// clear status message
-				PlatformStatusLineUtil.clearStatusLine();
-			} else {
-				PlatformStatusLineUtil.displayErrorMessage(errorMessage);
-				PlatformStatusLineUtil.addOneTimeClearListener();
-			}
-		} else {
-			PlatformStatusLineUtil.displayErrorMessage(errorMessage);
-			PlatformStatusLineUtil.addOneTimeClearListener();
-		}
-	}
-
-	/**
-	 * @see org.eclipse.ui.texteditor.TextEditorAction#update()
-	 */
-	public void update() {
-
-		super.update();
-		// clear status message
-		PlatformStatusLineUtil.clearStatusLine();
-	}
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java
new file mode 100644
index 0000000..0c9d09f
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/search/FindOccurrencesProcessor.java
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.sse.ui.internal.search;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.search.ui.ISearchQuery;
+import org.eclipse.search.ui.NewSearchUI;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+
+/**
+ * <p>
+ * Finds occurrences of a specified region type w/ region text in an
+ * IStructuredDocument. Clients must implement getPartitionTypes() and
+ * getRegionTypes() to indicate which partition types and region types it can
+ * operate on.
+ * </p>
+ * 
+ * <p>
+ * Clients should override <code>getSearchQuery()</code> in order to provide
+ * their own type of "search" (eg. searching for XML start tags, searching for
+ * Java elements, etc...)
+ * </p>
+ * 
+ */
+abstract public class FindOccurrencesProcessor {
+	public boolean findOccurrences(IDocument document, ITextSelection textSelection, IFile file) {
+		boolean findOccurrences = false;
+
+		// determine if action should be enabled or not
+		if (document instanceof IStructuredDocument) {
+			IStructuredDocument structuredDocument = (IStructuredDocument) document;
+			IStructuredDocumentRegion sdRegion = structuredDocument.getRegionAtCharacterOffset(textSelection.getOffset());
+			if (sdRegion != null) {
+				ITextRegion r = sdRegion.getRegionAtCharacterOffset(textSelection.getOffset());
+				if (r != null) {
+					String type = r.getType();
+					if (enabledForRegionType(type)) {
+						String matchText = sdRegion.getText(r);
+
+						// first of all activate the view
+						NewSearchUI.activateSearchResultView();
+
+						if (matchText != null && type != null) {
+							ISearchQuery searchQuery = getSearchQuery(file, structuredDocument, matchText, type, textSelection);
+							if (searchQuery != null) {
+								if (searchQuery.canRunInBackground())
+									NewSearchUI.runQueryInBackground(searchQuery);
+								else
+									NewSearchUI.runQueryInForeground(null, searchQuery);
+							}
+							findOccurrences = true;
+						}
+					}
+				}
+			}
+		}
+		return findOccurrences;
+	}
+
+	/**
+	 * @param regionType
+	 * @return <code>true</code> if this action can operate on this region
+	 *         type (ITextRegion), otherwise false.
+	 */
+	private boolean enabledForRegionType(String regionType) {
+
+		String[] accept = getRegionTypes();
+		for (int i = 0; i < accept.length; i++) {
+			if (regionType.equals(accept[i]))
+				return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Clients should override this to enable find occurrences on certain
+	 * partition(s).
+	 */
+	abstract protected String[] getPartitionTypes();
+
+	/**
+	 * Clients should override this to enable find occurrences on different
+	 * region type(s).
+	 */
+	abstract protected String[] getRegionTypes();
+
+	/**
+	 * Clients should override to provide their own search for the file.
+	 */
+	protected ISearchQuery getSearchQuery(IFile file, IStructuredDocument document, String regionText, String regionType, ITextSelection textSelection) {
+		return new OccurrencesSearchQuery(file, document, regionText, regionType);
+	}
+
+	/**
+	 * @param partitionType
+	 * @return <code>true</code> if this action can operate on this type of
+	 *         partition, otherwise <code>false</code>.
+	 */
+	public boolean enabledForParitition(String partitionType) {
+		String[] accept = getPartitionTypes();
+		for (int i = 0; i < accept.length; i++) {
+			if (partitionType.equals(accept[i]))
+				return true;
+		}
+		return false;
+	}
+}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectEnclosingAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectEnclosingAction.java
deleted file mode 100644
index 828bec2..0000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectEnclosingAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.w3c.dom.Node;
-
-public class StructureSelectEnclosingAction extends StructureSelectAction {
-	public StructureSelectEnclosingAction(StructuredTextEditor editor) {
-		super(editor);
-		setText(SSEUIMessages.StructureSelectEnclosing_label); //$NON-NLS-1$
-		setToolTipText(SSEUIMessages.StructureSelectEnclosing_tooltip); //$NON-NLS-1$
-		setDescription(SSEUIMessages.StructureSelectEnclosing_description); //$NON-NLS-1$
-	}
-
-	protected IndexedRegion getCursorIndexedRegion() {
-		return getIndexedRegion(fViewer.getSelectedRange().x);
-	}
-
-	protected Region getNewSelectionRegion(Node node, Region region) {
-		Region newRegion = null;
-
-		Node newNode = node.getParentNode();
-
-		if (newNode instanceof IndexedRegion) {
-			IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-			newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
-		}
-
-		return newRegion;
-	}
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectNextAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectNextAction.java
deleted file mode 100644
index 9efd05a..0000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectNextAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.w3c.dom.Node;
-
-public class StructureSelectNextAction extends StructureSelectAction {
-	public StructureSelectNextAction(StructuredTextEditor editor) {
-		super(editor);
-		setText(SSEUIMessages.StructureSelectNext_label); //$NON-NLS-1$
-		setToolTipText(SSEUIMessages.StructureSelectNext_tooltip); //$NON-NLS-1$
-		setDescription(SSEUIMessages.StructureSelectNext_description); //$NON-NLS-1$
-	}
-
-	protected IndexedRegion getCursorIndexedRegion() {
-		int offset = fViewer.getSelectedRange().x + fViewer.getSelectedRange().y - 1;
-
-		if (offset < 0)
-			offset = 0;
-
-		return getIndexedRegion(offset);
-	}
-
-	protected Region getNewSelectionRegion(Node node, Region region) {
-		Region newRegion = null;
-
-		Node newNode = node.getNextSibling();
-		if (newNode == null) {
-			newNode = node.getParentNode();
-
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
-			}
-		} else {
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(region.getOffset(), newIndexedRegion.getEndOffset() - region.getOffset());
-
-				if (newNode.getNodeType() == Node.TEXT_NODE)
-					newRegion = getNewSelectionRegion(newNode, newRegion);
-			}
-		}
-
-		return newRegion;
-	}
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectPreviousAction.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectPreviousAction.java
deleted file mode 100644
index e395efe..0000000
--- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructureSelectPreviousAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.sse.ui.internal.selection;
-
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.w3c.dom.Node;
-
-public class StructureSelectPreviousAction extends StructureSelectAction {
-	public StructureSelectPreviousAction(StructuredTextEditor editor) {
-		super(editor);
-		setText(SSEUIMessages.StructureSelectPrevious_label); //$NON-NLS-1$
-		setToolTipText(SSEUIMessages.StructureSelectPrevious_tooltip); //$NON-NLS-1$
-		setDescription(SSEUIMessages.StructureSelectPrevious_description); //$NON-NLS-1$
-	}
-
-	protected IndexedRegion getCursorIndexedRegion() {
-		return getIndexedRegion(fViewer.getSelectedRange().x);
-	}
-
-	protected Region getNewSelectionRegion(Node node, Region region) {
-		Region newRegion = null;
-
-		Node newNode = node.getPreviousSibling();
-		if (newNode == null) {
-			newNode = node.getParentNode();
-
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
-			}
-		} else {
-			if (newNode instanceof IndexedRegion) {
-				IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
-				newRegion = new Region(newIndexedRegion.getStartOffset(), region.getOffset() + region.getLength() - newIndexedRegion.getStartOffset());
-
-				if (newNode.getNodeType() == Node.TEXT_NODE)
-					newRegion = getNewSelectionRegion(newNode, newRegion);
-			}
-		}
-
-		return newRegion;
-	}
-}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java
new file mode 100644
index 0000000..22eba08
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectActionDelegate.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.sse.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+
+abstract public class StructuredSelectActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+	private SelectionHistory fHistory;
+
+	public void dispose() {
+		fEditor = null;
+		fHistory = null;
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void run(IAction action) {
+		if (fEditor instanceof ITextEditor) {
+			ITextEditor textEditor = (ITextEditor) fEditor;
+
+			ISelection selection = textEditor.getSelectionProvider().getSelection();
+			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
+			// determine current text selection
+			if (selection instanceof ITextSelection && document != null) {
+				ITextSelection textSelection = (ITextSelection) selection;
+
+				if (textSelection.getLength() < document.getLength()) {
+					// get current indexed region
+					IndexedRegion cursorIndexedRegion = getCursorIndexedRegion(document, textSelection);
+
+					// determine new selection based on current indexed region
+					Region newSelectionRegion = getNewSelectionRegion(cursorIndexedRegion, textSelection);
+
+					// select new selection
+					if (newSelectionRegion != null) {
+						fHistory.remember(new Region(textSelection.getOffset(), textSelection.getLength()));
+						try {
+							fHistory.ignoreSelectionChanges();
+							textEditor.selectAndReveal(newSelectionRegion.getOffset(), newSelectionRegion.getLength());
+						}
+						finally {
+							fHistory.listenToSelectionChanges();
+						}
+					}
+				}
+			}
+		}
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// do nothing
+	}
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+		if (fEditor != null)
+			fHistory = (SelectionHistory) fEditor.getAdapter(SelectionHistory.class);
+		else
+			fHistory = null;
+	}
+	
+	abstract protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection);
+	
+	abstract protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection);
+	
+	/**
+	 * This method will probably be removed and replaced by using new selection provider
+	 * @param document
+	 * @param offset
+	 * @return
+	 */
+	protected IndexedRegion getIndexedRegion(IDocument document, int offset) {
+		IndexedRegion indexedRegion = null;
+
+		int lastOffset = offset;
+		IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document);
+		if (model != null) {
+			try {
+				indexedRegion = model.getIndexedRegion(lastOffset);
+				while (indexedRegion == null && lastOffset >= 0) {
+					lastOffset--;
+					indexedRegion = model.getIndexedRegion(lastOffset);
+				}
+			}
+			finally {
+				model.releaseFromRead();
+			}
+		}
+
+		return indexedRegion;
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java
new file mode 100644
index 0000000..47dc5c8
--- /dev/null
+++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/selection/StructuredSelectHistoryActionDelegate.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.sse.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
+
+/**
+ * Selection history action delegate. Keeps track of selection within editor.
+ */
+public class StructuredSelectHistoryActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+	private SelectionHistory fHistory;
+
+	public void dispose() {
+		fEditor = null;
+		fHistory = null;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(SSEUIMessages.StructureSelectHistory_label);
+			action.setToolTipText(SSEUIMessages.StructureSelectHistory_tooltip);
+			action.setDescription(SSEUIMessages.StructureSelectHistory_description);
+		}
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void run(IAction action) {
+		IRegion old = fHistory.getLast();
+		if (old != null) {
+			try {
+				fHistory.ignoreSelectionChanges();
+				if (fEditor instanceof ITextEditor)
+					((ITextEditor) fEditor).selectAndReveal(old.getOffset(), old.getLength());
+			}
+			finally {
+				fHistory.listenToSelectionChanges();
+			}
+		}
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// do nothing
+	}
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+		if (fEditor != null)
+			fHistory = (SelectionHistory) fEditor.getAdapter(SelectionHistory.class);
+		else
+			fHistory = null;
+		if (fHistory != null) {
+			fHistory.setHistoryAction(action);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
index 7bbae20..ec938f9 100644
--- a/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF
@@ -28,6 +28,7 @@
  org.eclipse.wst.xml.ui.internal.provisional,
  org.eclipse.wst.xml.ui.internal.registry,
  org.eclipse.wst.xml.ui.internal.search,
+  org.eclipse.wst.xml.ui.internal.selection,
  org.eclipse.wst.xml.ui.internal.style,
  org.eclipse.wst.xml.ui.internal.tabletree,
  org.eclipse.wst.xml.ui.internal.taginfo,
diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.properties b/bundles/org.eclipse.wst.xml.ui/plugin.properties
index 859bfaa..fced5c2 100644
--- a/bundles/org.eclipse.wst.xml.ui/plugin.properties
+++ b/bundles/org.eclipse.wst.xml.ui/plugin.properties
@@ -49,4 +49,22 @@
 ###############################################################################
 _UI_XML_VALIDATOR                   = XML Validator
 _UI_REF_FILE_SHOW_DETAILS           = Show Details...
-_UI_MENU_VALIDATE_XML               = Validate XML File 
\ No newline at end of file
+_UI_MENU_VALIDATE_XML               = Validate XML File
+##
+CleanupDocument_label=Cleanup Document...
+CleanupDocument_tooltip=Cleanup Document
+ToggleComment_label=Toggle Comment
+ToggleComment_tooltip=Toggle Comment
+AddBlockComment_label=Add Block Comment
+AddBlockComment_tooltip=Add Block Comment
+RemoveBlockComment_label=Remove Block Comment
+RemoveBlockComment_tooltip=Remove Block Comment
+FindOccurrences_label=Occurrences in File
+StructureSelectEnclosing_label=Enclosing Element
+StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
+StructureSelectNext_label=Next Element
+StructureSelectNext_tooltip=Expand selection to include next sibling
+StructureSelectPrevious_label=Previous Element
+StructureSelectPrevious_tooltip=Expand selection to include previous sibling
+StructureSelectHistory_label=Restore Last Selection
+StructureSelectHistory_tooltip=Restore last selection
diff --git a/bundles/org.eclipse.wst.xml.ui/plugin.xml b/bundles/org.eclipse.wst.xml.ui/plugin.xml
index 0e8248e..68f91b4 100644
--- a/bundles/org.eclipse.wst.xml.ui/plugin.xml
+++ b/bundles/org.eclipse.wst.xml.ui/plugin.xml
@@ -481,5 +481,81 @@
 		</validator>
 	</extension>
 
-
+	<extension point="org.eclipse.ui.editorActions">
+		<editorContribution
+			id="org.eclipse.core.runtime.xml.source.editorActions"
+			targetID="org.eclipse.core.runtime.xml.source">
+			<action
+				id="CleanupDocument"
+				label="%CleanupDocument_label"
+				definitionId="org.eclipse.wst.sse.ui.cleanup.document"
+				tooltip="%CleanupDocument_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.CleanupActionXMLDelegate"
+				actionID="CleanupDocument">
+			</action>
+			<action
+				id="ToggleComment"
+				label="%ToggleComment_label"
+				definitionId="org.eclipse.wst.sse.ui.toggle.comment"
+				tooltip="%ToggleComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXMLDelegate"
+				actionID="ToggleComment">
+			</action>
+			<action
+				id="AddBlockComment"
+				label="%AddBlockComment_label"
+				definitionId="org.eclipse.wst.sse.ui.add.block.comment"
+				tooltip="%AddBlockComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXMLDelegate"
+				actionID="AddBlockComment">
+			</action>
+			<action
+				id="RemoveBlockComment"
+				label="%RemoveBlockComment_label"
+				definitionId="org.eclipse.wst.sse.ui.remove.block.comment"
+				tooltip="%RemoveBlockComment_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXMLDelegate"
+				actionID="RemoveBlockComment">
+			</action>
+			<action
+				id="FindOccurrences"
+				label="%FindOccurrences_label"
+				definitionId="org.eclipse.wst.sse.ui.search.find.occurrences"
+				class="org.eclipse.wst.xml.ui.internal.search.XMLFindOccurrencesActionDelegate"
+				actionID="FindOccurrences">
+			</action>
+			<action
+				id="StructureSelectEnclosing"
+				label="%StructureSelectEnclosing_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing"
+				tooltip="%StructureSelectEnclosing_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectEnclosingXMLActionDelegate"
+				actionID="StructureSelectEnclosing">
+			</action>
+			<action
+				id="StructureSelectNext"
+				label="%StructureSelectNext_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.next"
+				tooltip="%StructureSelectNext_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectNextXMLActionDelegate"
+				actionID="StructureSelectNext">
+			</action>
+			<action
+				id="StructureSelectPrevious"
+				label="%StructureSelectPrevious_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.previous"
+				tooltip="%StructureSelectPrevious_tooltip"
+				class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectPreviousXMLActionDelegate"
+				actionID="StructureSelectPrevious">
+			</action>
+			<action
+				id="StructureSelectHistory"
+				label="%StructureSelectHistory_label"
+				definitionId="org.eclipse.wst.sse.ui.structure.select.last"
+				tooltip="%StructureSelectHistory_tooltip"
+				class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate"
+				actionID="StructureSelectHistory">
+			</action>
+		</editorContribution>
+	</extension>
 </plugin>
diff --git a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java
index cf9648a..3c8c8d2 100644
--- a/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java
+++ b/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java
@@ -42,9 +42,9 @@
 import org.eclipse.wst.common.ui.provisional.editors.PostSelectionMultiPageEditorPart;
 import org.eclipse.wst.sse.ui.StructuredTextEditor;
 import org.eclipse.wst.xml.core.internal.provisional.IXMLPreferenceNames;
+import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML;
 import org.eclipse.wst.xml.ui.internal.Logger;
 import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
-import org.eclipse.wst.xml.ui.internal.provisional.StructuredTextEditorXML;
 
 public class XMLMultiPageEditorPart extends PostSelectionMultiPageEditorPart {
 
@@ -467,6 +467,12 @@
 					}
 					return contributor;
 				}
+
+				public String getId() {
+					// sets this id so nested editor is considered xml source
+					// page
+					return ContentTypeIdForXML.ContentTypeID_XML + ".source"; //$NON-NLS-1$;
+				}
 			};
 		}
 		else {
@@ -494,7 +500,7 @@
 	 * @return StructuredTextEditor
 	 */
 	private StructuredTextEditor createTextEditor() {
-		return new StructuredTextEditorXML();
+		return new StructuredTextEditor();
 	}
 
 	private void disconnectDesignPage() {
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
index 538f00c..acf33b6 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIMessages.java
@@ -271,6 +271,15 @@
 	public static String OpenFileFromSource_tooltip; // Resource bundle
 	public static String OpenFileFromSource_description; // Resource bundle
 	public static String XMLContentOutlineConfiguration_0;
+	public static String StructureSelectEnclosing_label;
+	public static String StructureSelectEnclosing_tooltip;
+	public static String StructureSelectEnclosing_description;
+	public static String StructureSelectNext_label;
+	public static String StructureSelectNext_tooltip;
+	public static String StructureSelectNext_description;
+	public static String StructureSelectPrevious_label;
+	public static String StructureSelectPrevious_tooltip;
+	public static String StructureSelectPrevious_description;
 
 	static {
 		// load message values from bundle file
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
index d8dc1c0..aefa886 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPluginResources.properties
@@ -269,19 +269,19 @@
 Uncomment_label=&Uncomment
 Uncomment_tooltip=Uncomment
 Uncomment_description=Uncomment
-ToggleComment_label=Togg&le Comment
+ToggleComment_label=Toggle Comment
 ToggleComment_tooltip=Toggle Comment
 ToggleComment_description=Toggle Comment
-AddBlockComment_label=Add &Block Comment
+AddBlockComment_label=Add Block Comment
 AddBlockComment_tooltip=Add Block Comment
 AddBlockComment_description=Add Block Comment
-RemoveBlockComment_label=Remove Bloc&k Comment
+RemoveBlockComment_label=Remove Block Comment
 RemoveBlockComment_tooltip=Remove Block Comment
 RemoveBlockComment_description=Remove Block Comment
-CleanupDocument_label=C&leanup Document...
+CleanupDocument_label=Cleanup Document...
 CleanupDocument_tooltip=Cleanup Document
 CleanupDocument_description=Cleanup Document
-FindOccurrences_label=O&ccurrences in File
+FindOccurrences_label=Occurrences in File
 ShowTooltipDesc_label=Show &Tooltip Description
 ShowTooltipDesc_tooltip=Displays the hover help for the selected element
 ShowTooltipDesc_description=Displays the hover help for the selected element
@@ -301,3 +301,12 @@
 OpenFileFromSource_tooltip=Open an editor on the selected link
 OpenFileFromSource_description=Open an editor on the selected link
 XMLContentOutlineConfiguration_0=Show Attributes
+StructureSelectEnclosing_label=Enclosing Element
+StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
+StructureSelectEnclosing_description=Expand selection to include enclosing element
+StructureSelectNext_label=Next Element
+StructureSelectNext_tooltip=Expand selection to include next sibling
+StructureSelectNext_description=Expand selection to include next sibling
+StructureSelectPrevious_label=Previous Element
+StructureSelectPrevious_tooltip=Expand selection to include previous sibling
+StructureSelectPrevious_description=Expand selection to include previous sibling
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AbstractCommentActionXMLDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AbstractCommentActionXMLDelegate.java
new file mode 100644
index 0000000..13eee15
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AbstractCommentActionXMLDelegate.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.xml.ui.internal.Logger;
+
+/**
+ * Abstract comment action delegate for XML editors
+ */
+abstract public class AbstractCommentActionXMLDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	static final String CLOSE_COMMENT = "-->"; //$NON-NLS-1$
+	static final String OPEN_COMMENT = "<!--"; //$NON-NLS-1$
+
+	IEditorPart fEditor;
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
+
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void run(IAction action) {
+		if (fEditor instanceof ITextEditor) {
+			ITextEditor textEditor = (ITextEditor) fEditor;
+			IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
+			if (document != null) {
+				// get current text selection
+				ITextSelection textSelection = getCurrentSelection();
+				if (textSelection.isEmpty())
+					return;
+
+				processAction(document, textSelection);
+			}
+		}
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// do nothing
+	}
+
+	private ITextSelection getCurrentSelection() {
+		if (fEditor instanceof ITextEditor) {
+			ISelectionProvider provider = ((ITextEditor) fEditor).getSelectionProvider();
+			if (provider != null) {
+				ISelection selection = provider.getSelection();
+				if (selection instanceof ITextSelection)
+					return (ITextSelection) selection;
+			}
+		}
+		return TextSelection.emptySelection();
+	}
+
+	abstract void processAction(IDocument document, ITextSelection textSelection);
+
+	void removeOpenCloseComments(IDocument document, int offset, int length) {
+		try {
+			int adjusted_length = length;
+
+			// remove open comments
+			String string = document.get(offset, length);
+			int index = string.lastIndexOf(OPEN_COMMENT);
+			while (index != -1) {
+				document.replace(offset + index, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
+				index = string.lastIndexOf(OPEN_COMMENT, index - 1);
+				adjusted_length -= OPEN_COMMENT.length();
+			}
+
+			// remove close comments
+			string = document.get(offset, adjusted_length);
+			index = string.lastIndexOf(CLOSE_COMMENT);
+			while (index != -1) {
+				document.replace(offset + index, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
+				index = string.lastIndexOf(CLOSE_COMMENT, index - 1);
+			}
+		}
+		catch (BadLocationException e) {
+			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AddBlockCommentActionXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AddBlockCommentActionXML.java
deleted file mode 100644
index 007928c..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AddBlockCommentActionXML.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.xml.core.internal.document.CommentImpl;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-/**
- * @deprecated use AddBlockCommentActionXMLDelegate instead
- */
-public class AddBlockCommentActionXML extends CommentActionXML {
-	protected int fCloseCommentOffset;
-	protected int fOpenCommentOffset;
-	protected IndexedRegion fSelectionEndIndexedRegion;
-	protected IndexedRegion fSelectionStartIndexedRegion;
-
-	public AddBlockCommentActionXML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected void init() {
-		super.init();
-
-		fSelectionStartIndexedRegion = fModel.getIndexedRegion(fSelectionStartOffset);
-		fSelectionEndIndexedRegion = fModel.getIndexedRegion(fSelectionEndOffset);
-
-		if (fSelectionStartIndexedRegion == null || fSelectionEndIndexedRegion == null)
-			return;
-
-		fOpenCommentOffset = fSelectionStartIndexedRegion.getStartOffset();
-		fCloseCommentOffset = fSelectionEndIndexedRegion.getEndOffset() + OPEN_COMMENT.length();
-	}
-
-	protected void processAction() {
-		if (fSelection.getLength() == 0 && fSelectionStartIndexedRegion instanceof CommentImpl)
-			return;
-
-		fModel.beginRecording(this, XMLUIMessages.AddBlockComment_tooltip);
-		fModel.aboutToChangeModel();
-
-		try {
-			fDocument.replace(fOpenCommentOffset, 0, OPEN_COMMENT);
-			fDocument.replace(fCloseCommentOffset, 0, CLOSE_COMMENT);
-			removeOpenCloseComments(fOpenCommentOffset + OPEN_COMMENT.length(), fCloseCommentOffset - fOpenCommentOffset - CLOSE_COMMENT.length());
-		}
-		catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-
-		fModel.changedModel();
-		fModel.endRecording(this);
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AddBlockCommentActionXMLDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AddBlockCommentActionXMLDelegate.java
new file mode 100644
index 0000000..b483aa0
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/AddBlockCommentActionXMLDelegate.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.xml.core.internal.document.CommentImpl;
+import org.eclipse.wst.xml.ui.internal.Logger;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+
+/**
+ * Add block comment action delegate for XML editor
+ */
+public class AddBlockCommentActionXMLDelegate extends AbstractCommentActionXMLDelegate {
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.AddBlockComment_label);
+			action.setToolTipText(XMLUIMessages.AddBlockComment_tooltip);
+			action.setDescription(XMLUIMessages.AddBlockComment_description);
+		}
+	}
+
+	void processAction(IDocument document, ITextSelection textSelection) {
+		IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
+		if (model != null) {
+			try {
+				IndexedRegion selectionStartIndexedRegion = model.getIndexedRegion(textSelection.getOffset());
+				IndexedRegion selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength());
+
+				if (selectionStartIndexedRegion == null)
+					return;
+				if (selectionEndIndexedRegion == null && textSelection.getLength() > 0) {
+					selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength() - 1);
+				}
+				if (selectionEndIndexedRegion == null)
+					return;
+
+				int openCommentOffset = selectionStartIndexedRegion.getStartOffset();
+				int closeCommentOffset = selectionEndIndexedRegion.getEndOffset() + OPEN_COMMENT.length();
+
+
+				if (textSelection.getLength() == 0 && selectionStartIndexedRegion instanceof CommentImpl)
+					return;
+
+				model.beginRecording(this, XMLUIMessages.AddBlockComment_tooltip);
+				model.aboutToChangeModel();
+
+				try {
+					document.replace(openCommentOffset, 0, OPEN_COMMENT);
+					document.replace(closeCommentOffset, 0, CLOSE_COMMENT);
+					removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
+				}
+				catch (BadLocationException e) {
+					Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+				}
+				finally {
+					model.changedModel();
+					model.endRecording(this);
+				}
+			}
+			finally {
+				model.releaseFromEdit();
+			}
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXML.java
deleted file mode 100644
index d9098bd..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXML.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
-import org.eclipse.wst.sse.ui.internal.actions.CleanupAction;
-import org.eclipse.wst.xml.core.internal.cleanup.CleanupProcessorXML;
-
-/**
- * @deprecated Use CleanupActionXMLDelegate instead.
- */
-public class CleanupActionXML extends CleanupAction {
-	protected IStructuredCleanupProcessor fCleanupProcessor;
-
-	public CleanupActionXML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected Dialog getCleanupDialog(Shell shell) {
-		if (fCleanupDialog == null)
-			fCleanupDialog = new CleanupDialogXML(shell);
-
-		return fCleanupDialog;
-	}
-
-	protected IStructuredCleanupProcessor getCleanupProcessor() {
-		if (fCleanupProcessor == null)
-			fCleanupProcessor = new CleanupProcessorXML();
-
-		return fCleanupProcessor;
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java
new file mode 100644
index 0000000..72c32c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.ui.IActionDelegate2;
+import org.eclipse.ui.IEditorActionDelegate;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.eclipse.wst.xml.core.internal.cleanup.CleanupProcessorXML;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+
+/**
+ * Cleanup action delegate for CSS editor
+ */
+public class CleanupActionXMLDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
+	private IEditorPart fEditor;
+	private IStructuredCleanupProcessor fCleanupProcessor;
+
+	public void setActiveEditor(IAction action, IEditorPart targetEditor) {
+		fEditor = targetEditor;
+	}
+
+	public void dispose() {
+		// nulling out just in case
+		fEditor = null;
+		fCleanupProcessor = null;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.CleanupDocument_label);
+			action.setToolTipText(XMLUIMessages.CleanupDocument_tooltip);
+			action.setDescription(XMLUIMessages.CleanupDocument_description);
+		}
+	}
+
+	public void runWithEvent(IAction action, Event event) {
+		run(action);
+	}
+
+	public void init(IViewPart view) {
+		// do nothing
+	}
+
+	public void run(IAction action) {
+		if (fEditor instanceof StructuredTextEditor) {
+			final StructuredTextEditor editor = (StructuredTextEditor) fEditor;
+			Dialog cleanupDialog = new CleanupDialogXML(editor.getSite().getShell());
+			if (cleanupDialog.open() == Window.OK) {
+				// setup runnable
+				Runnable runnable = new Runnable() {
+					public void run() {
+						IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
+						if (cleanupProcessor != null) {
+							IStructuredModel model = null;
+							try {
+								model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
+								if (model != null)
+									cleanupProcessor.cleanupModel(model);
+							}
+							finally {
+								if (model != null)
+									model.releaseFromEdit();
+							}
+						}
+					}
+				};
+
+				// TODO: make independent of 'model'.
+				IStructuredModel model = null;
+				try {
+					model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
+					if (model != null) {
+						// begin recording
+						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+						model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
+
+						// tell the model that we are about to make a big
+						// model change
+						model.aboutToChangeModel();
+
+						// run
+						BusyIndicator.showWhile(editor.getTextViewer().getControl().getDisplay(), runnable);
+					}
+				}
+				finally {
+					if (model != null) {
+						// tell the model that we are done with the big
+						// model
+						// change
+						model.changedModel();
+
+						// end recording
+						ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
+						model.endRecording(this, selection.getOffset(), selection.getLength());
+						model.releaseFromEdit();
+					}
+				}
+			}
+		}
+	}
+
+	public void selectionChanged(IAction action, ISelection selection) {
+		// do nothing
+	}
+
+	IStructuredCleanupProcessor getCleanupProcessor() {
+		if (fCleanupProcessor == null)
+			fCleanupProcessor = new CleanupProcessorXML();
+
+		return fCleanupProcessor;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CommentActionXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CommentActionXML.java
deleted file mode 100644
index 2ccbe42..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CommentActionXML.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.TextEditorAction;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-/**
- * @deprecated use AbstractCommentActionXMLDelegate or
- *             ToggleCommentActionXMLDelegate instead
- */
-public class CommentActionXML extends TextEditorAction {
-	protected static final String CLOSE_COMMENT = "-->"; //$NON-NLS-1$
-	protected static final String OPEN_COMMENT = "<!--"; //$NON-NLS-1$
-
-	protected IDocument fDocument;
-	protected IStructuredModel fModel;
-	protected ITextSelection fSelection;
-	protected int fSelectionEndLine;
-	protected int fSelectionEndLineOffset;
-	protected int fSelectionEndOffset;
-	protected Position fSelectionPosition;
-	protected int fSelectionStartLine;
-	protected int fSelectionStartLineOffset;
-	protected int fSelectionStartOffset;
-	protected boolean fUpdateSelection;
-
-
-	public CommentActionXML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected void comment(int openCommentOffset, int closeCommentOffset) {
-		try {
-			fDocument.replace(openCommentOffset, 0, OPEN_COMMENT);
-			fDocument.replace(closeCommentOffset, 0, CLOSE_COMMENT);
-			removeOpenCloseComments(openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
-		}
-		catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-	}
-
-	/**
-	 * Release the current model
-	 */
-	void done() {
-		if (fModel != null) {
-			fModel.releaseFromEdit();
-			fModel = null;
-		}
-	}
-
-	protected ITextSelection getCurrentSelection() {
-		ITextEditor editor = getTextEditor();
-		if (editor != null) {
-			ISelectionProvider provider = editor.getSelectionProvider();
-			if (provider != null) {
-				ISelection selection = provider.getSelection();
-				if (selection instanceof ITextSelection)
-					return (ITextSelection) selection;
-			}
-		}
-		return TextSelection.emptySelection();
-	}
-
-	protected void init() {
-		ITextEditor editor = getTextEditor();
-		if (editor == null)
-			return;
-
-		IDocumentProvider docProvider = editor.getDocumentProvider();
-
-		IEditorInput input = editor.getEditorInput();
-		if (input == null)
-			return;
-
-		fDocument = docProvider.getDocument(input);
-		if (fDocument == null)
-			return;
-
-		IModelManager modelManager = StructuredModelManager.getModelManager();
-		fModel = modelManager.getExistingModelForEdit(fDocument);
-		if (fModel == null)
-			return;
-
-		fSelection = getCurrentSelection();
-		if (fSelection.isEmpty())
-			return;
-
-		fSelectionStartOffset = fSelection.getOffset();
-		fSelectionEndOffset = fSelectionStartOffset + fSelection.getLength();
-
-		// add selection position to document
-		fSelectionPosition = new Position(fSelection.getOffset(), fSelection.getLength());
-		try {
-			fDocument.addPosition(fSelectionPosition);
-		}
-		catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-
-		try {
-			fSelectionStartLine = fDocument.getLineOfOffset(fSelectionStartOffset);
-			fSelectionEndLine = fDocument.getLineOfOffset(fSelectionEndOffset);
-			fSelectionStartLineOffset = fDocument.getLineOffset(fSelectionStartLine);
-			fSelectionEndLineOffset = fDocument.getLineOffset(fSelectionEndLine);
-		}
-		catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-
-		// adjust selection end line
-		if (fSelectionEndLine > fSelectionStartLine && fSelectionEndLineOffset == fSelectionEndOffset)
-			fSelectionEndLine--;
-	}
-
-	protected boolean isCommentLine(int line) {
-		try {
-			IRegion region = fDocument.getLineInformation(line);
-			String string = fDocument.get(region.getOffset(), region.getLength()).trim();
-			return string.length() >= OPEN_COMMENT.length() + CLOSE_COMMENT.length() && string.startsWith(OPEN_COMMENT) && string.endsWith(CLOSE_COMMENT);
-		}
-		catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-	}
-
-	protected void prepareSelection() {
-		fUpdateSelection = fSelection.getLength() > 0 && fSelectionStartLineOffset == fSelectionStartOffset && !isCommentLine(fSelectionStartLine);
-	}
-
-	protected void processAction() {
-		fModel.beginRecording(this, XMLUIMessages.Comment_tooltip);
-		fModel.aboutToChangeModel();
-
-		for (int i = fSelectionStartLine; i <= fSelectionEndLine; i++) {
-			try {
-				if (fDocument.getLineLength(i) > 0 && !isCommentLine(i)) {
-					int openCommentOffset = fDocument.getLineOffset(i);
-					int lineDelimiterLength = fDocument.getLineDelimiter(i) == null ? 0 : fDocument.getLineDelimiter(i).length();
-					int closeCommentOffset = openCommentOffset + fDocument.getLineLength(i) - lineDelimiterLength + OPEN_COMMENT.length();
-					comment(openCommentOffset, closeCommentOffset);
-				}
-			}
-			catch (BadLocationException e) {
-				throw new SourceEditingRuntimeException();
-			}
-		}
-
-		fModel.changedModel();
-		fModel.endRecording(this);
-	}
-
-	protected void removeOpenCloseComments(int offset, int length) {
-		try {
-			int adjusted_length = length;
-
-			// remove open comments
-			String string = fDocument.get(offset, length);
-			int index = string.lastIndexOf(OPEN_COMMENT);
-			while (index != -1) {
-				fDocument.replace(offset + index, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
-				index = string.lastIndexOf(OPEN_COMMENT, index - 1);
-				adjusted_length -= OPEN_COMMENT.length();
-			}
-
-			// remove close comments
-			string = fDocument.get(offset, adjusted_length);
-			index = string.lastIndexOf(CLOSE_COMMENT);
-			while (index != -1) {
-				fDocument.replace(offset + index, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
-				index = string.lastIndexOf(CLOSE_COMMENT, index - 1);
-			}
-		}
-		catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-	}
-
-	public void run() {
-		init();
-		prepareSelection();
-		processAction();
-		updateSelection();
-		done();
-	}
-
-
-	protected void setCurrentSelection(ITextSelection selection) {
-		ITextEditor editor = getTextEditor();
-		if (editor != null) {
-			ISelectionProvider provider = editor.getSelectionProvider();
-			if (provider != null) {
-				provider.setSelection(selection);
-			}
-		}
-	}
-
-	protected void updateSelection() {
-		if (fUpdateSelection) {
-			ITextSelection selection = new TextSelection(fDocument, fSelectionPosition.getOffset() - OPEN_COMMENT.length(), fSelectionPosition.getLength() + OPEN_COMMENT.length());
-			setCurrentSelection(selection);
-		}
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/RemoveBlockCommentActionXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/RemoveBlockCommentActionXML.java
deleted file mode 100644
index d0baaf2..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/RemoveBlockCommentActionXML.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.xml.core.internal.document.CommentImpl;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-/**
- * @deprecated use RemoveBlockCommentActionXMLDelegate instead
- */
-public class RemoveBlockCommentActionXML extends AddBlockCommentActionXML {
-	public RemoveBlockCommentActionXML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected void init() {
-		super.init();
-
-		fCloseCommentOffset = fSelectionEndIndexedRegion.getEndOffset() - OPEN_COMMENT.length() - CLOSE_COMMENT.length();
-	}
-
-	protected void processAction() {
-		fModel.beginRecording(this, XMLUIMessages.RemoveBlockComment_tooltip);
-		fModel.aboutToChangeModel();
-
-		if (fSelection.getLength() == 0) {
-			if (fSelectionStartIndexedRegion instanceof CommentImpl) {
-				try {
-					fDocument.replace(fOpenCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
-					fDocument.replace(fCloseCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
-				} catch (BadLocationException e) {
-					throw new SourceEditingRuntimeException();
-				}
-			}
-		} else {
-			if (fSelectionStartIndexedRegion instanceof CommentImpl) {
-				try {
-					fDocument.replace(fOpenCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
-				} catch (BadLocationException e) {
-					throw new SourceEditingRuntimeException();
-				}
-			}
-
-			if (fSelectionEndIndexedRegion instanceof CommentImpl) {
-				try {
-					fDocument.replace(fCloseCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
-				} catch (BadLocationException e) {
-					throw new SourceEditingRuntimeException();
-				}
-			}
-		}
-		removeOpenCloseComments(fOpenCommentOffset + OPEN_COMMENT.length(), fCloseCommentOffset - fOpenCommentOffset - CLOSE_COMMENT.length());
-
-		fModel.changedModel();
-		fModel.endRecording(this);
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/RemoveBlockCommentActionXMLDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/RemoveBlockCommentActionXMLDelegate.java
new file mode 100644
index 0000000..8ac71d9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/RemoveBlockCommentActionXMLDelegate.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.xml.core.internal.document.CommentImpl;
+import org.eclipse.wst.xml.ui.internal.Logger;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+
+/**
+ * Remove block comment action delegate for XML editor
+ */
+public class RemoveBlockCommentActionXMLDelegate extends AbstractCommentActionXMLDelegate {
+
+	void processAction(IDocument document, ITextSelection textSelection) {
+		IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
+		if (model != null) {
+			try {
+				IndexedRegion selectionStartIndexedRegion = model.getIndexedRegion(textSelection.getOffset());
+				IndexedRegion selectionEndIndexedRegion = model.getIndexedRegion(textSelection.getOffset() + textSelection.getLength());
+
+				if (selectionStartIndexedRegion == null || selectionEndIndexedRegion == null)
+					return;
+
+				int openCommentOffset = selectionStartIndexedRegion.getStartOffset();
+				int closeCommentOffset = selectionEndIndexedRegion.getEndOffset() - OPEN_COMMENT.length() - CLOSE_COMMENT.length();
+
+				model.beginRecording(this, XMLUIMessages.RemoveBlockComment_tooltip);
+				model.aboutToChangeModel();
+
+				try {
+					if (textSelection.getLength() == 0) {
+						if (selectionStartIndexedRegion instanceof CommentImpl) {
+							document.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
+							document.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
+						}
+					}
+					else {
+						if (selectionStartIndexedRegion instanceof CommentImpl) {
+							document.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
+						}
+
+						if (selectionEndIndexedRegion instanceof CommentImpl) {
+							document.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
+						}
+					}
+					removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
+				}
+				catch (BadLocationException e) {
+					Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+				}
+				finally {
+					model.changedModel();
+					model.endRecording(this);
+				}
+			}
+			finally {
+				model.releaseFromEdit();
+			}
+		}
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.RemoveBlockComment_label);
+			action.setToolTipText(XMLUIMessages.RemoveBlockComment_tooltip);
+			action.setDescription(XMLUIMessages.RemoveBlockComment_description);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/ToggleCommentActionXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/ToggleCommentActionXML.java
deleted file mode 100644
index 44a823e..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/ToggleCommentActionXML.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-/**
- * @deprecated use ToggleCommentActionXMLDelegate instead
- */
-public class ToggleCommentActionXML extends UncommentActionXML {
-	public ToggleCommentActionXML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected void processAction() {
-		fModel.beginRecording(this, XMLUIMessages.ToggleComment_tooltip);
-		fModel.aboutToChangeModel();
-
-		for (int i = fSelectionStartLine; i <= fSelectionEndLine; i++) {
-			try {
-				if (fDocument.getLineLength(i) > 0) {
-					if (isCommentLine(i)) {
-						int lineOffset = fDocument.getLineOffset(i);
-						IRegion region = fDocument.getLineInformation(i);
-						String string = fDocument.get(region.getOffset(), region.getLength());
-						int openCommentOffset = lineOffset + string.indexOf(OPEN_COMMENT);
-						int closeCommentOffset = lineOffset + string.indexOf(CLOSE_COMMENT) - OPEN_COMMENT.length();
-						uncomment(openCommentOffset, closeCommentOffset);
-					} else {
-						int openCommentOffset = fDocument.getLineOffset(i);
-						int lineDelimiterLength = fDocument.getLineDelimiter(i) == null ? 0 : fDocument.getLineDelimiter(i).length();
-						int closeCommentOffset = openCommentOffset + fDocument.getLineLength(i) - lineDelimiterLength + OPEN_COMMENT.length();
-						comment(openCommentOffset, closeCommentOffset);
-					}
-				}
-			} catch (BadLocationException e) {
-				throw new SourceEditingRuntimeException();
-			}
-		}
-
-		fModel.changedModel();
-		fModel.endRecording(this);
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/ToggleCommentActionXMLDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/ToggleCommentActionXMLDelegate.java
new file mode 100644
index 0000000..017e616
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/ToggleCommentActionXMLDelegate.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager;
+import org.eclipse.wst.xml.ui.internal.Logger;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+
+/**
+ * Toggle comment action delegate for XML editor
+ */
+public class ToggleCommentActionXMLDelegate extends AbstractCommentActionXMLDelegate {
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.ToggleComment_label);
+			action.setToolTipText(XMLUIMessages.ToggleComment_tooltip);
+			action.setDescription(XMLUIMessages.ToggleComment_description);
+		}
+	}
+
+	void processAction(IDocument document, ITextSelection textSelection) {
+		// get text selection lines info
+		int selectionStartLine = textSelection.getStartLine();
+		int selectionEndLine = textSelection.getEndLine();
+		try {
+			int selectionEndLineOffset = document.getLineOffset(selectionEndLine);
+			int selectionEndOffset = textSelection.getOffset() + textSelection.getLength();
+
+			// adjust selection end line
+			if (selectionEndLine > selectionStartLine && selectionEndLineOffset == selectionEndOffset)
+				selectionEndLine--;
+
+		}
+		catch (BadLocationException e) {
+			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+		}
+
+		// save the selection position since it will be changing
+		Position selectionPosition = null;
+		boolean updateStartOffset = false;
+		try {
+			selectionPosition = new Position(textSelection.getOffset(), textSelection.getLength());
+			document.addPosition(selectionPosition);
+
+			// extra check if commenting from beginning of line
+			int selectionStartLineOffset = document.getLineOffset(selectionStartLine);
+			if (textSelection.getLength() > 0 && selectionStartLineOffset == textSelection.getOffset() && !isCommentLine(document, selectionStartLine))
+				updateStartOffset = true;
+		}
+		catch (BadLocationException e) {
+			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+		}
+
+		processAction(document, selectionStartLine, selectionEndLine);
+
+		updateCurrentSelection(selectionPosition, document, updateStartOffset);
+	}
+
+	private void processAction(IDocument document, int selectionStartLine, int selectionEndLine) {
+		IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
+		if (model != null) {
+			try {
+				model.beginRecording(this, XMLUIMessages.ToggleComment_tooltip);
+				model.aboutToChangeModel();
+
+				for (int i = selectionStartLine; i <= selectionEndLine; i++) {
+					try {
+						if (document.getLineLength(i) > 0) {
+							if (isCommentLine(document, i)) {
+								int lineOffset = document.getLineOffset(i);
+								IRegion region = document.getLineInformation(i);
+								String string = document.get(region.getOffset(), region.getLength());
+								int openCommentOffset = lineOffset + string.indexOf(OPEN_COMMENT);
+								int closeCommentOffset = lineOffset + string.indexOf(CLOSE_COMMENT) - OPEN_COMMENT.length();
+								uncomment(document, openCommentOffset, closeCommentOffset);
+							}
+							else {
+								int openCommentOffset = document.getLineOffset(i);
+								int lineDelimiterLength = document.getLineDelimiter(i) == null ? 0 : document.getLineDelimiter(i).length();
+								int closeCommentOffset = openCommentOffset + document.getLineLength(i) - lineDelimiterLength + OPEN_COMMENT.length();
+								comment(document, openCommentOffset, closeCommentOffset);
+							}
+						}
+					}
+					catch (BadLocationException e) {
+						Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+					}
+				}
+			}
+			finally {
+				model.changedModel();
+				model.endRecording(this);
+				model.releaseFromEdit();
+			}
+		}
+	}
+
+	private boolean isCommentLine(IDocument document, int line) {
+		boolean isComment = false;
+
+		try {
+			IRegion region = document.getLineInformation(line);
+			String string = document.get(region.getOffset(), region.getLength()).trim();
+			isComment = string.length() >= OPEN_COMMENT.length() + CLOSE_COMMENT.length() && string.startsWith(OPEN_COMMENT) && string.endsWith(CLOSE_COMMENT);
+		}
+		catch (BadLocationException e) {
+			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+		}
+		return isComment;
+	}
+
+	private void comment(IDocument document, int openCommentOffset, int closeCommentOffset) {
+		try {
+			document.replace(openCommentOffset, 0, OPEN_COMMENT);
+			document.replace(closeCommentOffset, 0, CLOSE_COMMENT);
+			removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
+		}
+		catch (BadLocationException e) {
+			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+		}
+	}
+
+	private void uncomment(IDocument document, int openCommentOffset, int closeCommentOffset) {
+		try {
+			document.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
+			document.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
+		}
+		catch (BadLocationException e) {
+			Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
+		}
+	}
+
+	private void updateCurrentSelection(Position selectionPosition, IDocument document, boolean updateStartOffset) {
+		if (fEditor instanceof ITextEditor) {
+			// update the selection if text selection changed
+			if (selectionPosition != null) {
+				ITextSelection selection = null;
+				if (updateStartOffset)
+					selection = new TextSelection(document, selectionPosition.getOffset() - OPEN_COMMENT.length(), selectionPosition.getLength() + OPEN_COMMENT.length());
+				else
+					selection = new TextSelection(document, selectionPosition.getOffset(), selectionPosition.getLength());
+				ISelectionProvider provider = ((ITextEditor) fEditor).getSelectionProvider();
+				if (provider != null) {
+					provider.setSelection(selection);
+				}
+				document.removePosition(selectionPosition);
+			}
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/UncommentActionXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/UncommentActionXML.java
deleted file mode 100644
index 03cf5a9..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/UncommentActionXML.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.actions;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.core.internal.provisional.exceptions.SourceEditingRuntimeException;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-/**
- * @deprecated use ToggleCommentActionXMLDelegate instead
- */
-public class UncommentActionXML extends CommentActionXML {
-	public UncommentActionXML(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	protected void processAction() {
-		fModel.beginRecording(this, XMLUIMessages.Uncomment_tooltip);
-		fModel.aboutToChangeModel();
-
-		for (int i = fSelectionStartLine; i <= fSelectionEndLine; i++) {
-			try {
-				if (fDocument.getLineLength(i) > 0 && isCommentLine(i)) {
-					int lineOffset = fDocument.getLineOffset(i);
-					IRegion region = fDocument.getLineInformation(i);
-					String string = fDocument.get(region.getOffset(), region.getLength());
-					int openCommentOffset = lineOffset + string.indexOf(OPEN_COMMENT);
-					int closeCommentOffset = lineOffset + string.indexOf(CLOSE_COMMENT) - OPEN_COMMENT.length();
-					uncomment(openCommentOffset, closeCommentOffset);
-				}
-			} catch (BadLocationException e) {
-				throw new SourceEditingRuntimeException();
-			}
-		}
-
-		fModel.changedModel();
-		fModel.endRecording(this);
-	}
-
-	protected void uncomment(int openCommentOffset, int closeCommentOffset) {
-		try {
-			fDocument.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
-			fDocument.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
-		} catch (BadLocationException e) {
-			throw new SourceEditingRuntimeException();
-		}
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/provisional/StructuredTextEditorXML.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/provisional/StructuredTextEditorXML.java
deleted file mode 100644
index f6b638d..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/provisional/StructuredTextEditorXML.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.provisional;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionProvider;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-import org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.CleanupActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXML;
-import org.eclipse.wst.xml.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.xml.ui.internal.search.XMLFindOccurrencesAction;
-
-/**
- * @deprecated XML editor is created from StructuredTextEditor with
- *             XML configurations
- */
-public class StructuredTextEditorXML extends StructuredTextEditor {
-	private final static String UNDERSCORE = "_"; //$NON-NLS-1$
-	
-	protected void createActions() {
-		super.createActions();
-
-		ResourceBundle resourceBundle = XMLUIMessages.getResourceBundle();
-
-		Action action = new CleanupActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT, action);
-
-		/*
-		 * action = new CommentActionXML(resourceBundle,
-		 * StructuredTextEditorActionConstants.ACTION_NAME_COMMENT + DOT,
-		 * this); action.setActionDefinitionId(ActionDefinitionIds.COMMENT);
-		 * setAction(StructuredTextEditorActionConstants.ACTION_NAME_COMMENT,
-		 * action);
-		 * 
-		 * action = new UncommentActionXML(resourceBundle,
-		 * StructuredTextEditorActionConstants.ACTION_NAME_UNCOMMENT + DOT,
-		 * this); action.setActionDefinitionId(ActionDefinitionIds.UNCOMMENT);
-		 * setAction(StructuredTextEditorActionConstants.ACTION_NAME_UNCOMMENT,
-		 * action);
-		 */
-
-		action = new ToggleCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.TOGGLE_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_TOGGLE_COMMENT, action);
-
-		action = new AddBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.ADD_BLOCK_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_ADD_BLOCK_COMMENT, action);
-
-		action = new RemoveBlockCommentActionXML(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT + UNDERSCORE, this);
-		action.setActionDefinitionId(ActionDefinitionIds.REMOVE_BLOCK_COMMENT);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_REMOVE_BLOCK_COMMENT, action);
-
-		FindOccurrencesActionProvider foAction = new FindOccurrencesActionProvider(resourceBundle, StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES + UNDERSCORE, this);
-		foAction.addAction(new XMLFindOccurrencesAction(resourceBundle, "", this)); //$NON-NLS-1$
-		foAction.setActionDefinitionId(ActionDefinitionIds.FIND_OCCURRENCES);
-		setAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, foAction);
-		markAsSelectionDependentAction(StructuredTextEditorActionConstants.ACTION_NAME_FIND_OCCURRENCES, true);
-	}
-
-	protected void initializeEditor() {
-		super.initializeEditor();
-		setHelpContextId(IHelpContextIds.XML_SOURCEVIEW_HELPID);
-	}
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesAction.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesAction.java
deleted file mode 100644
index e542079..0000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2004 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *     Jens Lukowski/Innoopract - initial renaming/restructuring
- *     
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.search;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.sse.ui.internal.search.BasicFindOccurrencesAction;
-import org.eclipse.wst.xml.core.internal.provisional.text.IXMLPartitions;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-
-
-
-/**
- * <p>
- * Configures a BasicFindOccurrencesAction with XML partitions and regions
- * </p>
- * 
- * <p>
- * Uses default <code>getSearchQuery()</code>.
- * </p>
- * 
- * @deprecated use XMLFindOccurrencesProcessor instead
- */
-public class XMLFindOccurrencesAction extends BasicFindOccurrencesAction {
-
-	public XMLFindOccurrencesAction(ResourceBundle bundle, String prefix, ITextEditor editor) {
-		super(bundle, prefix, editor);
-	}
-
-	public String[] getPartitionTypes() {
-
-		return new String[]{IXMLPartitions.XML_DEFAULT};
-	}
-
-	public String[] getRegionTypes() {
-
-		return new String[]{DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE};
-	}
-
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesActionDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesActionDelegate.java
new file mode 100644
index 0000000..84f2ec9
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesActionDelegate.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.search;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionDelegate;
+
+/**
+ * Sets up FindOccurrencesActionDelegate for xml find occurrences processors
+ */
+public class XMLFindOccurrencesActionDelegate extends FindOccurrencesActionDelegate {
+	private List fProcessors;
+
+	protected List getProcessors() {
+		if (fProcessors == null) {
+			fProcessors = new ArrayList();
+			XMLFindOccurrencesProcessor htmlProcessor = new XMLFindOccurrencesProcessor();
+			fProcessors.add(htmlProcessor);
+		}
+		return fProcessors;
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesProcessor.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesProcessor.java
new file mode 100644
index 0000000..9fac53e
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/search/XMLFindOccurrencesProcessor.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.search;
+
+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor;
+import org.eclipse.wst.xml.core.internal.provisional.text.IXMLPartitions;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+
+/**
+ * Configures a FindOccurrencesProcessor with XML partitions and regions
+ */
+public class XMLFindOccurrencesProcessor extends FindOccurrencesProcessor {
+
+	protected String[] getPartitionTypes() {
+		return new String[]{IXMLPartitions.XML_DEFAULT};
+	}
+
+	protected String[] getRegionTypes() {
+		return new String[]{DOMRegionContext.XML_TAG_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_NAME, DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE};
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectEnclosingXMLActionDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectEnclosingXMLActionDelegate.java
new file mode 100644
index 0000000..4efac6b
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectEnclosingXMLActionDelegate.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.w3c.dom.Node;
+
+public class StructuredSelectEnclosingXMLActionDelegate extends StructuredSelectActionDelegate {
+
+	protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
+		IndexedRegion indexedRegion = null;
+		
+		indexedRegion = getIndexedRegion(document, textSelection.getOffset());
+
+		return indexedRegion;
+	}
+
+	protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
+		Region newRegion = null;
+		if (indexedRegion instanceof Node) {
+			Node cursorNode = (Node) indexedRegion;
+
+			// use parent node for empty text node
+			if (cursorNode.getNodeType() == Node.TEXT_NODE && cursorNode.getNodeValue().trim().length() == 0) {
+				cursorNode = cursorNode.getParentNode();
+
+				if (cursorNode instanceof IndexedRegion)
+					indexedRegion = (IndexedRegion) cursorNode;
+			}
+
+			Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
+
+			if (cursorNodeRegion.getOffset() >= textSelection.getOffset() && cursorNodeRegion.getOffset() <= textSelection.getOffset() + textSelection.getLength() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= textSelection.getOffset() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= textSelection.getOffset() + textSelection.getLength()) {
+				Node newNode = cursorNode.getParentNode();
+
+				if (newNode instanceof IndexedRegion) {
+					IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+					newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+				}
+			}
+			else
+				newRegion = cursorNodeRegion;
+		}
+		return newRegion;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.StructureSelectEnclosing_label);
+			action.setToolTipText(XMLUIMessages.StructureSelectEnclosing_tooltip);
+			action.setDescription(XMLUIMessages.StructureSelectEnclosing_description);
+		}
+	}
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectNextXMLActionDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectNextXMLActionDelegate.java
new file mode 100644
index 0000000..45b4403
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectNextXMLActionDelegate.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.w3c.dom.Node;
+
+public class StructuredSelectNextXMLActionDelegate extends StructuredSelectActionDelegate {
+
+	protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
+		int offset = textSelection.getOffset() + textSelection.getLength();
+		if (offset < 0)
+			offset = 0;
+
+		IndexedRegion indexedRegion = null;
+
+		indexedRegion = getIndexedRegion(document, offset);
+
+		return indexedRegion;
+	}
+
+	protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
+		Region newRegion = null;
+		if (indexedRegion instanceof Node) {
+			Node cursorNode = (Node) indexedRegion;
+
+			// use parent node for empty text node
+			if (cursorNode.getNodeType() == Node.TEXT_NODE && cursorNode.getNodeValue().trim().length() == 0) {
+				cursorNode = cursorNode.getParentNode();
+
+				if (cursorNode instanceof IndexedRegion)
+					indexedRegion = (IndexedRegion) cursorNode;
+			}
+
+			Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
+
+			if (cursorNodeRegion.getOffset() >= textSelection.getOffset() && cursorNodeRegion.getOffset() <= textSelection.getOffset() + textSelection.getLength() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= textSelection.getOffset() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= textSelection.getOffset() + textSelection.getLength()) {
+				Node newNode = cursorNode.getNextSibling();
+				if (newNode == null) {
+					newNode = cursorNode.getParentNode();
+
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+					}
+				}
+				else {
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(textSelection.getOffset(), newIndexedRegion.getEndOffset() - textSelection.getOffset());
+
+						if (newNode.getNodeType() == Node.TEXT_NODE)
+							newRegion = getNewSelectionRegion(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
+					}
+				}
+			}
+			else
+				newRegion = cursorNodeRegion;
+		}
+		return newRegion;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.StructureSelectNext_label);
+			action.setToolTipText(XMLUIMessages.StructureSelectNext_tooltip);
+			action.setDescription(XMLUIMessages.StructureSelectNext_description);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectPreviousXMLActionDelegate.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectPreviousXMLActionDelegate.java
new file mode 100644
index 0000000..52b2062
--- /dev/null
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/selection/StructuredSelectPreviousXMLActionDelegate.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *     
+ *******************************************************************************/
+
+package org.eclipse.wst.xml.ui.internal.selection;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.w3c.dom.Node;
+
+public class StructuredSelectPreviousXMLActionDelegate extends StructuredSelectActionDelegate {
+
+	protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
+		IndexedRegion indexedRegion = null;
+
+		indexedRegion = getIndexedRegion(document, textSelection.getOffset());
+
+		return indexedRegion;
+	}
+
+	protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
+		Region newRegion = null;
+		if (indexedRegion instanceof Node) {
+			Node cursorNode = (Node) indexedRegion;
+
+			// use parent node for empty text node
+			if (cursorNode.getNodeType() == Node.TEXT_NODE && cursorNode.getNodeValue().trim().length() == 0) {
+				cursorNode = cursorNode.getParentNode();
+
+				if (cursorNode instanceof IndexedRegion)
+					indexedRegion = (IndexedRegion) cursorNode;
+			}
+
+			Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
+
+			if (cursorNodeRegion.getOffset() >= textSelection.getOffset() && cursorNodeRegion.getOffset() <= textSelection.getOffset() + textSelection.getLength() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= textSelection.getOffset() && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= textSelection.getOffset() + textSelection.getLength()) {
+				Node newNode = cursorNode.getPreviousSibling();
+				if (newNode == null) {
+					newNode = cursorNode.getParentNode();
+
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
+					}
+				}
+				else {
+					if (newNode instanceof IndexedRegion) {
+						IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
+						newRegion = new Region(newIndexedRegion.getStartOffset(), textSelection.getOffset() + textSelection.getLength() - newIndexedRegion.getStartOffset());
+
+						if (newNode.getNodeType() == Node.TEXT_NODE)
+							newRegion = getNewSelectionRegion(newIndexedRegion, new TextSelection(newRegion.getOffset(), newRegion.getLength()));
+					}
+				}
+
+			}
+			else
+				newRegion = cursorNodeRegion;
+		}
+		return newRegion;
+	}
+
+	public void init(IAction action) {
+		if (action != null) {
+			action.setText(XMLUIMessages.StructureSelectPrevious_label);
+			action.setToolTipText(XMLUIMessages.StructureSelectPrevious_tooltip);
+			action.setDescription(XMLUIMessages.StructureSelectPrevious_description);
+		}
+	}
+
+}
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java
index 8710c83..d37a123 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDActionBarContributor.java
@@ -44,7 +44,7 @@
 public class XSDActionBarContributor extends MultiPageEditorActionBarContributor
 {
   protected XSDEditor xsdEditor;
-  protected XSDTextEditor textEditor;
+  protected ITextEditor textEditor;
   protected IEditorActionBarContributor sourceViewerActionContributor = null;
   
   protected ReloadDependenciesAction reloadDependenciesAction;
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java
index b3a1caf..77792cf 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDMultiPageEditorPart.java
@@ -50,9 +50,9 @@
 import org.eclipse.wst.sse.ui.StructuredTextEditor;
 import org.eclipse.wst.sse.ui.internal.provisional.extensions.ISourceEditingTextTools;
 import org.eclipse.wst.xml.core.internal.provisional.IXMLPreferenceNames;
+import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML;
 import org.eclipse.wst.xml.ui.internal.Logger;
 import org.eclipse.wst.xml.ui.internal.provisional.IDOMSourceEditingTextTools;
-import org.eclipse.wst.xml.ui.internal.provisional.StructuredTextEditorXML;
 import org.eclipse.wst.xml.ui.internal.tabletree.XMLEditorMessages;
 import org.w3c.dom.Document;
 
@@ -213,6 +213,12 @@
 					IEditorActionBarContributor multiContributor = XSDMultiPageEditorPart.this.getEditorSite().getActionBarContributor();
 					return contributor;
 				}
+				
+				public String getId() {
+					// sets this id so nested editor is considered xml source
+					// page
+					return ContentTypeIdForXML.ContentTypeID_XML + ".source"; //$NON-NLS-1$;
+				}
 			};
 		}
     else {
@@ -243,7 +249,7 @@
    * @return StructuredTextEditor
    */
   protected StructuredTextEditor createTextEditor() {
-    return new StructuredTextEditorXML();
+    return new StructuredTextEditor();
   }
 
   public void dispose()
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java
index b7b401e..50416a8 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/XSDTextEditor.java
@@ -17,8 +17,6 @@
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.StructuredSelection;
@@ -26,20 +24,18 @@
 import org.eclipse.swt.events.KeyAdapter;
 import org.eclipse.swt.events.KeyEvent;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.actions.ActionContext;
 import org.eclipse.ui.actions.ActionGroup;
 import org.eclipse.ui.texteditor.ITextEditor;
 import org.eclipse.ui.texteditor.ITextEditorActionConstants;
 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
 import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.StructuredTextEditor;
 import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
 import org.eclipse.wst.sse.ui.internal.openon.OpenOnAction;
 import org.eclipse.wst.sse.ui.internal.view.events.INodeSelectionListener;
 import org.eclipse.wst.sse.ui.internal.view.events.NodeSelectionChangedEvent;
 import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.ui.internal.provisional.StructuredTextEditorXML;
 import org.eclipse.wst.xsd.ui.internal.properties.section.XSDTabbedPropertySheetPage;
 import org.eclipse.wst.xsd.ui.internal.provider.CategoryAdapter;
 import org.eclipse.wst.xsd.ui.internal.provider.XSDAdapterFactoryLabelProvider;
@@ -54,7 +50,7 @@
 import org.w3c.dom.Node;
 
 
-public class XSDTextEditor extends StructuredTextEditorXML implements INodeSelectionListener, ISelectionChangedListener
+public class XSDTextEditor extends StructuredTextEditor implements INodeSelectionListener, ISelectionChangedListener
 {
   protected XSDSelectionManager xsdSelectionManager;
   protected XSDModelAdapterFactoryImpl xsdModelAdapterFactory;
@@ -224,15 +220,6 @@
     }
   }
 
-  
-  /*
-   * @see ITextEditor#doRevertToSaved()
-   */
-  public void doRevertToSaved()
-  {
-    super.doRevertToSaved();
-  }
-
   /*
    * @see StructuredTextEditor#update()
    */
@@ -263,37 +250,6 @@
     });
   }
 
- // private static Color dividerColor;
-
-	protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler verticalRuler, int styles) {
-
-		fAnnotationAccess= createAnnotationAccess();
-		fOverviewRuler= createOverviewRuler(getSharedColors());
-
-		StructuredTextViewer sourceViewer = createStructedTextViewer(parent, verticalRuler, styles);
-		initSourceViewer(sourceViewer);
-
-    // end of super createSourceViewer
-		
-    //StructuredAnnotationAccess annotationAccess = new StructuredAnnotationAccess();
-	 // DefaultMarkerAnnotationAccess annotationAccess = new DefaultMarkerAnnotationAccess();
-		
-	//  ISharedTextColors sharedColors = getTextColorsCache();
-////  fOverviewRuler = new OverviewRuler(annotationAccess, OVERVIEW_RULER_WIDTH, sharedColors);
-	//  fOverviewRuler = new OverviewRuler(createAnnotationAccess(), 12, sharedColors);
-	  
-//	  fOverviewRuler.addHeaderAnnotationType(StructuredAnnotationType.ERROR);
-//	  fOverviewRuler.addHeaderAnnotationType(StructuredAnnotationType.WARNING);
-	  
-	 // fSourceViewerDecorationSupport = new SourceViewerDecorationSupport(sourceViewer, fOverviewRuler, annotationAccess, sharedColors);
-    //configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);    
-
-// The following method was removed
-//    sourceViewer.setEditor(this);
-
-		return sourceViewer;
-	}
-
   protected IFile file;
 
 
@@ -310,14 +266,6 @@
   {
     return (XSDEditor)getEditorPart();
   }
- 
-  /**
-   * @see org.eclipse.ui.texteditor.AbstractTextEditor#safelySanityCheckState(IEditorInput)
-   */
-	public void safelySanityCheckState(IEditorInput input)
-  {
-    super.safelySanityCheckState(input);
-  }
 
   protected class WrappedOpenFileAction extends OpenOnAction
   {
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java
index 134b5e1..50304e3 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/BaseGraphicalViewer.java
@@ -107,7 +107,7 @@
     editDomain.addViewer(this);
   
     //jvh - gef port - moved this from below so it is available when adding context menu below
-    menuProvider = new GraphContextMenuProvider(this, menuSelectionProvider, editor.getXSDTextEditor());
+    menuProvider = new GraphContextMenuProvider(this, menuSelectionProvider);
     setContextMenu(menuProvider);
   
     // add context menu to the graph
diff --git a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java
index 3215418..dc539e2 100644
--- a/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java
+++ b/bundles/org.eclipse.wst.xsd.ui/src/org/eclipse/wst/xsd/ui/internal/graph/GraphContextMenuProvider.java
@@ -15,7 +15,6 @@
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.viewers.ISelectionProvider;
 import org.eclipse.wst.xsd.ui.internal.XSDMenuListener;
-import org.eclipse.wst.xsd.ui.internal.XSDTextEditor;
 
 
 public class GraphContextMenuProvider extends ContextMenuProvider
@@ -30,8 +29,7 @@
    */
   public GraphContextMenuProvider(
     EditPartViewer viewer,
-    ISelectionProvider selectionProvider,
-    XSDTextEditor editor)
+    ISelectionProvider selectionProvider)
   {
     super(viewer);
     this.viewer = viewer;
diff --git a/development/org.eclipse.wst.sse.unittests/META-INF/MANIFEST.MF b/development/org.eclipse.wst.sse.unittests/META-INF/MANIFEST.MF
index 0868948..43219cb 100644
--- a/development/org.eclipse.wst.sse.unittests/META-INF/MANIFEST.MF
+++ b/development/org.eclipse.wst.sse.unittests/META-INF/MANIFEST.MF
@@ -35,4 +35,5 @@
  org.eclipse.wst.xsd.validation.tests,
  org.eclipse.wst.wsi.tests,
  org.eclipse.wst.wsdl.tests,
- org.eclipse.wst.css.ui.tests
+ org.eclipse.wst.css.ui.tests,
+ org.eclipse.wst.sse.ui
diff --git a/development/org.eclipse.wst.sse.unittests/plugin.xml b/development/org.eclipse.wst.sse.unittests/plugin.xml
index 7758082..c869906 100644
--- a/development/org.eclipse.wst.sse.unittests/plugin.xml
+++ b/development/org.eclipse.wst.sse.unittests/plugin.xml
@@ -6,7 +6,7 @@
                         name="%XML_Source_Page_Editor.name"
                         icon="icons/sourceEditor.gif"
                         contributorClass="org.eclipse.wst.xml.ui.internal.actions.ActionContributorXML"
-                        class="org.eclipse.wst.xml.ui.internal.provisional.StructuredTextEditorXML"
+                        class="org.eclipse.wst.sse.ui.StructuredTextEditor"
                         symbolicFontName="org.eclipse.wst.sse.ui.textfont"
                         id="org.eclipse.core.runtime.xml.source">
                         <contentTypeBinding