Bug 116217 - RoS action failure in editor context menu.
Summary: RoS action failure in editor context menu.
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1.2   Edit
Assignee: Michael Rennie CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 116534 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-11-14 06:57 EST by Gorkem Ercan CLA Friend
Modified: 2006-01-05 10:16 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gorkem Ercan CLA Friend 2005-11-14 06:57:30 EST
create a JSP server and invoke RoS from the editor' s context menu. It fails
with did not find anything to deploy to server. RoS works for the same file if
invoked from the context menu in Project Explorer.
Comment 1 Gorkem Ercan CLA Friend 2005-11-16 01:34:16 EST
*** Bug 116534 has been marked as a duplicate of this bug. ***
Comment 2 Tim deBoer CLA Friend 2005-11-16 12:34:04 EST
I tracked down the problem and it is caused by a bad input to the server tools
launch shortcut (org.eclipse.wst.server.ui.internal.ServerLaunchShortcut). This
class has two methods that are called by the Eclipse debug framework when the
user selects RoS. I've found the following behaviour:
  * When the user does RoS directly on a file, my launch shortcut's
launch(ISelection,String) method gets called with the File as a selection.
  * When using the Java editor, Text editor, or other editors, the
launch(IEditorPart,String) method gets called instead, and I can get the file if
the editor input happens to be IFileEditorInput. Things still work.
  * When using our HTML/JSP editor, the launch(ISelection,String) method gets
called with the current textual selection... causing things to fail since the
selection doesn't give me any way of finding out what the user wants to run.

David - Since this problem only occurs within the WTP editors, I'm planning to
transfer this bug across after I've finished checking the rest of the editors.
Do you have any idea why our editors would be behaving this way? It almost looks
like there is a special selection provider that is interferring with the Debug
framework.
Comment 3 Tim deBoer CLA Friend 2005-11-18 11:16:32 EST
Here are the steps to reproduce in WTP:
 * Import org.eclipse.wst.server.ui with source in your development environment.
 * Open org.eclipse.wst.server.ui.internal.ServerLaunchShortcut and set a
breakpoint in both of the launch() methods.
 * Launch a runtime workspace.
 * Create a Web project.
 * Create a JSP file in the Web project.
 * Open the JSP editor.
 * Right click and pick Run > Run on Server. The launch(ISelection,String)
method is called and the breakpoint is hit. Resume execution and the failure occurs.
 * Close the editor and open the JSP file with a text editor.
 * Right click and pick Run > Run on Server. The launch(IEditorPart,String)
method is called and the breakpoint is hit. Resume execution and the regular Run
on Server dialog appears.

I found the underlying problem. In
org.eclipse.debug.internal.ui.actions.LaunchShortcutAction, the run() method
first looks for a structured selection in the current workbench page and uses
the current editor as a backup. When any of the SSE editors are active, they
supply a structured text selection (even if nothing is selected), basically
breaking the debug assumption.

Passing to SSE first since I have only seen this behaviour with SSE editors. If
the SSE editors don't need to (or shouldn't) be providing a structured
selection, then the fix is to change the selection. If this is a bad assumption
and SSE is doing everything right, then please pass this on to the Platform
Debug team.
Comment 4 Nitin Dahyabhai CLA Friend 2005-11-18 14:20:39 EST
It looks like it's a bad assumption to me; the SSE editors need to provide an
IStructuredSelection to connected views and actions.  The LaunchShortcutAction
might want to consider if the active part is an editor part, then check the
selection, and then just use the active editor part as a fallback.
Comment 5 Darin Wright CLA Friend 2006-01-04 15:54:30 EST
Fixed in 3.2 and 3.1.2 streams
Comment 6 Darin Wright CLA Friend 2006-01-04 15:55:21 EST
Please verify, Michael. The fix is as suggested - if the active part is an editor, send the launch(IEditorPart, mode) message to the shortcut instead of the structured selection.
Comment 7 Michael Rennie CLA Friend 2006-01-05 10:16:32 EST
verified, if the selection is an EditorPart (editor) then the launch(IEditorPart, mode) is in fact used. 

When a launch is initiated its context is tested to see if it is an EditorPart or a selection, prior to either of the launch calls occuring.