Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 89897 Details for
Bug 212330
can't contribute to the XML or any SSE based menu.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Cleaned up patch to remove plugin.xml formatting
sseuimenus10.patch (text/plain), 90.53 KB, created by
David Carver
on 2008-02-15 20:05:20 EST
(
hide
)
Description:
Cleaned up patch to remove plugin.xml formatting
Filename:
MIME Type:
Creator:
David Carver
Created:
2008-02-15 20:05:20 EST
Size:
90.53 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.sse.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/plugin.xml,v >retrieving revision 1.46 >diff -u -r1.46 plugin.xml >--- plugin.xml 7 Feb 2008 07:46:35 -0000 1.46 >+++ plugin.xml 16 Feb 2008 01:02:44 -0000 >@@ -1,5 +1,5 @@ > <?xml version="1.0" encoding="UTF-8"?> >-<?eclipse version="3.0"?> >+<?eclipse version="3.3"?> > <plugin> > > <extension-point >@@ -405,6 +405,7 @@ > </action> > </objectContribution> > </extension> >+ <!-- > <extension > point="org.eclipse.ui.editorActions"> > <editorContribution >@@ -425,7 +426,8 @@ > </action> > </editorContribution> > </extension> >- >+ --> >+ > <!--================================================================================================--> > <!-- contribute a SearchResultViewPage for Occurrences in file --> > <!--================================================================================================--> >@@ -448,5 +450,31 @@ > <extension-point > id="sourcevalidation" > name="%Source_Validation_Extension_Point.name" >- schema="schema/org.eclipse.wst.sse.ui.sourcevalidation.exsd" /> >+ schema="schema/org.eclipse.wst.sse.ui.sourcevalidation.exsd" /> >+ >+ <extension point="org.eclipse.ui.menus"> >+ <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=edit"> >+ <menu id="sourceMenuId" label="%Source"></menu> >+ </menuContribution> >+ <menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=sourceMenuId"> >+ <menu id="refactorMenuId" label="%Refactor"></menu> >+ </menuContribution> >+ <menuContribution locationURI="menu:sourceMenuId"> >+ <separator name="sourceBegin" visible="false"></separator> >+ <separator name="shiftBegin" visible="true"></separator> >+ <separator name="shiftEnd" visible="true"></separator> >+ <separator name="additions" visible="true"></separator> >+ <separator name="sourceEnd" visible="false"></separator> >+ </menuContribution> >+ <menuContribution locationURI="popup:org.eclipse.core.runtime.xml.source.EditorContext?before=additions"> >+ <menu id="sourcePopupMenuId" label="%Source"> >+ <separator name="sourceBegin" visible="false"></separator> >+ <separator name="additions" visible="true"></separator> >+ <separator name="sourceEnd" visible="false"></separator> >+ </menu> >+ <menu id="refactorPopupMenuId" label="%Refactor"> >+ >+ </menu> >+ </menuContribution> >+ </extension> > </plugin> >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.ui/plugin.properties,v >retrieving revision 1.19 >diff -u -r1.19 plugin.properties >--- plugin.properties 7 Feb 2008 07:46:35 -0000 1.19 >+++ plugin.properties 16 Feb 2008 01:02:44 -0000 >@@ -8,7 +8,7 @@ > # Contributors: > # IBM Corporation - initial API and implementation > # Jens Lukowski/Innoopract - initial renaming/restructuring >-# >+# David Carver - bug 212330 - migrate to org.eclipse.ui.menus extension point > ############################################################################### > providerName=Eclipse.org > pluginName=Structured Source Editor >@@ -66,6 +66,7 @@ > ########################################################################## > Source=&Source > FormatDocument=&Format >+Refactor=Refac&tor > ## > Breakpoint_Extension_Point.name=Breakpoint Extension Point > Source_Validation_Extension_Point.name=Reconcile Validator Extension Point >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 Feb 2008 01:02:46 -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); >@@ -175,7 +175,7 @@ > sourceMenu.add(fShiftRight); > sourceMenu.add(fShiftLeft); > } >- } >+*/ } > > protected void addToPopupMenu(IMenuManager menu) { > // add nothing >@@ -188,21 +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); > } >+*/ > } > > /* >@@ -211,12 +212,13 @@ > * @see org.eclipse.wst.sse.ui.extension.IPopupMenuContributor#contributeToPopupMenu(org.eclipse.jface.action.IMenuManager) > */ > public void contributeToPopupMenu(IMenuManager menu) { >- >+/* > addToPopupMenu(menu); > > if (extendedContributor != null) { > extendedContributor.contributeToPopupMenu(menu); > } >+*/ > } > > /* >@@ -240,11 +242,12 @@ > public void contributeToToolBar(IToolBarManager toolBarManager) { > super.contributeToToolBar(toolBarManager); > >- addToToolBar(toolBarManager); >+/* addToToolBar(toolBarManager); > > if (extendedContributor != null) { > extendedContributor.contributeToToolBar(toolBarManager); > } >+*/ > } > > /** >@@ -300,9 +303,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,6 +345,7 @@ > ((ITextEditorExtension) textEditor).setStatusField(fDebugStatusOffset, StructuredTextEditorActionConstants.STATUS_CATEGORY_OFFSET); > fDebugStatusOffset.setActiveEditor(textEditor); > } >+*/ > } > > /* >@@ -350,18 +354,21 @@ > * @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 >+ > } > > /* >@@ -370,8 +377,9 @@ > * @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.86 >diff -u -r1.86 StructuredTextEditor.java >--- src/org/eclipse/wst/sse/ui/StructuredTextEditor.java 15 Jan 2008 23:40:17 -0000 1.86 >+++ src/org/eclipse/wst/sse/ui/StructuredTextEditor.java 16 Feb 2008 01:02:46 -0000 >@@ -103,6 +103,7 @@ > import org.eclipse.ui.IWorkbenchActionConstants; > import org.eclipse.ui.PartInitException; > import org.eclipse.ui.PlatformUI; >+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; >@@ -1128,16 +1129,16 @@ > protected void addContextMenuActions(IMenuManager menu) { > // Only offer actions that affect the text if the viewer allows > // modification and supports any of these operations >- IAction formatAll = getAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT); >- IAction formatSelection = getAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS); >- IAction cleanupAll = getAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT); >- boolean enableFormatMenu = (formatAll != null && formatAll.isEnabled()) || (formatSelection != null && formatSelection.isEnabled()) || (cleanupAll != null && cleanupAll.isEnabled()); >- >- if (getSourceViewer().isEditable() && enableFormatMenu) { >- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT); >- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS); >- addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT); >- } >+// IAction formatAll = getAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT); >+// IAction formatSelection = getAction(StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS); >+// IAction cleanupAll = getAction(StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT); >+// boolean enableFormatMenu = (formatAll != null && formatAll.isEnabled()) || (formatSelection != null && formatSelection.isEnabled()) || (cleanupAll != null && cleanupAll.isEnabled()); >+// >+// if (getSourceViewer().isEditable() && enableFormatMenu) { >+// addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT); >+// addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS); >+// addAction(menu, ITextEditorActionConstants.GROUP_EDIT, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT); >+// } > > // Some Design editors (DTD) rely on this view for their own uses > menu.appendToGroup(IWorkbenchActionConstants.GROUP_ADD, fShowPropertiesAction); >@@ -1445,6 +1446,9 @@ > * @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(); >#P org.eclipse.wst.xml.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/plugin.properties,v >retrieving revision 1.28 >diff -u -r1.28 plugin.properties >--- plugin.properties 31 Jan 2008 02:24:23 -0000 1.28 >+++ plugin.properties 16 Feb 2008 01:02:47 -0000 >@@ -10,7 +10,7 @@ > # Jens Lukowski/Innoopract - initial renaming/restructuring > # David Carver / STAR Standards - added XML Catalog Import/Export Wizard > # bug 192568 >-# >+# David Carver / STAR Standards - bug 212330 - migrate to org.eclipse.ui.menus > ############################################################################### > providerName=Eclipse.org > pluginName=XML UI Plugin >@@ -75,6 +75,7 @@ > StructureSelectPrevious_tooltip=Expand selection to include previous sibling > StructureSelectHistory_label=Restore Last Selection > StructureSelectHistory_tooltip=Restore last selection >+SmartInsert_label=Sma&rt Auto Insert > ## > preferenceKeywords.files=editor xml creating saving files line delimiter suffix specified encoding iana validating warn grammar > preferenceKeywords.source=editor xml source formatting line width split multiple attributes new clear blank indent tabs spaces size content assist automatically suggestions prompt characters inserted strategy lax strict grammar constraints inferred absence dtd schema >@@ -83,4 +84,14 @@ > preferenceKeywords.xmlcatalog=xml catalog entries > ## > XML_Source_target_name=XML Source >-XML_hyperlink=Tags And Attributes >\ No newline at end of file >+XML_hyperlink=Tags And Attributes >+## >+DesignMenu_name=&Design >+Format_mnemonic=F >+FormatElements_mnemonic=i >+ReloadDependencies_name=&Reload Dependencies >+ReloadDependencies_description=Reload Dependencies >+Constraints_name=&Turn off Grammar Constraints >+Constraints_description=Turn off grammar Constraints >+ExpandAll_name=Expand All >+CollapseAll_name=Collapse All >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/plugin.xml,v >retrieving revision 1.77 >diff -u -r1.77 plugin.xml >--- plugin.xml 31 Jan 2008 02:24:23 -0000 1.77 >+++ plugin.xml 16 Feb 2008 01:02:48 -0000 >@@ -1,5 +1,5 @@ > <?xml version="1.0" encoding="UTF-8"?> >-<?eclipse version="3.0"?> >+<?eclipse version="3.3"?> > <plugin> > > <extension-point id="catalogFileType" name="%XML_Catalog_File_Type_Extension_Point.name" schema="schema/catalogFileType.exsd"/> >@@ -259,7 +259,8 @@ > > <!-- =============================================================================== --> > <!-- Allow the 'New XML' wizard to be accessed via the 'Generate' menu on a XSD file --> >- <!-- =============================================================================== --> >+ <!-- =============================================================================== --> >+<!-- > <extension point="org.eclipse.ui.popupMenus"> > <objectContribution > objectClass="org.eclipse.core.resources.IFile" >@@ -280,10 +281,12 @@ > </action> > </objectContribution> > </extension> >+--> > > <!-- =============================================================================== --> > <!-- Allow the 'New XML' wizard to be accessed via the 'Generate' menu on a DTD file --> >- <!-- =============================================================================== --> >+ <!-- =============================================================================== --> >+<!-- > <extension point="org.eclipse.ui.popupMenus"> > <objectContribution > objectClass="org.eclipse.core.resources.IFile" >@@ -304,6 +307,7 @@ > </action> > </objectContribution> > </extension> >+--> > > <!-- =============================================================================== --> > <!-- Contribute a New->Example... entry for Editing and Validating XML files --> >@@ -398,7 +402,7 @@ > </provider> > </extension> > >- >+ <!-- To Do: migrate this to the org.eclipse.ui.menus popup: format --> > <extension point="org.eclipse.ui.popupMenus"> > <viewerContribution > targetID="org.eclipse.core.runtime.xml.source.RulerContext" >@@ -448,7 +452,7 @@ > </objectContribution> > </extension> > >- >+<!-- > <extension point="org.eclipse.ui.editorActions"> > <editorContribution > id="org.eclipse.core.runtime.xml.source.editorActions" >@@ -540,7 +544,9 @@ > actionID="RulerClick" > id="org.eclipse.ui.texteditor.SelectRulerAction"/> > </editorContribution> >- </extension> >+ </extension> >+--> >+ > <extension > point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectorTargets"> > <target >@@ -590,5 +596,446 @@ > %_UI_EXPORT_XML_CATALOG_FILE > </description> > </wizard> >- </extension> >+ </extension> >+ >+ <!-- >+ This section contains the new org.eclipse.ui.menus extions points and command handler >+ definitions. >+ --> >+ >+ <extension point="org.eclipse.ui.menus"> >+ <menuContribution locationURI="menu:sourceMenuId?after=sourceBegin"> >+ <command commandId="org.eclipse.wst.sse.ui.toggle.comment" >+ id="ToggleComment" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.add.block.comment" >+ id="AddBlockComment" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.remove.block.comment" >+ id="RemoveBlockComment" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ >+ <menuContribution locationURI="menu:sourceMenuId?after=shiftBegin"> >+ <command commandId="org.eclipse.ui.edit.text.shiftLeft" >+ id="ShiftLeft" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.ui.edit.text.shiftRight" >+ id="ShiftRight" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ >+ <menuContribution locationURI="menu:sourceMenuId?after=shiftEnd"> >+ <command >+ commandId="org.eclipse.wst.sse.ui.cleanup.document" >+ id="CleanupDocument" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.format.document" id="FormatDocument" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.format.active.elements" id="FormatElements" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ <menuContribution locationURI="menu:org.eclipse.search.menu?after=additions"> >+ <command commandId="org.eclipse.wst.sse.ui.search.find.occurrences" id="OccurencesFile" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ >+ <menuContribution locationURI="menu:edit?after=additions"> >+ <command commandId="org.eclipse.ui.edit.text.toggleInsertMode" id="ToggleInsertMode" label="%SmartInsert_label" style="toggle"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ >+ <menuContribution >+ locationURI="menu:org.eclipse.ui.main.menu?before=window"> >+ <menu >+ id="org.eclipse.wst.xml.ui.designMenuId" >+ label="%DesignMenu_name"> >+ <separator >+ name="designStart"> >+ </separator> >+ <command >+ commandId="org.eclipse.wst.xml.ui.disable.grammar.constraints" >+ icon="icons/full/etool16/constrainon.gif" >+ id="ToggleGrammarConstraints" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <and> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ <not> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </not> >+ </and> >+ </visibleWhen> >+ </command> >+ <command >+ commandId="org.eclipse.wst.xml.ui.reload.dependecies" >+ icon="icons/full/etool16/rldgrmr.gif" >+ id="ReloadDependencies" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <and> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ <not> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"/> >+ </not> >+ </and> >+ </visibleWhen> >+ </command> >+ <separator >+ name="expand" >+ visible="true"> >+ </separator> >+ >+ <command >+ commandId="sed.tabletree.expandAll" >+ icon="icons/full/etool16/expand_all.gif" >+ id="ExpandAll" >+ style="push"> >+ </command> >+ <command >+ commandId="sed.tabletree.collapseAll" >+ icon="icons/full/etool16/collapse_all.gif" >+ id="CollapseAll" >+ style="push"> >+ </command> >+ >+ <separator >+ name="additions" >+ visible="true"> >+ </separator> >+ <separator >+ name="designEnd" >+ visible="false"> >+ </separator> >+ </menu> >+ </menuContribution> >+ >+ <menuContribution >+ locationURI="popup:sourcePopupMenuId?after=sourceBegin"> >+ <command commandId="org.eclipse.wst.sse.ui.toggle.comment" id="ToggleComment" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.add.block.comment" id="AddBlockComment" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.remove.block.comment" id="RemoveBlockComment" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ <separator name="format" visible="true"></separator> >+ <command >+ commandId="org.eclipse.wst.sse.ui.cleanup.document" >+ id="CleanupDocument" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"></reference> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.format.document" id="FormatDocument" mnemonic="%Format_mnemonic" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"></reference> >+ </visibleWhen> >+ </command> >+ <command commandId="org.eclipse.wst.sse.ui.format.active.elements" id="FormatElements" mnemonic="%FormatElements_mnemonic" style="push"> >+ <visibleWhen checkEnabled="false"> >+ <reference definitionId="org.eclipse.wst.xml.ui.sseActiveContext.definition"></reference> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ >+ <menuContribution >+ locationURI="popup:org.eclipse.ui.popup.any?after=additions"> >+ <menu >+ id="generateMenuId" >+ label="%genMenuLabel"> >+ <command >+ commandId="org.eclipse.wst.sse.ui.generate.xml" >+ id="GenerateXML" >+ style="push"> >+ <visibleWhen checkEnabled="false"> >+ <or> >+ <iterate> >+ <adapt >+ type="org.eclipse.core.resources.IFile"> >+ <test >+ property="org.eclipse.core.resources.contentTypeId" >+ value="org.eclipse.wst.xsd.core.xsdsource"> >+ </test> >+ </adapt> >+ </iterate> >+ <iterate> >+ <adapt >+ type="org.eclipse.core.resources.IFile"> >+ <test >+ property="org.eclipse.core.resources.contentTypeId" >+ value="org.eclipse.wst.dtd.core.dtdsource"> >+ </test> >+ </adapt> >+ </iterate> >+ </or> >+ </visibleWhen> >+ </command> >+ </menu> >+ </menuContribution> >+ >+ <menuContribution >+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions"> >+ <toolbar >+ id="org.eclipse.wst.xml.ui.design.DesignToolBar"> >+ <separator >+ name="sed.tabletree.separator.1" >+ visible="true"> >+ </separator> >+ <command >+ commandId="org.eclipse.wst.xml.ui.disable.grammar.constraints" >+ icon="icons/full/etool16/constrainon.gif" >+ id="ToggleGrammarConstraints" >+ style="push" >+ tooltip="%Constraints_name"> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"> >+ </reference> >+ </visibleWhen> >+ </command> >+ <command >+ commandId="org.eclipse.wst.xml.ui.reload.dependecies" >+ icon="icons/full/etool16/rldgrmr.gif" >+ id="ReloadDependencies" >+ style="push"> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"> >+ </reference> >+ </visibleWhen> >+ </command> >+ <separator >+ name="sed.tabletree.separator.2" >+ visible="true"> >+ </separator> >+ <command >+ commandId="sed.tabletree.expandAll" >+ icon="icons/full/etool16/expand_all.gif" >+ id="ExpandAll" >+ style="push"> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"> >+ </reference> >+ </visibleWhen> >+ </command> >+ <command >+ commandId="sed.tabletree.collapseAll" >+ icon="icons/full/etool16/collapse_all.gif" >+ id="CollapseAll" >+ style="push"> >+ <visibleWhen >+ checkEnabled="false"> >+ <reference >+ definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"> >+ </reference> >+ </visibleWhen> >+ </command> >+ </toolbar> >+ </menuContribution> >+ </extension> >+ >+ <extension point="org.eclipse.core.expressions.definitions"> >+ <definition id="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"> >+ <with variable="activeEditorId"> >+ <equals value="org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart"></equals> >+ </with> >+ </definition> >+ <definition id="org.eclipse.wst.xml.ui.sseActiveContext.definition"> >+ <with variable="activeContexts"> >+ <iterate operator="or"> >+ <equals value="org.eclipse.wst.sse.ui.structuredTextEditorScope"/> >+ </iterate> >+ </with> >+ </definition> >+ >+ <definition id="org.eclipse.wst.xml.ui.generate.xml"> >+ <iterate> >+ <adapt type="org.eclipse.core.resources.IFile"> >+ <test property="org.eclipse.core.resources.name" >+ value="*.xsd"/> >+ <test property="org.eclipse.core.resources.name" >+ value="*.dtd"/> >+ </adapt> >+ </iterate> >+ </definition> >+ </extension> >+ <extension >+ point="org.eclipse.ui.handlers"> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.CleanupdocumentHandler" >+ commandId="org.eclipse.wst.sse.ui.cleanup.document"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.ToggleCommentHandler" >+ commandId="org.eclipse.wst.sse.ui.toggle.comment"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.AddBlockCommentHandler" >+ commandId="org.eclipse.wst.sse.ui.add.block.comment"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.RemoveBlockCommentHandler" >+ commandId="org.eclipse.wst.sse.ui.remove.block.comment"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.XMLFindOccurencesHandler" >+ commandId="org.eclipse.wst.sse.ui.search.find.occurrences"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.ReloadDependenciesHandler" >+ commandId="org.eclipse.wst.xml.ui.reload.dependecies"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.ToggleEditModeHandler" >+ commandId="org.eclipse.wst.xml.ui.disable.grammar.constraints"> >+ <activeWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </activeWhen> >+ <enabledWhen> >+ <reference definitionId="org.eclipse.wst.xml.ui.xmlSourceContributions.definition"/> >+ </enabledWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.wizards.NewXMLHandler" >+ commandId="org.eclipse.wst.sse.ui.generate.xml"> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.ExpandAllHandler" >+ commandId="sed.tabletree.expandAll"> >+ <activeWhen> >+ <not> >+ <with variable="activeContexts"> >+ <iterate operator="or"> >+ <equals value="org.eclipse.wst.sse.ui.structuredTextEditorScope"/> >+ </iterate> >+ </with> >+ </not> >+ </activeWhen> >+ </handler> >+ <handler >+ class="org.eclipse.wst.xml.ui.internal.handlers.CollapseAllHandler" >+ commandId="sed.tabletree.collapseAll"> >+ <activeWhen> >+ <not> >+ <with variable="activeContexts"> >+ <iterate operator="or"> >+ <equals value="org.eclipse.wst.sse.ui.structuredTextEditorScope"/> >+ </iterate> >+ </with> >+ </not> >+ </activeWhen> >+ </handler> >+ </extension> >+ >+ <extension >+ point="org.eclipse.ui.commands"> >+ <command >+ id="org.eclipse.wst.sse.ui.generate.xml" >+ name="%_UI_ACTION_CREATE_XML"> >+ </command> >+ <command >+ description="%ReloadDependencies_description" >+ id="org.eclipse.wst.xml.ui.reload.dependecies" >+ name="%ReloadDependencies_name"> >+ </command> >+ <command >+ description="%Constraints_description" >+ id="org.eclipse.wst.xml.ui.disable.grammar.constraints" >+ name="%Constraints_name"> >+ </command> >+ <command >+ id="sed.tabletree.expandAll" >+ name="%ExpandAll_name"> >+ </command> >+ <command >+ id="sed.tabletree.collapseAll" >+ name="%CollapseAll_name"> >+ </command> >+ </extension> > </plugin> >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 Feb 2008 01:02:48 -0000 >@@ -54,6 +54,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.0,4.0.0)" > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >Index: src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java,v >retrieving revision 1.16 >diff -u -r1.16 XMLTableTreeActionBarContributor.java >--- src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java 10 Apr 2007 20:04:57 -0000 1.16 >+++ src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLTableTreeActionBarContributor.java 16 Feb 2008 01:02:48 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * David Carver - bug 212330 - migrate to org.eclipse.ui.menus extension point > *******************************************************************************/ > package org.eclipse.wst.xml.ui.internal.tabletree; > >@@ -14,14 +15,14 @@ > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.action.IContributionManager; > import org.eclipse.jface.action.IMenuManager; >-import org.eclipse.jface.action.IToolBarManager; >-import org.eclipse.jface.action.MenuManager; >-import org.eclipse.jface.action.Separator; >+//import org.eclipse.jface.action.IToolBarManager; >+//import org.eclipse.jface.action.MenuManager; >+//import org.eclipse.jface.action.Separator; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.ui.IActionBars; > import org.eclipse.ui.IEditorPart; > import org.eclipse.ui.IEditorSite; >-import org.eclipse.ui.IWorkbenchActionConstants; >+//import org.eclipse.ui.IWorkbenchActionConstants; > import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkbenchPartSite; > import org.eclipse.ui.texteditor.ITextEditor; >@@ -62,7 +63,7 @@ > } > > protected void removeContributions(IContributionManager manager) { >- try { >+/* try { > doRemove(manager, DESIGN_VIEWER_SEPARATOR_1_ID); > doRemove(manager, DESIGN_VIEWER_SEPARATOR_2_ID); > doRemove(manager, VALIDATE_XML_ID); >@@ -73,26 +74,27 @@ > } > catch (Exception e) { > } >+*/ > } > > protected void doRemove(IContributionManager manager, String id) { >- try { >+/* try { > if (manager.find(id) != null) { > manager.remove(id); > } > } > catch (Exception e) { > } >- } >+*/ } > > public void init(IActionBars bars, IWorkbenchPage page) { > init(bars); > } > > public void init(IActionBars bars) { >- IToolBarManager tbm = bars.getToolBarManager(); >+// IToolBarManager tbm = bars.getToolBarManager(); > >- IMenuManager xmlMenu = bars.getMenuManager().findMenuUsingPath("org.eclipse.core.runtime.xml.design.xmlmenu"); //$NON-NLS-1$ >+/* IMenuManager xmlMenu = bars.getMenuManager().findMenuUsingPath("org.eclipse.core.runtime.xml.design.xmlmenu"); //$NON-NLS-1$ > > if (xmlMenu == null) { > xmlMenu = new MenuManager(XMLEditorMessages.XMLTableTreeActionBarContributor_0, "org.eclipse.core.runtime.xml.design.xmlmenu"); //$NON-NLS-1$ >@@ -103,7 +105,7 @@ > } > > tbm.add(new Separator("DESIGN_VIEWER_SEPARATOR_1_ID")); //$NON-NLS-1$ >- >+*/ > // ValidateXMLAction > // > // ugly hack ... we don't contribute the generic XML validator if we >@@ -119,23 +121,23 @@ > > // ToggleEditModeAction > // >- toggleAction = new ToggleEditModeAction(); >+/* toggleAction = new ToggleEditModeAction(); > toggleAction.setId(TOGGLE_EDIT_MODE_ID); > xmlMenu.add(toggleAction); > tbm.add(toggleAction); >- >+*/ > // ReloadGrammarAction > // >- reloadGrammarAction = new ReloadGrammarAction(); >+/* reloadGrammarAction = new ReloadGrammarAction(); > reloadGrammarAction.setId(RELOAD_GRAMMAR_ID); > tbm.add(reloadGrammarAction); > xmlMenu.add(reloadGrammarAction); > > xmlMenu.add(new Separator()); >- >+*/ > // ExpandCollapseAction > // >- xmlMenuExpandAction = new ViewerExpandCollapseAction(true); >+/* xmlMenuExpandAction = new ViewerExpandCollapseAction(true); > xmlMenuExpandAction.setId(EXPAND_ALL_ID); > xmlMenuExpandAction.setText(XMLEditorMessages.XMLTableTreeActionBarContributor_1); > xmlMenu.add(xmlMenuExpandAction); >@@ -145,6 +147,7 @@ > xmlMenuCollapseAction.setId(EXPAND_ALL_ID); > xmlMenuCollapseAction.setText(XMLEditorMessages.XMLTableTreeActionBarContributor_2); > xmlMenu.add(xmlMenuCollapseAction); >+*/ > } > > protected void addActionWithId(IMenuManager menuManager, Action action, String id) { >@@ -153,7 +156,7 @@ > } > > public void initViewerSpecificContributions(IActionBars bars) { >- IToolBarManager tbm = bars.getToolBarManager(); >+/* IToolBarManager tbm = bars.getToolBarManager(); > tbm.add(new Separator(DESIGN_VIEWER_SEPARATOR_2_ID)); > > expandAction = new ViewerExpandCollapseAction(true); >@@ -163,10 +166,11 @@ > collapseAction = new ViewerExpandCollapseAction(false); > collapseAction.setId(COLLAPSE_ALL_ID); > tbm.add(collapseAction); >+*/ > } > > public void setViewerSpecificContributionsEnabled(boolean enabled) { >- if (expandAction != null) { >+/* if (expandAction != null) { > expandAction.setEnabled(enabled); > xmlMenuExpandAction.setEnabled(enabled); > } >@@ -175,13 +179,14 @@ > collapseAction.setEnabled(enabled); > xmlMenuCollapseAction.setEnabled(enabled); > } >+*/ > } > > public void setActiveEditor(IEditorPart targetEditor) { > editorPart = targetEditor; > >- IStructuredModel model = getModelForEditorPart(targetEditor); >- reloadGrammarAction.setModel(model); >+// IStructuredModel model = getModelForEditorPart(targetEditor); >+/* reloadGrammarAction.setModel(model); > toggleAction.setModelQuery(ModelQueryUtil.getModelQuery(model)); > > XMLTableTreeViewer tableTreeViewer = getTableTreeViewerForEditorPart(editorPart); >@@ -192,7 +197,7 @@ > xmlMenuExpandAction.setViewer(tableTreeViewer); > xmlMenuCollapseAction.setViewer(tableTreeViewer); > } >- >+*/ > if (editorPart instanceof XMLMultiPageEditorPart) { > IWorkbenchPartSite site = editorPart.getSite(); > if (site instanceof IEditorSite) { >Index: src/org/eclipse/wst/xml/ui/internal/handlers/ExpandCollapseAllHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/ExpandCollapseAllHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/ExpandCollapseAllHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/ExpandCollapseAllHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import java.util.Map; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.commands.IElementUpdater; >+import org.eclipse.ui.menus.UIElement; >+import org.eclipse.wst.xml.ui.internal.tabletree.IDesignViewer; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeViewer; >+ >+public class ExpandCollapseAllHandler extends AbstractHandler implements IElementUpdater { >+ >+ protected XMLTableTreeViewer viewer = null; >+ >+ /** >+ * Command handler for handling Expand and Collapse for Tree Viewer >+ */ >+ public ExpandCollapseAllHandler() { >+ super(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) >+ */ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ // Implementors to put their code here. >+ >+ return null; >+ } >+ >+ protected XMLTableTreeViewer getTableTreeViewerForEditorPart(IEditorPart targetEditor) { >+ XMLTableTreeViewer result = null; >+ Object object = targetEditor.getAdapter(IDesignViewer.class); >+ if (object instanceof XMLTableTreeViewer) { >+ result = (XMLTableTreeViewer) object; >+ } >+ return result; >+ } >+ >+ public void updateElement(UIElement element, Map parameters) { >+ // TODO Auto-generated method stub >+ >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/ReloadDependenciesHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/ReloadDependenciesHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/ReloadDependenciesHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/ReloadDependenciesHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,67 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+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.ui.IEditorPart; >+import org.eclipse.ui.handlers.HandlerUtil; >+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.xml.core.internal.contentmodel.modelquery.ModelQuery; >+import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.CMDocumentLoader; >+import org.eclipse.wst.xml.core.internal.contentmodel.modelqueryimpl.InferredGrammarBuildingCMDocumentLoader; >+import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; >+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; >+import org.w3c.dom.Document; >+ >+public class ReloadDependenciesHandler extends AbstractHandler implements >+ IHandler { >+ protected IStructuredModel model; >+ >+ /** >+ * >+ */ >+ public ReloadDependenciesHandler() { >+ // TODO Auto-generated constructor stub >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) >+ */ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ IEditorPart fEditor = HandlerUtil.getActiveEditor(event); >+ >+ if (fEditor instanceof XMLMultiPageEditorPart) { >+ StructuredTextEditor textEditor = (StructuredTextEditor) fEditor.getAdapter(ITextEditor.class); >+ model = (textEditor != null) ? textEditor.getModel() : null; >+ } >+ >+ if (model != null) { >+ ModelQuery modelQuery = ModelQueryUtil.getModelQuery(model); >+ Document document = ((IDOMModel) model).getDocument(); >+ if ((modelQuery != null) && (modelQuery.getCMDocumentManager() != null)) { >+ modelQuery.getCMDocumentManager().getCMDocumentCache().clear(); >+ // TODO... need to figure out how to access the >+ // DOMObserver via ModelQuery >+ // ...why? >+ CMDocumentLoader loader = new InferredGrammarBuildingCMDocumentLoader(document, modelQuery); >+ loader.loadCMDocuments(); >+ } >+ } >+ return null; >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/RemoveBlockCommentHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/RemoveBlockCommentHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/RemoveBlockCommentHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/RemoveBlockCommentHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,83 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import org.eclipse.core.commands.IHandler; >+import org.eclipse.jface.text.BadLocationException; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.wst.sse.core.StructuredModelManager; >+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; >+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; >+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; >+ >+/** >+ * @author dcarver >+ * >+ */ >+public class RemoveBlockCommentHandler extends CommentHandler implements IHandler { >+ >+ public RemoveBlockCommentHandler() { >+ super(); >+ } >+ >+ 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(); >+ } >+ } >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/CollapseAllHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/CollapseAllHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/CollapseAllHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/CollapseAllHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.IHandler; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public class CollapseAllHandler extends ExpandCollapseAllHandler implements IHandler { >+ >+ /** >+ * >+ */ >+ public CollapseAllHandler() { >+ super(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) >+ */ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ IEditorPart editorPart = HandlerUtil.getActiveEditor(event); >+ >+ viewer = getTableTreeViewerForEditorPart(editorPart); >+ >+ if (viewer != null) { >+ // temporarily set the visibility to false >+ // this has a HUGE performance benefit >+ boolean isVisible = viewer.getControl().getVisible(); >+ viewer.getControl().setVisible(false); >+ viewer.collapseAll(); >+ >+ // restore the previous visibility state >+ // >+ viewer.getControl().setVisible(isVisible); >+ } >+ >+ return null; >+ } >+} >Index: src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLHandler.java >=================================================================== >RCS file: src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLHandler.java >diff -N src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-wizards/org/eclipse/wst/xml/ui/internal/wizards/NewXMLHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,71 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.wizards; >+ >+import java.util.Iterator; >+ >+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.core.resources.IFile; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public class NewXMLHandler extends AbstractHandler implements IHandler { >+ >+ /** >+ * >+ */ >+ public NewXMLHandler() { >+ super(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) >+ */ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); >+ ISelection selection = workbenchWindow.getSelectionService().getSelection(); >+ Object selectedObject = getSelection(selection); >+ >+ if ((selectedObject instanceof IFile) && (selection instanceof IStructuredSelection)) { >+ IFile file = (IFile) selectedObject; >+ IStructuredSelection structuredSelection = (IStructuredSelection) selection; >+ try { >+ NewXMLWizard.showDialog(workbenchWindow.getShell(), file, structuredSelection); >+ } >+ catch (Exception e) { >+ // XMLCorePlugin.getDefault().getLog().log(); >+ } >+ } >+ return null; >+ } >+ >+ public static Object getSelection(ISelection selection) { >+ if (selection == null) { >+ return null; >+ } >+ >+ Object result = null; >+ if (selection instanceof IStructuredSelection) { >+ IStructuredSelection es = (IStructuredSelection) selection; >+ Iterator i = es.iterator(); >+ if (i.hasNext()) { >+ result = i.next(); >+ } >+ } >+ return result; >+ } >+} >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,116 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 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; >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/ToggleEditModeHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/ToggleEditModeHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/ToggleEditModeHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/ToggleEditModeHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,112 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.jface.resource.ImageDescriptor; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.commands.ICommandService; >+import org.eclipse.ui.commands.IElementUpdater; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.ui.menus.UIElement; >+import org.eclipse.ui.services.IServiceScopes; >+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.xml.core.internal.contentmodel.modelquery.ModelQuery; >+import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil; >+import org.eclipse.wst.xml.ui.internal.XMLUIPlugin; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLEditorMessages; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; >+import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper; >+ >+public class ToggleEditModeHandler extends AbstractHandler implements IElementUpdater { >+ protected ImageDescriptor onImage = SharedXMLEditorPluginImageHelper.getImageDescriptor(SharedXMLEditorPluginImageHelper.IMG_ETOOL_CONSTRAINON); >+ protected ImageDescriptor offImage = SharedXMLEditorPluginImageHelper.getImageDescriptor(SharedXMLEditorPluginImageHelper.IMG_ETOOL_CONSTRAINOFF); >+ protected ModelQuery modelQuery; >+ >+ public ToggleEditModeHandler() { >+ super(); >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ IEditorPart editor = HandlerUtil.getActiveEditor(event); >+ IStructuredModel model = getModelForEditorPart(editor); >+ >+ modelQuery = ModelQueryUtil.getModelQuery(model); >+ >+ if (modelQuery != null) { >+ int newState = getNextState(modelQuery.getEditMode()); >+ modelQuery.setEditMode(newState); >+ >+ // Force a Refresh on this command so that the image can be updated. >+ ICommandService commandService = (ICommandService) HandlerUtil.getActiveWorkbenchWindow(event).getService(ICommandService.class); >+ Map filter = new HashMap(); >+ filter.put(IServiceScopes.WINDOW_SCOPE, HandlerUtil.getActiveWorkbenchWindow(event)); >+ commandService.refreshElements(event.getCommand().getId(), filter); >+ } >+ >+ return null; >+ } >+ >+ public int getNextState(int editMode) { >+ int result = -1; >+ if (editMode == ModelQuery.EDIT_MODE_CONSTRAINED_STRICT) { >+ result = ModelQuery.EDIT_MODE_UNCONSTRAINED; >+ } >+ else { >+ result = ModelQuery.EDIT_MODE_CONSTRAINED_STRICT; >+ } >+ return result; >+ } >+ >+ >+ // Handlers that need to interact with the ui that the command came from need to use implement this method. >+ public void updateElement(UIElement element, Map parameters) { >+ IEditorPart editor = XMLUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); >+ IStructuredModel model = getModelForEditorPart(editor); >+ modelQuery = ModelQueryUtil.getModelQuery(model); >+ >+ if (modelQuery != null) { >+ setAppearanceForEditMode(modelQuery.getEditMode(), element); >+ } >+ >+ >+ } >+ >+ public void setAppearanceForEditMode(int editMode, UIElement element) { >+ if (editMode == ModelQuery.EDIT_MODE_CONSTRAINED_STRICT) { >+ element.setTooltip(XMLEditorMessages.XMLTableTreeActionBarContributor_3); >+ element.setText(XMLEditorMessages.XMLTableTreeActionBarContributor_4); >+ element.setIcon(onImage); >+ } >+ else { >+ element.setTooltip(XMLEditorMessages.XMLTableTreeActionBarContributor_5); >+ element.setText(XMLEditorMessages.XMLTableTreeActionBarContributor_6); >+ element.setIcon(offImage); >+ } >+ } >+ >+ protected IStructuredModel getModelForEditorPart(IEditorPart targetEditor) { >+ IStructuredModel result = null; >+ if (targetEditor instanceof XMLMultiPageEditorPart) { >+ StructuredTextEditor textEditor = (StructuredTextEditor) targetEditor.getAdapter(ITextEditor.class); >+ result = (textEditor != null) ? textEditor.getModel() : null; >+ } >+ return result; >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/XMLFindOccurencesHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/XMLFindOccurencesHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/XMLFindOccurencesHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/XMLFindOccurencesHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,134 @@ >+/******************************************************************************* >+ * 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 java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+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.core.resources.IFile; >+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.ui.IEditorPart; >+import org.eclipse.ui.IFileEditorInput; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.wst.sse.ui.internal.SSEUIMessages; >+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor; >+import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil; >+import org.eclipse.wst.xml.ui.internal.search.XMLFindOccurrencesProcessor; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; >+ >+public class XMLFindOccurencesHandler extends AbstractHandler implements IHandler { >+ >+ private IEditorPart fEditor; >+ private List fProcessors; >+ >+ public void dispose() { >+ // nulling out just in case >+ fEditor = null; >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ fEditor = HandlerUtil.getActiveEditor(event); >+ boolean okay = false; >+ >+ if (fEditor instanceof XMLMultiPageEditorPart) { >+ final ITextEditor textEditor = (ITextEditor) fEditor.getAdapter(ITextEditor.class); >+ 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(); >+ } >+ >+ return null; >+ } >+ >+ /** >+ * Get the appropriate find occurrences processor >+ * >+ * @param document - >+ * assumes not null >+ * @param textSelection >+ * @return FindOccurrencesProcessor >+ */ >+ 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; >+ } >+ >+ protected List getProcessors() { >+ if (fProcessors == null) { >+ fProcessors = new ArrayList(); >+ XMLFindOccurrencesProcessor htmlProcessor = new XMLFindOccurrencesProcessor(); >+ fProcessors.add(htmlProcessor); >+ } >+ return fProcessors; >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/ExpandAllHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/ExpandAllHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/ExpandAllHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/ExpandAllHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,54 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLTableTreeViewer; >+ >+public class ExpandAllHandler extends ExpandCollapseAllHandler { >+ >+ protected XMLTableTreeViewer viewer = null; >+ >+ /** >+ * >+ */ >+ public ExpandAllHandler() { >+ super(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) >+ */ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ >+ IEditorPart editorPart = HandlerUtil.getActiveEditor(event); >+ >+ viewer = getTableTreeViewerForEditorPart(editorPart); >+ >+ if (viewer != null) { >+ // temporarily set the visibility to false >+ // this has a HUGE performance benefit >+ boolean isVisible = viewer.getControl().getVisible(); >+ viewer.getControl().setVisible(false); >+ viewer.expandAll(); >+ >+ // restore the previous visibility state >+ // >+ viewer.getControl().setVisible(isVisible); >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/AddBlockCommentHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/AddBlockCommentHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/AddBlockCommentHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/AddBlockCommentHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import org.eclipse.core.commands.IHandler; >+import org.eclipse.jface.text.BadLocationException; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.wst.sse.core.StructuredModelManager; >+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; >+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion; >+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; >+ >+public class AddBlockCommentHandler extends CommentHandler implements IHandler { >+ >+ public AddBlockCommentHandler() { >+ super(); >+ } >+ >+ 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); >+ super.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(); >+ } >+ } >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/ToggleCommentHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/ToggleCommentHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/ToggleCommentHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/ToggleCommentHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,193 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+package org.eclipse.wst.xml.ui.internal.handlers; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.commands.IHandler; >+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.handlers.HandlerUtil; >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.wst.sse.core.StructuredModelManager; >+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; >+import org.eclipse.wst.xml.ui.internal.Logger; >+import org.eclipse.wst.xml.ui.internal.XMLUIMessages; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; >+ >+public class ToggleCommentHandler extends CommentHandler implements IHandler { >+ >+ public ToggleCommentHandler() { >+ // TODO Auto-generated constructor stub >+ super(); >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ >+ fEditor = HandlerUtil.getActiveEditor(event); >+ >+ if (fEditor instanceof XMLMultiPageEditorPart) { >+ final ITextEditor textEditor = (ITextEditor) fEditor.getAdapter(ITextEditor.class); >+ fEditor = textEditor; >+ IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); >+ if (document != null) { >+ // get current text selection >+ ITextSelection textSelection = getCurrentSelection(); >+ if (textSelection.isEmpty()) { >+ return null; >+ } >+ >+ processAction(document, textSelection); >+ } >+ } >+ return null; >+ } >+ >+ 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); >+ } >+ } >+ } >+} >Index: src/org/eclipse/wst/xml/ui/internal/handlers/CommentHandler.java >=================================================================== >RCS file: src/org/eclipse/wst/xml/ui/internal/handlers/CommentHandler.java >diff -N src/org/eclipse/wst/xml/ui/internal/handlers/CommentHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xml/ui/internal/handlers/CommentHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,106 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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 >+ * >+ *******************************************************************************/ >+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.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.ui.IEditorPart; >+import org.eclipse.ui.handlers.HandlerUtil; >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.wst.xml.ui.internal.Logger; >+import org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart; >+ >+public class CommentHandler extends AbstractHandler implements IHandler { >+ >+ >+ static final String CLOSE_COMMENT = "-->"; //$NON-NLS-1$ >+ static final String OPEN_COMMENT = "<!--"; //$NON-NLS-1$ >+ >+ IEditorPart fEditor; >+ >+ public CommentHandler() { >+ super(); >+ } >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ >+ fEditor = HandlerUtil.getActiveEditor(event); >+ >+ if (fEditor instanceof XMLMultiPageEditorPart) { >+ final ITextEditor textEditor = (ITextEditor) fEditor.getAdapter(ITextEditor.class); >+ fEditor = textEditor; >+ IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); >+ if (document != null) { >+ // get current text selection >+ ITextSelection textSelection = getCurrentSelection(); >+ if (textSelection.isEmpty()) { >+ return null; >+ } >+ >+ processAction(document, textSelection); >+ } >+ } >+ >+ return null; >+ } >+ >+ protected 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(); >+ } >+ >+ void processAction(IDocument document, ITextSelection textSelection) { >+ // Implementations to over ride. >+ } >+ >+ protected 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); >+ } >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 212330
:
85240
|
85305
|
85343
|
85359
|
85510
|
85614
|
85623
|
85671
|
85691
|
89897
|
90283
|
92198
|
92199
|
92436
|
92731