Bug 287951 - Unwarranted Behaviour while pressing ctrl+f11 with XML Editor in Eclipse 3.5
Unwarranted Behaviour while pressing ctrl+f11 with XML Editor in Eclipse 3.5
Status: RESOLVED NOT_ECLIPSE
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml
3.1
PC Windows XP
: P3 normal (vote)
: ---
Assigned To: wst.xml-triaged CLA Friend
Nitin Dahyabhai CLA Friend
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-08-28 06:19 EDT by Ravi CLA Friend
Modified: 2010-04-06 14:16 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ravi CLA Friend 2009-08-28 06:19:30 EDT
Build ID: 20090621-0832

Steps To Reproduce:
1.Let AndroidManfiest.xml or Main.xml be in active focus.
2.Press ctrl+f11.
3.AndroidManifest_out.xml gets generated with Exception.


More information:
Prior to Eclipse 3.5, Even when Xml file having active focus, Pressing ctrl+f11 use to launch the Run As Dialog but Eclipse 3.5 compiles the XML file instead.
Comment 1 Remy Suen CLA Friend 2009-08-28 07:55:01 EDT
1. Eclipse/Window > Preferences > Run/Debug > Launching
2. Select 'Always launch the previously launched application' in the 'Launch Operation' section.
Comment 2 Ravi CLA Friend 2009-08-30 22:56:17 EDT
Thanks for the update.
Comment 3 Remy Suen CLA Friend 2009-08-30 22:58:21 EDT
We didn't fix anything.
Comment 4 Ravi CLA Friend 2009-08-31 02:52:51 EDT
I'm Sorry...the bug is not yet fixed. The fix description had few problems.

In Eclipse 3.4 Ganymede,

Windows->Run/Debug->Launching -> Launch the associated project is enabled.

When we press Ctrl +f11 with xml file as editor then, 'Run As' Dialog appears.

When Proj2 has focus, 'Run As' Dialog appears to select the project proj2 instead of launching proj1.

In Eclipse 3.5 Galileo,

Windows->Run/Debug->Launching -> Launch the associated project is enabled.

When we press Ctrl +f11 with xml file as editor then, xml file gets compiled to out file which is unwanted.


In Eclipse 3.5, when fix description is followed as given below:


Windows->Run/Debug->Launching -> Always Launch the previously launched application.

When we press Ctrl +f11 with xml file as editor then, 'Run As' Dialog doesn't pops up which is required to choose as Android or Java Application.

Moreover, When I press Ctrl + f11 from Proj1 to Proj2 file still, proj1 gets launched in the emulator due to the change in Launch settings.

