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 27089 Details for
Bug 109468
get rid of subclasses of StructuredTextEditor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
org.eclipse.jst.jsp.ui.patch
org.eclipse.jst.jsp.ui.patch (text/plain), 31.26 KB, created by
Amy Wu
on 2005-09-14 02:19:36 EDT
(
hide
)
Description:
org.eclipse.jst.jsp.ui.patch
Filename:
MIME Type:
Creator:
Amy Wu
Created:
2005-09-14 02:19:36 EDT
Size:
31.26 KB
patch
obsolete
>Index: plugin.properties >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/plugin.properties,v >retrieving revision 1.8 >diff -u -r1.8 plugin.properties >--- plugin.properties 13 Jun 2005 01:42:41 -0000 1.8 >+++ plugin.properties 14 Sep 2005 06:17:14 -0000 >@@ -63,3 +63,23 @@ > AddBookmark.tooltip=Add Bookmark... > ## EL Error Message > JSPEL_Syntax_Error=JSP EL Syntax Error >+## >+CleanupDocument_label=Cleanup Document... >+CleanupDocument_tooltip=Cleanup Document >+ToggleComment_label=Toggle Comment >+ToggleComment_tooltip=Toggle Comment >+AddBlockComment_label=Add Block Comment >+AddBlockComment_tooltip=Add Block Comment >+RemoveBlockComment_label=Remove Block Comment >+RemoveBlockComment_tooltip=Remove Block Comment >+FindOccurrences_label=Occurrences in File >+RenameElement_label=Rename >+MoveElement_label=Move >+StructureSelectEnclosing_label=Enclosing Element >+StructureSelectEnclosing_tooltip=Expand selection to include enclosing element >+StructureSelectNext_label=Next Element >+StructureSelectNext_tooltip=Expand selection to include next sibling >+StructureSelectPrevious_label=Previous Element >+StructureSelectPrevious_tooltip=Expand selection to include previous sibling >+StructureSelectHistory_label=Restore Last Selection >+StructureSelectHistory_tooltip=Restore last selection >\ No newline at end of file >Index: plugin.xml >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/plugin.xml,v >retrieving revision 1.41 >diff -u -r1.41 plugin.xml >--- plugin.xml 7 Sep 2005 23:33:17 -0000 1.41 >+++ plugin.xml 14 Sep 2005 06:17:15 -0000 >@@ -8,7 +8,7 @@ > icon="icons//full/obj16/sourceEditor.gif" > extensions="jsp, jsf, jspf, jspx, tag, tagf" > contributorClass="org.eclipse.jst.jsp.ui.internal.editor.ActionContributorJSP" >- class="org.eclipse.jst.jsp.ui.internal.editor.StructuredTextEditorJSP" >+ class="org.eclipse.wst.sse.ui.internal.StructuredTextEditor" > symbolicFontName="org.eclipse.wst.sse.ui.textfont" > id="org.eclipse.jst.jsp.core.jspsource.source"> > <contentTypeBinding >@@ -277,39 +277,48 @@ > <!-- JSP Editor specific actions --> > <!--======================================================================================--> > <extension point="org.eclipse.ui.commands"> >- <scope >- name="%scope.structured.text.editor.jsp.name" >- parent="org.eclipse.ui.textEditorScope" >- description="%scope.structured.text.editor.jsp.description" >- id="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope" /> >- >- <!-- dmw 6/6 removed from 'scope' parentId="org.eclipse.ui.textEditorScope" --> > <!-- rename refactor --> > <command > name="%command.jsp.refactor.rename.name" > description="%command.jsp.refactor.rename.description" >- category="org.eclipse.ui.category.edit" >+ categoryId="org.eclipse.ui.category.edit" > id="org.eclipse.jst.jsp.ui.refactor.rename" /> > >- <keyBinding >- string="Alt+Shift+R" >- scope="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope" >- command="org.eclipse.jst.jsp.ui.refactor.rename" >- configuration="org.eclipse.ui.defaultAcceleratorConfiguration" /> >- > <!-- move refactor --> > <command > name="%command.jsp.refactor.move.name" > description="%command.jsp.refactor.move.description" >- category="org.eclipse.ui.category.edit" >+ categoryId="org.eclipse.ui.category.edit" > id="org.eclipse.jst.jsp.ui.refactor.move" /> >+ </extension> >+ >+ <!-- Keybinding scope for jsp source editor --> >+ <extension point="org.eclipse.ui.contexts"> >+ <context >+ name="%scope.structured.text.editor.jsp.name" >+ parentId="org.eclipse.ui.textEditorScope" >+ description="%scope.structured.text.editor.jsp.description" >+ id="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope"> >+ </context> >+ </extension> >+ >+ <!-- Keybindings for jsp source editor --> >+ <extension point="org.eclipse.ui.bindings"> >+ <!-- rename refactor --> >+ <key >+ sequence="Alt+Shift+R" >+ contextId="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope" >+ commandId="org.eclipse.jst.jsp.ui.refactor.rename" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> >+ </key> > >- <keyBinding >- string="Alt+Shift+V" >- scope="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope" >- command="org.eclipse.jst.jsp.ui.refactor.move" >- configuration="org.eclipse.ui.defaultAcceleratorConfiguration" /> >- >+ <!-- move refactor --> >+ <key >+ sequence="Alt+Shift+V" >+ contextId="org.eclipse.jst.jsp.ui.structured.text.editor.jsp.scope" >+ commandId="org.eclipse.jst.jsp.ui.refactor.move" >+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"> >+ </key> > </extension> > > <!--======================================================================================--> >@@ -434,5 +443,95 @@ > </viewerContribution> > </extension> > >- >+ <extension point="org.eclipse.ui.editorActions"> >+ <editorContribution >+ id="org.eclipse.jst.jsp.core.jspsource.source.editorActions" >+ targetID="org.eclipse.jst.jsp.core.jspsource.source"> >+ <action >+ id="CleanupDocument" >+ label="%CleanupDocument_label" >+ definitionId="org.eclipse.wst.sse.ui.cleanup.document" >+ tooltip="%CleanupDocument_tooltip" >+ class="org.eclipse.wst.html.ui.internal.edit.ui.CleanupActionHTMLDelegate" >+ actionID="CleanupDocument"> >+ </action> >+ <action >+ id="ToggleComment" >+ label="%ToggleComment_label" >+ definitionId="org.eclipse.wst.sse.ui.toggle.comment" >+ tooltip="%ToggleComment_tooltip" >+ class="org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXMLDelegate" >+ actionID="ToggleComment"> >+ </action> >+ <action >+ id="AddBlockComment" >+ label="%AddBlockComment_label" >+ definitionId="org.eclipse.wst.sse.ui.add.block.comment" >+ tooltip="%AddBlockComment_tooltip" >+ class="org.eclipse.wst.xml.ui.internal.actions.AddBlockCommentActionXMLDelegate" >+ actionID="AddBlockComment"> >+ </action> >+ <action >+ id="RemoveBlockComment" >+ label="%RemoveBlockComment_label" >+ definitionId="org.eclipse.wst.sse.ui.remove.block.comment" >+ tooltip="%RemoveBlockComment_tooltip" >+ class="org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXMLDelegate" >+ actionID="RemoveBlockComment"> >+ </action> >+ <action >+ id="RenameElement" >+ label="%RenameElement_label" >+ definitionId="org.eclipse.jst.jsp.ui.refactor.rename" >+ class="org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPRenameElementActionDelegate" >+ actionID="RenameElement"> >+ </action> >+ <action >+ id="MoveElement" >+ label="%MoveElement_label" >+ definitionId="org.eclipse.jst.jsp.ui.refactor.move" >+ class="org.eclipse.jst.jsp.ui.internal.java.refactoring.JSPMoveElementActionDelegate" >+ actionID="MoveElement"> >+ </action> >+ <action >+ id="FindOccurrences" >+ label="%FindOccurrences_label" >+ definitionId="org.eclipse.wst.sse.ui.search.find.occurrences" >+ class="org.eclipse.jst.jsp.ui.internal.java.search.JSPFindOccurrencesActionDelegate" >+ actionID="FindOccurrences"> >+ </action> >+ <action >+ id="StructureSelectEnclosing" >+ label="%StructureSelectEnclosing_label" >+ definitionId="org.eclipse.wst.sse.ui.structure.select.enclosing" >+ tooltip="%StructureSelectEnclosing_tooltip" >+ class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectEnclosingXMLActionDelegate" >+ actionID="StructureSelectEnclosing"> >+ </action> >+ <action >+ id="StructureSelectNext" >+ label="%StructureSelectNext_label" >+ definitionId="org.eclipse.wst.sse.ui.structure.select.next" >+ tooltip="%StructureSelectNext_tooltip" >+ class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectNextXMLActionDelegate" >+ actionID="StructureSelectNext"> >+ </action> >+ <action >+ id="StructureSelectPrevious" >+ label="%StructureSelectPrevious_label" >+ definitionId="org.eclipse.wst.sse.ui.structure.select.previous" >+ tooltip="%StructureSelectPrevious_tooltip" >+ class="org.eclipse.wst.xml.ui.internal.selection.StructuredSelectPreviousXMLActionDelegate" >+ actionID="StructureSelectPrevious"> >+ </action> >+ <action >+ id="StructureSelectHistory" >+ label="%StructureSelectHistory_label" >+ definitionId="org.eclipse.wst.sse.ui.structure.select.last" >+ tooltip="%StructureSelectHistory_tooltip" >+ class="org.eclipse.wst.sse.ui.internal.selection.StructuredSelectHistoryActionDelegate" >+ actionID="StructureSelectHistory"> >+ </action> >+ </editorContribution> >+ </extension> > </plugin> >Index: src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties,v >retrieving revision 1.10 >diff -u -r1.10 JSPUIPluginResources.properties >--- src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties 25 Aug 2005 14:15:45 -0000 1.10 >+++ src/org/eclipse/jst/jsp/ui/internal/JSPUIPluginResources.properties 14 Sep 2005 06:17:15 -0000 >@@ -15,9 +15,9 @@ > ## Welcome! > Sample_JSP_doc=<%@ page \n\tlanguage=\"java\" \n\tcontentType=\"text/html; charset=ISO-8859-1\"\n%>\n<jsp:include flush=\"true\" page=\"titleBar.jsp\"/>\n\n<%-- Use below tags ONLY for JSP 1.1 --%>\n<%\n\tSystem.out.println(\"Welcome!\");\n%>\n<%-- Use below tags ONLY for JSP 1.2 --%>\n<jsp:scriptlet>\n\tSystem.out.println(\"Welcome!\");\n</jsp:scriptlet> > JSP_Delimiters_UI_=JSP Delimiters >-Refactor_label=R&efactor >-RenameElement_label=Re&name >-MoveElement_label=Mo&ve >+Refactor_label=Refactor >+RenameElement_label=Rename >+MoveElement_label=Move > MoveElementWizard=Move the selected elements > # > OK=OK >@@ -45,19 +45,19 @@ > NewJSPTemplatesWizardPage_5=Preview > NewJSPTemplatesWizardPage_6=Templates are 'New JSP' templates found in the <a>JSP Templates</a> preference page. > # Copied from sse.ui >-CleanupDocument_label=C&leanup Document... >+CleanupDocument_label=Cleanup Document... > CleanupDocument_tooltip=Cleanup Document > CleanupDocument_description=Cleanup Document >-ToggleComment_label=Togg&le Comment >+ToggleComment_label=Toggle Comment > ToggleComment_tooltip=Toggle Comment > ToggleComment_description=Toggle Comment >-AddBlockComment_label=Add &Block Comment >+AddBlockComment_label=Add Block Comment > AddBlockComment_tooltip=Add Block Comment > AddBlockComment_description=Add Block Comment >-RemoveBlockComment_label=Remove Bloc&k Comment >+RemoveBlockComment_label=Remove Block Comment > RemoveBlockComment_tooltip=Remove Block Comment > RemoveBlockComment_description=Remove Block Comment >-FindOccurrences_label=O&ccurrences in File >+FindOccurrences_label=Occurrences in File > OccurrencesSearchQuery_0={0} - {1} Occurrences in {2} > OccurrencesSearchQuery_2=file > Content_Assist_not_availab_UI_=Content Assist not available at the current location >Index: src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java,v >retrieving revision 1.12 >diff -u -r1.12 StructuredTextEditorJSP.java >--- src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java 6 Jun 2005 20:11:15 -0000 1.12 >+++ src/org/eclipse/jst/jsp/ui/internal/editor/StructuredTextEditorJSP.java 14 Sep 2005 06:17:15 -0000 >@@ -32,6 +32,10 @@ > import org.eclipse.wst.xml.ui.internal.actions.RemoveBlockCommentActionXML; > import org.eclipse.wst.xml.ui.internal.actions.ToggleCommentActionXML; > >+/** >+ * @deprecated JSP editor is created from StructuredTextEditor with >+ * JSP configurations >+ */ > public class StructuredTextEditorJSP extends StructuredTextEditor { > private final static String UNDERSCORE = "_"; //$NON-NLS-1$ > >Index: src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java,v >retrieving revision 1.7 >diff -u -r1.7 JSPMoveElementAction.java >--- src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java 22 May 2005 01:33:45 -0000 1.7 >+++ src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementAction.java 14 Sep 2005 06:17:15 -0000 >@@ -41,7 +41,8 @@ > * Still relies heavily on internal API > * will change post 3.0 with public move support > * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817 >- * @author pavery >+ * >+ * @deprecated use JSPMoveElementActionDelegate instead > */ > public class JSPMoveElementAction extends TextEditorAction { > >Index: src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java,v >retrieving revision 1.5 >diff -u -r1.5 JSPRenameElementAction.java >--- src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java 13 Apr 2005 22:43:39 -0000 1.5 >+++ src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementAction.java 14 Sep 2005 06:17:15 -0000 >@@ -28,7 +28,7 @@ > /** > * A TextEditorAction that launches JDT rename element wizard > * >- * @author pavery >+ * @deprecated use JSPRenameElementActionDelegate instead > */ > public class JSPRenameElementAction extends TextEditorAction { > >Index: src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java >=================================================================== >RCS file: /home/webtools/jst/components/jsp/plugins/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java,v >retrieving revision 1.16 >diff -u -r1.16 JSPFindOccurrencesAction.java >--- src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java 14 Jul 2005 22:32:54 -0000 1.16 >+++ src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesAction.java 14 Sep 2005 06:17:16 -0000 >@@ -36,7 +36,7 @@ > * Finds occurrences of Java elements in a JSP file using JSPSearchSupport. > * </p> > * >- * @author pavery >+ * @deprecated use JSPFindOccurrencesProcessor instead > */ > public class JSPFindOccurrencesAction extends BasicFindOccurrencesAction implements IJavaSearchConstants { > >Index: src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java >=================================================================== >RCS file: src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java >diff -N src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPMoveElementActionDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,153 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * >+ *******************************************************************************/ >+ >+package org.eclipse.jst.jsp.ui.internal.java.refactoring; >+ >+import org.eclipse.core.resources.IResource; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.JavaModelException; >+import org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor; >+import org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter; >+import org.eclipse.jdt.internal.ui.refactoring.reorg.CreateTargetQueries; >+import org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgMoveWizard; >+import org.eclipse.jdt.internal.ui.refactoring.reorg.ReorgQueries; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jst.jsp.ui.internal.JSPUIMessages; >+import org.eclipse.jst.jsp.ui.internal.Logger; >+import org.eclipse.ltk.core.refactoring.participants.MoveRefactoring; >+import org.eclipse.ltk.ui.refactoring.RefactoringWizard; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.ui.IActionDelegate2; >+import org.eclipse.ui.IEditorActionDelegate; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IViewActionDelegate; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil; >+ >+/** >+ * An action delegate that launches JDT move element wizard >+ * >+ * Still relies heavily on internal API >+ * will change post 3.0 with public move support >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817 >+ */ >+public class JSPMoveElementActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate { >+ private IEditorPart fEditor; >+ >+ public void setActiveEditor(IAction action, IEditorPart targetEditor) { >+ fEditor = targetEditor; >+ } >+ >+ public void dispose() { >+ // nulling out just in case >+ fEditor = null; >+ } >+ >+ public void init(IAction action) { >+ if (action != null) { >+ action.setText(JSPUIMessages.MoveElement_label); >+ action.setToolTipText(JSPUIMessages.MoveElement_label); >+ } >+ } >+ >+ public void runWithEvent(IAction action, Event event) { >+ run(action); >+ } >+ >+ public void run(IAction action) { >+ IJavaElement[] elements = getSelectedElements(); >+ if (elements.length > 0) { >+ >+ // need to check if it's movable >+ try { >+ JavaMoveProcessor processor = JavaMoveProcessor.create(getResources(elements), elements/* >+ * , >+ * getCodeGenerationSettings() >+ */); >+ Shell parent = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); >+ >+ MoveRefactoring refactoring = new MoveRefactoring(processor); >+ >+ RefactoringWizard wizard = createWizard(refactoring); >+ >+ /* >+ * We want to get the shell from the refactoring dialog but >+ * it's not known at this point, so we pass the wizard and >+ * then, once the dialog is open, we will have access to its >+ * shell. >+ */ >+ >+ processor.setCreateTargetQueries(new CreateTargetQueries(wizard)); >+ processor.setReorgQueries(new ReorgQueries(wizard)); >+ // String openRefactoringWizMsg = >+ // RefactoringMessages.getString("OpenRefactoringWizardAction.refactoring"); >+ // //$NON-NLS-1$ >+ String openRefactoringWizMsg = JSPUIMessages.MoveElementWizard; // "Move >+ // the >+ // selected >+ // elements"; >+ // //$NON-NLS-1$ >+ new RefactoringStarter().activate(refactoring, wizard, parent, openRefactoringWizMsg, true); >+ >+ PlatformStatusLineUtil.clearStatusLine(); >+ >+ } >+ catch (JavaModelException e) { >+ Logger.logException(e); >+ } >+ } >+ else { >+ PlatformStatusLineUtil.displayErrorMessage(JSPUIMessages.JSPMoveElementAction_0); //$NON-NLS-1$ >+ } >+ } >+ >+ public void selectionChanged(IAction action, ISelection selection) { >+ PlatformStatusLineUtil.clearStatusLine(); >+ } >+ >+ public void init(IViewPart view) { >+ // do nothing >+ } >+ >+ private IJavaElement[] getSelectedElements() { >+ >+ IJavaElement[] elements = new IJavaElement[0]; >+ if (fEditor instanceof ITextEditor) >+ elements = JSPJavaSelectionProvider.getSelection((ITextEditor) fEditor); >+ return elements; >+ } >+ >+ private IResource[] getResources(IJavaElement[] elements) { >+ IResource[] resources = new IResource[elements.length]; >+ for (int i = 0; i < elements.length; i++) { >+ try { >+ resources[i] = elements[i].getPrimaryElement().getCorrespondingResource();// elements[i].getResource(); >+ } >+ catch (JavaModelException e) { >+ Logger.logException(e); >+ } >+ } >+ return resources; >+ } >+ >+ /** >+ * will change post 3.0 with public move support >+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61817 >+ */ >+ private RefactoringWizard createWizard(MoveRefactoring refactoring) { >+ return new ReorgMoveWizard(refactoring); >+ } >+} >Index: src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java >=================================================================== >RCS file: src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java >diff -N src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jst/jsp/ui/internal/java/refactoring/JSPRenameElementActionDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,109 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * >+ *******************************************************************************/ >+ >+package org.eclipse.jst.jsp.ui.internal.java.refactoring; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jdt.core.IMethod; >+import org.eclipse.jdt.core.IPackageFragment; >+import org.eclipse.jdt.core.IType; >+import org.eclipse.jdt.ui.refactoring.RenameSupport; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jst.jsp.ui.internal.JSPUIMessages; >+import org.eclipse.jst.jsp.ui.internal.Logger; >+import org.eclipse.swt.widgets.Event; >+import org.eclipse.ui.IActionDelegate2; >+import org.eclipse.ui.IEditorActionDelegate; >+import org.eclipse.ui.IEditorPart; >+import org.eclipse.ui.IViewActionDelegate; >+import org.eclipse.ui.IViewPart; >+import org.eclipse.ui.PlatformUI; >+import org.eclipse.ui.texteditor.ITextEditor; >+import org.eclipse.wst.sse.ui.internal.util.PlatformStatusLineUtil; >+ >+/** >+ * An action delegate that launches JDT rename element wizard >+ */ >+public class JSPRenameElementActionDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate { >+ private IEditorPart fEditor; >+ >+ public void setActiveEditor(IAction action, IEditorPart targetEditor) { >+ fEditor = targetEditor; >+ } >+ >+ public void dispose() { >+ // nulling out just in case >+ fEditor = null; >+ } >+ >+ public void init(IAction action) { >+ if (action != null) { >+ action.setText(JSPUIMessages.RenameElement_label); >+ action.setToolTipText(JSPUIMessages.RenameElement_label); >+ } >+ } >+ >+ public void runWithEvent(IAction action, Event event) { >+ run(action); >+ } >+ >+ public void run(IAction action) { >+ IJavaElement element = getSelectedElement(); >+ if(element != null) { >+ RenameSupport renameSupport = null; >+ try { >+ switch(element.getElementType()) { >+ case IJavaElement.TYPE: >+ renameSupport= RenameSupport.create((IType)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES); >+ break; >+ case IJavaElement.METHOD: >+ renameSupport= RenameSupport.create((IMethod)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES); >+ break; >+ case IJavaElement.PACKAGE_FRAGMENT: >+ renameSupport= RenameSupport.create((IPackageFragment)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES); >+ break; >+ } >+ if(renameSupport != null) { >+ renameSupport.openDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); >+ PlatformStatusLineUtil.clearStatusLine(); >+ } >+ } >+ catch (CoreException e) { >+ Logger.logException(e); >+ } >+ } >+ else { >+ PlatformStatusLineUtil.displayErrorMessage(JSPUIMessages.JSPRenameElementAction_0); //$NON-NLS-1$ >+ PlatformStatusLineUtil.addOneTimeClearListener(); >+ } >+ } >+ >+ public void selectionChanged(IAction action, ISelection selection) { >+ PlatformStatusLineUtil.clearStatusLine(); >+ } >+ >+ public void init(IViewPart view) { >+ // do nothing >+ } >+ >+ private IJavaElement getSelectedElement() { >+ IJavaElement element = null; >+ if (fEditor instanceof ITextEditor) { >+ IJavaElement[] elements = JSPJavaSelectionProvider.getSelection((ITextEditor)fEditor); >+ if (elements.length == 1) >+ element = elements[0]; >+ } >+ return element; >+ } >+} >Index: src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java >=================================================================== >RCS file: src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java >diff -N src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesActionDelegate.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * >+ *******************************************************************************/ >+ >+package org.eclipse.jst.jsp.ui.internal.java.search; >+ >+import java.util.ArrayList; >+import java.util.List; >+ >+import org.eclipse.wst.html.ui.internal.search.HTMLFindOccurrencesProcessor; >+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesActionDelegate; >+ >+/** >+ * Sets up FindOccurrencesActionDelegate for jsp find occurrences processors >+ */ >+public class JSPFindOccurrencesActionDelegate extends FindOccurrencesActionDelegate { >+ private List fProcessors; >+ >+ protected List getProcessors() { >+ if (fProcessors == null) { >+ fProcessors = new ArrayList(); >+ HTMLFindOccurrencesProcessor htmlProcessor = new HTMLFindOccurrencesProcessor(); >+ fProcessors.add(htmlProcessor); >+// temporary, workaround to disable function, since using the function >+// can easily cause deadlock to occur. >+// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=103662 >+// JSPFindOccurrencesProcessor jspProcessor = new JSPFindOccurrencesProcessor(); >+// fProcessors.add(jspProcessor); >+ } >+ return fProcessors; >+ } >+} >Index: src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java >=================================================================== >RCS file: src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java >diff -N src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jst/jsp/ui/internal/java/search/JSPFindOccurrencesProcessor.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+/******************************************************************************* >+ * Copyright (c) 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * >+ *******************************************************************************/ >+ >+package org.eclipse.jst.jsp.ui.internal.java.search; >+ >+import org.eclipse.core.resources.IFile; >+import org.eclipse.jdt.core.IJavaElement; >+import org.eclipse.jface.text.IDocument; >+import org.eclipse.jface.text.ITextSelection; >+import org.eclipse.jst.jsp.core.internal.java.IJSPTranslation; >+import org.eclipse.jst.jsp.core.internal.java.JSPTranslation; >+import org.eclipse.jst.jsp.core.internal.java.JSPTranslationAdapter; >+import org.eclipse.jst.jsp.core.internal.provisional.text.IJSPPartitionTypes; >+import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; >+import org.eclipse.search.ui.ISearchQuery; >+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; >+import org.eclipse.wst.sse.core.internal.provisional.StructuredModelManager; >+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument; >+import org.eclipse.wst.sse.ui.internal.search.FindOccurrencesProcessor; >+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; >+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; >+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; >+ >+/** >+ * Configures a FindOccurrencesProcessor with JSP partitions and regions >+ */ >+public class JSPFindOccurrencesProcessor extends FindOccurrencesProcessor { >+ >+ protected String[] getPartitionTypes() { >+ return new String[]{IJSPPartitionTypes.JSP_DEFAULT, IJSPPartitionTypes.JSP_CONTENT_JAVA}; >+ } >+ >+ protected String[] getRegionTypes() { >+ return new String[]{DOMRegionContext.BLOCK_TEXT, DOMJSPRegionContexts.JSP_CONTENT}; >+ } >+ >+ protected ISearchQuery getSearchQuery(IFile file, IStructuredDocument document, String regionText, String regionType, ITextSelection textSelection) { >+ return new JSPSearchQuery(file, getJavaElement(document, textSelection)); >+ } >+ >+ private IJavaElement getJavaElement(IDocument document, ITextSelection textSelection) { >+ IJavaElement[] elements = getJavaElementsForCurrentSelection(document, textSelection); >+ return elements.length > 0 ? elements[0] : null; >+ } >+ >+ /** >+ * uses JSPTranslation to get currently selected Java elements. >+ * >+ * @return currently selected IJavaElements >+ */ >+ private IJavaElement[] getJavaElementsForCurrentSelection(IDocument document, ITextSelection selection) { >+ IJavaElement[] elements = new IJavaElement[0]; >+ // get JSP translation object for this viewer's document >+ IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForRead(document); >+ try { >+ if (model != null && model instanceof IDOMModel) { >+ IDOMDocument xmlDoc = ((IDOMModel) model).getDocument(); >+ JSPTranslationAdapter adapter = (JSPTranslationAdapter) xmlDoc.getAdapterFor(IJSPTranslation.class); >+ if (adapter != null) { >+ JSPTranslation translation = adapter.getJSPTranslation(); >+ >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=102211 >+ elements = translation.getElementsFromJspRange(selection.getOffset(), selection.getOffset() + selection.getLength()); >+ } >+ } >+ } >+ finally { >+ if (model != null) >+ model.releaseFromRead(); >+ } >+ return elements; >+ } >+}
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 109468
: 27089 |
27090
|
27091
|
27092
|
27093
|
27094
|
27095
|
27128