### Eclipse Workspace Patch 1.0 #P org.eclipse.wst.xml.ui Index: src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java,v retrieving revision 1.5 diff -u -r1.5 CleanupActionXMLDelegate.java --- src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java 10 Apr 2007 20:04:55 -0000 1.5 +++ src/org/eclipse/wst/xml/ui/internal/actions/CleanupActionXMLDelegate.java 16 Dec 2007 05:47:01 -0000 @@ -34,6 +34,7 @@ /** * Cleanup action delegate for CSS editor + * @deprecated */ public class CleanupActionXMLDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate { private IEditorPart fEditor; Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/META-INF/MANIFEST.MF,v retrieving revision 1.27 diff -u -r1.27 MANIFEST.MF --- META-INF/MANIFEST.MF 30 Oct 2007 22:42:35 -0000 1.27 +++ META-INF/MANIFEST.MF 16 Dec 2007 05:47:01 -0000 @@ -21,6 +21,7 @@ org.eclipse.wst.xml.ui.internal.dnd;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui", org.eclipse.wst.xml.ui.internal.doubleclick;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui", org.eclipse.wst.xml.ui.internal.editor;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui", + org.eclipse.wst.xml.ui.internal.handlers;x-internal:=true, org.eclipse.wst.xml.ui.internal.hyperlink;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui", org.eclipse.wst.xml.ui.internal.nsedit;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui", org.eclipse.wst.xml.ui.internal.preferences;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui", @@ -54,6 +55,7 @@ org.eclipse.wst.xml.core;bundle-version="[1.1.0,1.2.0)", org.eclipse.wst.common.ui;bundle-version="[1.1.0,1.2.0)", org.eclipse.wst.validation;bundle-version="[1.1.0,1.2.0)", - com.ibm.icu;bundle-version="[3.4.4,4.0.0)" + com.ibm.icu;bundle-version="[3.4.4,4.0.0)", + org.eclipse.core.expressions;bundle-version="3.3.100" Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.4 Index: plugin.xml =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/plugin.xml,v retrieving revision 1.73 diff -u -r1.73 plugin.xml --- plugin.xml 5 Nov 2007 22:20:20 -0000 1.73 +++ plugin.xml 16 Dec 2007 05:47:01 -0000 @@ -1,449 +1,319 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %_UI_CREATE_NEW_XML_FILE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %XMLExampleProjectCreationWizard.description - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %_UI_CREATE_NEW_XML_FILE + + + + + + + + + + + + + + + + + + + + + + + %XMLExampleProjectCreationWizard.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/org/eclipse/wst/xml/ui/internal/handlers/CleanupdocumentHandler.java =================================================================== RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/CleanupdocumentHandler.java diff -N src/org/eclipse/wst/xml/ui/internal/handlers/CleanupdocumentHandler.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/wst/xml/ui/internal/handlers/CleanupdocumentHandler.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2007 Standards for Technology in Automotive Retail 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: + * David Carver - initial API and implementation - bug 212330 - + * Based off CleanupActionXMLDelegate + *******************************************************************************/ + +package org.eclipse.wst.xml.ui.internal.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.wst.sse.core.StructuredModelManager; +import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor; +import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; +import org.eclipse.wst.sse.ui.internal.SSEUIMessages; +import org.eclipse.wst.xml.core.internal.cleanup.CleanupProcessorXML; +import org.eclipse.wst.xml.ui.internal.actions.CleanupDialogXML; +import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; + +public class CleanupdocumentHandler extends AbstractHandler implements IHandler { + + private IEditorPart fEditor; + private IStructuredCleanupProcessor fCleanupProcessor; + + public boolean isEnabled() { +/* boolean enabled = false; + IEditorPart activeEditor = XMLUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + ITextEditor editor = (ITextEditor)activeEditor.getAdapter(ITextEditor.class); + if (editor != null && editor instanceof StructuredTextEditor) { + enabled = true; + } + + return enabled; +*/ + return super.isEnabled(); + } + + public void dispose() { + // nulling out just in case + fEditor = null; + fCleanupProcessor = null; + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + fEditor = HandlerUtil.getActiveEditor(event); + + if (fEditor instanceof XMLMultiPageEditorPart) { + final ITextEditor editor = (ITextEditor) fEditor.getAdapter(ITextEditor.class); + 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()); + + // tell the model that we are about to make a big + // model change + model.aboutToChangeModel(); + + // run + BusyIndicator.showWhile(fEditor.getEditorSite().getWorkbenchWindow().getShell().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(); + } + } + } + } + + return null; + } + + IStructuredCleanupProcessor getCleanupProcessor() { + if (fCleanupProcessor == null) { + fCleanupProcessor = new CleanupProcessorXML(); + } + + return fCleanupProcessor; + } +} #P org.eclipse.wst.sse.ui Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/META-INF/MANIFEST.MF,v retrieving revision 1.29 diff -u -r1.29 MANIFEST.MF --- META-INF/MANIFEST.MF 30 Oct 2007 22:40:59 -0000 1.29 +++ META-INF/MANIFEST.MF 16 Dec 2007 05:47:05 -0000 @@ -55,6 +55,7 @@ org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", org.eclipse.wst.validation;bundle-version="[1.1.0,1.2.0)", org.eclipse.emf.common;bundle-version="[2.2.0,3.0.0)", - com.ibm.icu;bundle-version="[3.4.4,4.0.0)" + com.ibm.icu;bundle-version="[3.4.4,4.0.0)", + org.eclipse.core.expressions;bundle-version="3.3.100" Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.4 Index: plugin.xml =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/plugin.xml,v retrieving revision 1.44 diff -u -r1.44 plugin.xml --- plugin.xml 15 Oct 2007 17:39:51 -0000 1.44 +++ plugin.xml 16 Dec 2007 05:47:05 -0000 @@ -1,387 +1,235 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %sourceEditorFontDefintion.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %sourceEditorFontDefintion.description - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java,v retrieving revision 1.5 diff -u -r1.5 ActionContributor.java --- src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java 8 Nov 2006 21:02:43 -0000 1.5 +++ src/org/eclipse/wst/sse/ui/internal/actions/ActionContributor.java 16 Dec 2007 05:47:08 -0000 @@ -12,11 +12,11 @@ *******************************************************************************/ package org.eclipse.wst.sse.ui.internal.actions; -import java.util.ResourceBundle; +//import java.util.ResourceBundle; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.action.GroupMarker; -import org.eclipse.jface.action.IAction; +//import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IStatusLineManager; import org.eclipse.jface.action.IToolBarManager; @@ -24,21 +24,21 @@ import org.eclipse.jface.action.Separator; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchActionConstants; +//import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.actions.ActionFactory; +//import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.editors.text.TextEditorActionContributor; -import org.eclipse.ui.ide.IDEActionFactory; +//import org.eclipse.ui.ide.IDEActionFactory; import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.ui.texteditor.ITextEditorActionConstants; -import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; -import org.eclipse.ui.texteditor.ITextEditorExtension; +//import org.eclipse.ui.texteditor.ITextEditorActionConstants; +//import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds; +//import org.eclipse.ui.texteditor.ITextEditorExtension; import org.eclipse.ui.texteditor.RetargetTextEditorAction; -import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; +//import org.eclipse.wst.sse.ui.internal.ExtendedEditorActionBuilder; import org.eclipse.wst.sse.ui.internal.GotoAnnotationAction; import org.eclipse.wst.sse.ui.internal.IExtendedContributor; import org.eclipse.wst.sse.ui.internal.ISourceViewerActionBarContributor; -import org.eclipse.wst.sse.ui.internal.SSEUIMessages; +//import org.eclipse.wst.sse.ui.internal.SSEUIMessages; import org.eclipse.wst.sse.ui.internal.ui.OffsetStatusLineContributionItem; /** @@ -85,7 +85,7 @@ public ActionContributor() { super(); - ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle(); +/* ResourceBundle resourceBundle = SSEUIMessages.getResourceBundle(); fCommandsSeparator = new Separator(); @@ -146,11 +146,11 @@ if (_showDebugStatus) { fDebugStatusOffset = new OffsetStatusLineContributionItem(StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET, true, 20); } - } +*/ } protected void addToMenu(IMenuManager menu) { // edit commands - IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); +/* IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT); if (editMenu != null) { editMenu.add(fCommandsSeparator); editMenu.add(fToggleInsertModeAction); @@ -159,7 +159,7 @@ editMenu.add(fCommandsSeparator); editMenu.add(fMenuAdditionsGroupMarker); } - + // source commands String sourceMenuLabel = SSEUIMessages.SourceMenu_label; //$NON-NLS-1$ String sourceMenuId = "sourceMenuId"; // This is just a menu id. No //$NON-NLS-1$ @@ -175,7 +175,7 @@ sourceMenu.add(fShiftRight); sourceMenu.add(fShiftLeft); } - } +*/ } protected void addToPopupMenu(IMenuManager menu) { // add nothing @@ -188,22 +188,22 @@ } protected void addToToolBar(IToolBarManager toolBarManager) { - toolBarManager.add(fToolbarSeparator); +/* toolBarManager.add(fToolbarSeparator); toolBarManager.add(fToolbarAdditionsGroupMarker); - } +*/ } /** * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(IMenuManager) */ public void contributeToMenu(IMenuManager menu) { super.contributeToMenu(menu); - +/* addToMenu(menu); if (extendedContributor != null) { extendedContributor.contributeToMenu(menu); } - } +*/ } /* * (non-Javadoc) @@ -212,12 +212,12 @@ */ public void contributeToPopupMenu(IMenuManager menu) { - addToPopupMenu(menu); +/* addToPopupMenu(menu); if (extendedContributor != null) { extendedContributor.contributeToPopupMenu(menu); } - } +*/ } /* * (non-Javadoc) @@ -240,12 +240,12 @@ public void contributeToToolBar(IToolBarManager toolBarManager) { super.contributeToToolBar(toolBarManager); - addToToolBar(toolBarManager); +/* addToToolBar(toolBarManager); if (extendedContributor != null) { extendedContributor.contributeToToolBar(toolBarManager); } - } +*/ } /** * @see org.eclipse.ui.part.EditorActionBarContributor#dispose() @@ -300,9 +300,9 @@ return; super.setActiveEditor(activeEditor); - ITextEditor textEditor = getTextEditor(activeEditor); +// ITextEditor textEditor = getTextEditor(activeEditor); - IActionBars actionBars = getActionBars(); +/* IActionBars actionBars = getActionBars(); if (actionBars != null) { actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_NEXT_ANNOTATION, fNextAnnotation); actionBars.setGlobalActionHandler(ITextEditorActionDefinitionIds.GOTO_PREVIOUS_ANNOTATION, fPreviousAnnotation); @@ -342,7 +342,7 @@ ((ITextEditorExtension) textEditor).setStatusField(fDebugStatusOffset, StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET); fDebugStatusOffset.setActiveEditor(textEditor); } - } +*/ } /* * (non-Javadoc) @@ -350,19 +350,19 @@ * @see org.eclipse.wst.sse.ui.ISourceViewerActionBarContributor#setViewerSpecificContributionsEnabled(boolean) */ public void setViewerSpecificContributionsEnabled(boolean enabled) { - fShiftRight.setEnabled(enabled); +/* fShiftRight.setEnabled(enabled); fShiftLeft.setEnabled(enabled); fNextAnnotation.setEnabled(enabled); fPreviousAnnotation.setEnabled(enabled); - /* + * fComment.setEnabled(enabled); fUncomment.setEnabled(enabled); - */ + fToggleComment.setEnabled(enabled); fAddBlockComment.setEnabled(enabled); fRemoveBlockComment.setEnabled(enabled); // convert line delimiters are not source viewer-specific - } +*/ } /* * (non-Javadoc) @@ -370,8 +370,8 @@ * @see org.eclipse.wst.sse.ui.extension.IExtendedContributor#updateToolbarActions() */ public void updateToolbarActions() { - if (extendedContributor != null) { +/* if (extendedContributor != null) { extendedContributor.updateToolbarActions(); } - } +*/ } } Index: src/org/eclipse/wst/sse/ui/StructuredTextEditor.java =================================================================== RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/StructuredTextEditor.java,v retrieving revision 1.85 diff -u -r1.85 StructuredTextEditor.java --- src/org/eclipse/wst/sse/ui/StructuredTextEditor.java 3 Dec 2007 18:45:58 -0000 1.85 +++ src/org/eclipse/wst/sse/ui/StructuredTextEditor.java 16 Dec 2007 05:47:07 -0000 @@ -105,6 +105,8 @@ import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; +//import org.eclipse.ui.contexts.IContextActivation; +import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.editors.text.ITextEditorHelpContextIds; import org.eclipse.ui.editors.text.TextEditor; @@ -1509,6 +1511,10 @@ * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createPartControl(org.eclipse.swt.widgets.Composite) */ public void createPartControl(Composite parent) { + + IContextService contextService = (IContextService) getSite().getService(IContextService.class); + contextService.activateContext("org.eclipse.wst.sse.ui.structuredTextEditorScope"); + if (getSourceViewerConfiguration() == null) { ConfigurationAndTarget cat = createSourceViewerConfiguration(); fViewerConfigurationTargetId = cat.getTargetId();