Required Fix would be as it worked in Eclipse 3.4 Ganymede.
Comment 5 Michael Rennie CLA Friend 2009-08-31 12:21:19 EDT
(In reply to comment #4)
> In Eclipse 3.5 Galileo,
> 
> Windows->Run/Debug->Launching -> Launch the associated project is enabled.
> 
> When we press Ctrl +f11 with xml file as editor then, xml file gets compiled to
> out file which is unwanted.

This is happening because there is likely a launch shortcut for compiling XML, which context launching leverages to know what to do (launch) with the current selection.

> In Eclipse 3.5, when fix description is followed as given below:

> Windows->Run/Debug->Launching -> Always Launch the previously launched
> application.
> 
> When we press Ctrl +f11 with xml file as editor then, 'Run As' Dialog doesn't
> pops up which is required to choose as Android or Java Application.
> 
> Moreover, When I press Ctrl + f11 from Proj1 to Proj2 file still, proj1 gets
> launched in the emulator due to the change in Launch settings.

Now that you have run the above once, changing the setting to "Always launch previously launched application" is doing just that. If you remove the configuration created in the first steps do you then get prompted to select a way to launch?

> Required Fix would be as it worked in Eclipse 3.4 Ganymede.

Changing the launch setting to "Always launch previously launched application" causes launching to work the way it did prior to context launching.
Comment 6 Michael Rennie CLA Friend 2009-08-31 12:22:30 EDT
see bug 74480 for more details on context launching.
Comment 7 Ravi CLA Friend 2009-09-01 02:01:00 EDT
Dear Michael,

Thanks for the update.

Went through the comments of Bug Id: 74480 but still makes me more confusing.

I feel Eclipse 3.4 Ganymede Launch settings were perfect & were not required to be altered in 3.5 Galileo.

In Eclipse 3.4 Ganymede, Windows->Run/Debug->Launching -> Launch the associated project is enabled.

When we press Ctrl +f11 with xml file as editor then, 'Run As' Dialog is displayed which is what every user would want.

In Eclipse 3.5 Galileo, Windows->Run/Debug->Launching -> Launch the associated project is enabled.

 When we press Ctrl +f11 with xml file as editor then, xml file gets compiled to
 out file which is unwanted.

There is no launch shortcut enabled when xml file is active. 

Could you please compare with Eclipse 3.4 & Eclipse 3.5 & Check?
Comment 8 Michael Rennie CLA Friend 2009-09-01 10:25:24 EDT
(In reply to comment #7)
> Could you please compare with Eclipse 3.4 & Eclipse 3.5 & Check?

Thanks for reporting back Ravi, I tested using vanilla versions of 3.5 and 3.4.2 (no other plugins have been installed from the bare SDK), in a new workspace, leaving the launch settings as the defaults. Hitting Ctrl+F11 prompts me in both cases to select a way to run the XML file, with the only two choices in the dialog being to run as a Java applet or as a Java application.

Do you have any additional plugins installed in your 3.5 version?

Here is the test XML I used:

<?xml version="1.0" encoding="ISO-8859-1"?>
<example>
	<msg>test</msg>
</example>
Comment 9 Ravi CLA Friend 2009-09-02 00:12:09 EDT
I'm working in Android & I've installed the ADT plugin.

Please press Ctrl + F11 on any XML file for Android Project.

Hope the Console Output would be useful to you which was displayed while pressing Ctrl+ F11 over XML file for Android Project.

12:29:19,521 INFO  [main] Main  - javax.xml.transform.TransformerFactory=null
12:29:19,631 INFO  [main] Main  - java.endorsed.dirs=C:\Program Files\Java\jdk1.6.0_14\jre\lib\endorsed
12:29:19,724 INFO  [main] Main  - launchFile: F:\Android\Eclipse_WorkSpace\Galileo_Windows\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
12:29:21,974 FATAL [main] Main  - No embedded stylesheet instruction for file: file:/F:/Android/Eclipse_WorkSpace/Galileo_Windows/HelloAndroid/res/layout/edit.xml
org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/F:/Android/Eclipse_WorkSpace/Galileo_Windows/HelloAndroid/res/layout/edit.xml
	at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
	at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
	at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded stylesheet instruction for file: file:/F:/Android/Eclipse_WorkSpace/Galileo_Windows/HelloAndroid/res/layout/edit.xml
	at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)
	... 2 more
Comment 10 Darin Wright CLA Friend 2009-09-02 09:37:31 EDT
Platfrom lanuch settings/logic did not change from 3.4 to 3.5. I suspect this may be a change in Android tooling. Can you file a bug there?
Comment 11 Darin Wright CLA Friend 2009-09-02 09:43:45 EDT
Or perhaps this is a WST launch shortcut that is interfering (based on the stack trace). BTW, I found this related thread:

http://www.mail-archive.com/user-java@ibatis.apache.org/msg14362.html
Comment 12 David Carver CLA Friend 2009-09-02 11:47:26 EDT
Looks like the wst.xsl component is trying to associate the launch for an XML stylesheet.   Since it looks like Android application and wst.xsl are both trying to launch based on the XML file name.

One solution, is to uninstall the XSL Tools Feature, and that should get you working again.   The other thing we need to do is figure out a way where two plugins that are looking to launch based on the same content types, can do so.

You may need to also do Run-As-> the first time, to set the launch configuration, and then CTRL+F11 will work as you suspect.   I'm open to other ideas.


(In reply to comment #9)
> I'm working in Android & I've installed the ADT plugin.
> 
> Please press Ctrl + F11 on any XML file for Android Project.
> 
> Hope the Console Output would be useful to you which was displayed while
> pressing Ctrl+ F11 over XML file for Android Project.
> 
> 12:29:19,521 INFO  [main] Main  - javax.xml.transform.TransformerFactory=null
> 12:29:19,631 INFO  [main] Main  - java.endorsed.dirs=C:\Program
> Files\Java\jdk1.6.0_14\jre\lib\endorsed
> 12:29:19,724 INFO  [main] Main  - launchFile:
> F:\Android\Eclipse_WorkSpace\Galileo_Windows\.metadata\.plugins\org.eclipse.wst.xsl.jaxp.launching\launch\launch.xml
> 12:29:21,974 FATAL [main] Main  - No embedded stylesheet instruction for file:
> file:/F:/Android/Eclipse_WorkSpace/Galileo_Windows/HelloAndroid/res/layout/edit.xml
> org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No embedded
> stylesheet instruction for file:
> file:/F:/Android/Eclipse_WorkSpace/Galileo_Windows/HelloAndroid/res/layout/edit.xml
> at
> org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:225)
> at
> org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:186)
> at org.eclipse.wst.xsl.jaxp.debug.invoker.internal.Main.main(Main.java:73)
> Caused by: org.eclipse.wst.xsl.jaxp.debug.invoker.TransformationException: No
> embedded stylesheet instruction for file:
> file:/F:/Android/Eclipse_WorkSpace/Galileo_Windows/HelloAndroid/res/layout/edit.xml
> at
> org.eclipse.wst.xsl.jaxp.debug.invoker.internal.JAXPSAXProcessorInvoker.transform(JAXPSAXProcessorInvoker.java:214)
> ... 2 more
Comment 13 Ravi CLA Friend 2009-09-03 03:33:21 EDT
Dear Darin Wright,

Based on the suspect that there may be a change in Android tooling, I've reported the bug to Android & the response is that there is a conflict with one of the Eclipse plugins as listed in the given below url:

http://code.google.com/p/android/issues/detail?id=3767

Dear Dave Carver,

