Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 166419 - Can't Run/Debug/Profile from source editor context menus
Summary: Can't Run/Debug/Profile from source editor context menus
Status: CLOSED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: wst.web (show other bugs)
Version: 2.0   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 2.0 RC1   Edit
Assignee: Raj Mandayam CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-30 17:47 EST by Nitin Dahyabhai CLA
Modified: 2007-06-06 14:07 EDT (History)
3 users (show)

See Also:
david_williams: pmc_approved+
jlanuti: pmc_approved? (raghunathan.srinivasan)
david_williams: pmc_approved?
deboer: pmc_approved+
david_williams: pmc_approved?
jgarms: pmc_approved+


Attachments
Patch to check whether the project is valid in all cases (1.82 KB, patch)
2006-12-11 15:46 EST, Tim deBoer CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nitin Dahyabhai CLA 2006-11-30 17:47:56 EST
wtp-sdk-I-I200611300401-200611300401.zip

When editing a JSP within a targetted dynamic web project, choosing Run/Debug/Profile on Server from the editor's context menu fails immediately with a dialog stating "The selection is not within a valid module."  It works fine from the file's context menu in the Project Explorer.
Comment 1 Tim deBoer CLA 2006-11-30 17:50:33 EST
I've only seen this in one editor in the past, and it was a bug in the editor. I'll need to reproduce and debug it. Which editor are you using - the JSP source editor?
Comment 2 Tim deBoer CLA 2006-12-05 14:23:50 EST
The bug I was referring to is bug 116217, fixed in 3.2 and above. I tested this in WTP 2.0 and could not reproduce.

Nitin - I was in the JSP source editor, right clicking and selecting Run As > Run on Server, and this works fine for me. Is this what you were doing? Please let me know if you were doing something different or the steps you are taking to reproduce this.
Comment 3 Larry Isaacs CLA 2006-12-11 10:53:40 EST
I have also encountered this symptom. On my Linux Laptop I have a WTP 2.0M3 test installation that does this consistently. The cause is that for reasons I have yet to determine, webstatic1 and webstatic2 appear first in the list of moduleArtifactAdapters as displayed by ServerPlugin.loadModuleArtifactAdapters() with tracing enabled. The remaining moduleArtifactAdapters appear in the "usual" order, "ejb", "ear" , "cactus", and "webresource".  Because the "cactus" entry is the only one with a priority other than zero, the sort that follows loading swaps the "webstatic1" entry with the "cactus" entry and "webstatic2" remains as the second entry.  The criteria for "webstatic2" looks like it will grab most anything in an editor and because it doesn't contain a module, prevents the Run/Debug/Profile from succeeding.

It's unclear to me why this installation has the "webstatic" entries first when many others have them last.  I routinely use a "links" directory with "*.link" files under the "eclipse" directory to connect the eclipse installation to the various dependencies.  I'm not sure if that approach lends itself to this occurring.  I think I have seen this with Windows, but I can't confirm with any of my current Windows Eclipse installations.  Given that there appears to be some variability, perhaps the priority setting on the moduleArtifactAdapters could be used to ensure the desired order.
Comment 4 Tim deBoer CLA 2006-12-11 15:43:21 EST
Thanks, Larry - that's exactly what I needed to reproduce the problem and see what the problem is. Looking at the StaticWebDeployableObjectAdapterUtil (impl behind webstatic1 and webstatic2), it's just some logic (checking that the project is a valid static web project) that's missing in the case where the file is adapted from another object. I'll send this the wst.web team and attach a patch that I've tested.
Comment 5 Tim deBoer CLA 2006-12-11 15:46:50 EST
Created attachment 55431 [details]
Patch to check whether the project is valid in all cases

The attached patch cleans up the code a little to make the logic clearer, but it's really just making sure that the following code is executed in the case where the resource is received from the IAdaptable:
  IProject project = ProjectUtilities.getProject(resource);
  if (project != null && !hasInterestedComponents(project))
    return null;
Comment 6 Larry Isaacs CLA 2006-12-12 08:56:56 EST
I have confirmed the patch fixes the issue on my Linux Laptop.
Comment 7 Larry Isaacs CLA 2007-04-13 13:21:41 EDT
Pinging. :)

It would be nice if this could be included in WTP 2.0RC0.  I never found a way to "fix" the order of the moduleArtifactAdapters, so users who encounter the odd order won't be able to use this feature.
Comment 8 Chuck Bridgham CLA 2007-04-13 14:22:55 EDT
Hi Raj - another related run-on bug possibly for RC0
Comment 9 Chuck Bridgham CLA 2007-05-18 09:40:13 EDT
Patch looks good - I approve....

We missed RC0 - but we'll get in first thing RC1
Comment 10 Jess Garms CLA 2007-05-18 16:22:07 EDT
Approved.
Comment 11 Chuck Bridgham CLA 2007-05-24 09:59:10 EDT
this was dropped couple days ago
Comment 12 Raj Mandayam CLA 2007-06-06 14:07:05 EDT
closed