How do I uninstall XSL tools feature as I've never installed it manually.

Thanks,
Ravi.
Comment 14 David Carver CLA Friend 2009-09-03 09:53:28 EDT
(In reply to comment #13)
> 
> How do I uninstall XSL tools feature as I've never installed it manually.

It probably came with whatever version of Eclipse 3.5 you downloaded.  

You can uninstall the Eclipse XSL Developer Tools feature, by going to Help->About->Installation Details, and then select the XSL Feature.   Then press Uninstall.
Comment 15 Nitin Dahyabhai CLA Friend 2009-09-03 09:58:10 EDT
Alternately, you can try changing the "Launch Operation" preference on the "Launching" preference page under the "Run/Debug" category.  There may also be a "Default Launchers" preference page that you can use to straighten the behavior out (not having the Android tools installed, I'm unable to confirm this myself).
Comment 16 Ian Tewksbury CLA Friend 2010-03-11 16:19:23 EST
It seems some lovely discussion went on here 5 months ago but it has since died out.

Ravi,

Do you now have an acceptable solution to your problem, or is there something more that needs to be done on the developer side?  Thanks.
Comment 17 Ravi CLA Friend 2010-03-11 21:27:37 EST
I'm just hoping that the bug gets fixed in Eclipse 3.6 as it still exists. Right now, the alternate solution is clumsy which is as given below:

1. Modify XML file.Ex-AndroidManifest.xml
2. Open Java Source File & Press Ctrl + F11.
3. Compiles as Android Application.
Comment 18 Daniel CLA Friend 2010-03-17 12:14:17 EDT
Hi Folks,
my problem is very similar. After I updated from 3.5 to 3.5.2 the "Run As..." dialog won't even show in the menu when a xml file is selected. If I switch to a normal java source file it returns and I am able to launch the project. I also tried different run configurations in the "Run/Launch" properties. No success...

Could this even be an Android-plugin bug?
Suggestions anyone?

Cheers, Daniel
Comment 19 Kaushik CLA Friend 2010-03-31 14:01:06 EDT
This is not an Andriod-only issue.
I downloaded the latest Eclipse-Jee 3.5 and have the exact same problem with the XSL-JAX launcher creating .out.xml files.
When I drill down to the option of "Help->About->Installation Details, and then select the XSL Feature" as suggested by Dave, the Uninstall button is disabled- so i am not able to uninstall this plugin.
Is there an alternative way or a brute force method to disable the XSL-launcher plugin?
Comment 20 Nitin Dahyabhai CLA Friend 2010-03-31 22:42:37 EDT
The com.android.ide.eclipse.adt plug-in specifies a contextual launch shortcut [long story short, it's what connects the selected resource to a type of launch], and while it is enabled on Android Projects and Folders in them, it is not enabled for Files.  From com.android.ide.eclipse.adt's plugin.xml:

<contextualLaunch>
 <enablement>
  <with variable="selection">
   <count value="1"/>
   <iterate>
    <and>
     <test property="org.eclipse.jdt.launching.isContainer"/>
     <test property="org.eclipse.jdt.launching.hasProjectNature" args="com.android.ide.eclipse.adt.AndroidNature"/>
    </and>
   </iterate>
  </with>
 </enablement>
</contextualLaunch>

The XSL transformation launch shortcut is far more liberal, applying to any XML file anywhere, which includes the AndroidManifest.xml as it does not have a custom content type.  From org.eclipse.wst.xsl.debug.ui's plugin.xml:

<contextualLaunch>
 <enablement>
  <with variable="selection">
   <iterate>
    <adapt type="org.eclipse.core.resources.IFile">
     <or>
      <test
       property="org.eclipse.core.resources.contentTypeId"
       value="org.eclipse.core.runtime.xml" />
      <test
       property="org.eclipse.core.resources.contentTypeId"
       value="org.eclipse.wst.xml.core.xmlsource" />
      <test
       property="org.eclipse.core.resources.contentTypeId"
       value="org.eclipse.wst.xml.core.xslsource" />
      <test
       property="org.eclipse.core.resources.contentTypeId"
       value="org.eclipse.wst.xsd.core.xsdsource" />
     </or>
    </adapt>
   </iterate>
  </with>
 </enablement>
</contextualLaunch>

No one's actually doing anything wrong, but proper solution would be, I think:
1) the Android tools define AndroidManifest.xml to be a new content type that is a subtype of or.eclipse.core.runtime.xml
2) the Android launch shortcut enablement is updated to include files of that content type

As for comment 18, I can't reproduce it with Galileo SR2.  And comment 19 sounds like a different bug altogether.  The recommendation from comment 2 still stands, however.  Resolving based on the problem reported in comment 0 (the mentioned exception is in the Console output only, and of a diagnostic nature).
Comment 21 Daniel CLA Friend 2010-04-01 04:38:22 EDT
Hi,
sorry for late reply and thanks for the great answer.
I don't know how but after I closed and reopened my Android project it somehow fixed the glitch. Not shure if this is even possible, but suddenly I don't have this issue any more. I did not change anything on my Eclipse but it actually works again.

Cheers, Daniel