Transformation scenario from files on disk

Are you missing a feature? Request its implementation here.
queshaw
Posts: 41
Joined: Wed Aug 08, 2007 5:56 am

Transformation scenario from files on disk

Post by queshaw »

I have a transformation scenario using 5 XSLT files. I keep encountering a problem because I edit partially in emacs and partially in oxygen. When I run a transformation in oxygen, it seems to use what is loaded into oxygen, instead of what is on disk.

I would like it if, when running a transformation, oxgyen would complain that files have changed outside the editor, and prompt the user to load the changes before running the transformation.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

If the version of the XSLT file from the disk is not the same as the version edited in the editor panel usually the version from the editor panel is newer (not saved yet) and that should be used in the transformation. This is the general use case when the version from the editor panel is not the same as the version from disk because usually the XSLT stylesheet applied in a transformation is edited in the same application that applies the transformation. The version from the oXygen's editor panel is considered the primary version for operations executed in oXygen and the version from disk is the secondary one.

If you want to override the primary version with the secondary one you have to allow the editor panel before running the transformation to check if the secondary one is newer by moving the focus in the editor panel and by choosing the option to discard the changes from the editor panel when it presents a dialog asking about that. I think it is annoying to present the dialog automatically for each file that is newer on disk when the transformation is applied.


Regards,
Sorin
queshaw
Posts: 41
Joined: Wed Aug 08, 2007 5:56 am

Post by queshaw »

When I usually encounter the problem, it is because the XSLT that has focus is not the one that changed, in my transformation chain. The way I get around it, is as you said, I give the file that I changed outside focus and then I'm prompted to load the changes from disk. The problem is that I forget to do that, and then I wonder why my transformation didn't work right.

The editor could in theory make a distinction between files that have unsaved changes in the editor, and files that have been saved. If I have unsaved changes, then I want the file in the editor to take priority over the one on disk, otherwise I want the one on disk to take priority. In other IDEs that I have used, for java, C, etc., that is how it works.

Another way put it is: to make sure my transformation works, I need to click on each file in my transformation chain, so that the editor will prompt me to load any files that changed on disk, and then run the transformation. I'd like it if the the editor would do that itself each time it runs a transformation scenario.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

queshaw wrote:In other IDEs that I have used, for java, C, etc., that is how it works.
I am sorry, that is not true in case of Eclipse which is a largely used IDE. I just checked if the Eclipse IDE uses the Java source file from disk or the current version from a Java editor panel of the Eclipse IDE which is in the saved state (no unsaved changes in the Eclipse editor). If I run a Java class opened in other Java editor panel in Eclipse which uses the file from the editor panel which is in the saved state (no unsaved changes) I see that the current version from the saved editor is used, not the file from disk. Eclipse uses the version from disk only if you click first in the editor panel which is in the saved state and you confirm the refresh operation in the dialog which pops up. oXygen does the same thing.

As I said if a file is opened in an editor panel in oXygen the version contained in the editor panel is the primary version and the version stored on disk is the secondary version. Do you have an example of a largely used IDE which works as you said?
queshaw wrote:Another way put it is: to make sure my transformation works, I need to click on each file in my transformation chain, so that the editor will prompt me to load any files that changed on disk, and then run the transformation. I'd like it if the the editor would do that itself each time it runs a transformation scenario.
If you want to use the version from disk which is updated by other application instead of the current version (saved or not saved) from an editor panel opened in an IDE then either you close the editor panel from the IDE (because you edit the file with other application) or you move the focus in the editor panel of the IDE and confirm the refresh operation in the popup dialog which the IDE displays automatically. Any IDE considers the version from its editor panel as primary one.


Regards,
Sorin
queshaw
Posts: 41
Joined: Wed Aug 08, 2007 5:56 am

Post by queshaw »

Okay, I shouldn't have said other IDEs work that way. It was my memory that they work that way. Or at least, I haven't encountered the problem where I discover that running a process in an IDE is failing because there are changes to the files on disk that are not being used during a build.

In eclipse I usually use ant as well and when I run a build in eclipse it runs ant which uses the files on disk. So, I suppose I haven't had an opportunity to encounter the same behavior regarding files in the editor vs. on disk, in eclipse.

I still think it would be a good feature, even if it doesn't match the behavior of other IDEs. When the files on disk are newer than the versions in the editor that have been saved, I would think that would be an important fact for the author to become aware of.

It's good that oxygen prompts the user that there are changes on disk when they give the file focus. It would be annoying if oxygen prompted the user whenever the file is changed on disk. But, when you are about to perform a transformation I think anyone would want to know about the situation where files on disk are different.

Why is it good to prompt the user about changes when they give the file focus? Wouldn't the same reason justify prompting the user before they run a transformation scenario?
Radu
Posts: 8991
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi,

By the way, why are you using emacs to edit XSL files instead of Oxygen?
Is there any feature you are missing in Oxygen?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
queshaw
Posts: 41
Joined: Wed Aug 08, 2007 5:56 am

Post by queshaw »

Emacs is a lisp interpreter with some editor functionality. So, there is little you can't do in emacs, as far as editing. If you don't have some editing feature that you want, you can usually write it in lisp.

Where oxygen shines, is in XML specific editing, of course. But, leaving out the XML specific features, oxygen is what I call an "etch-a-sketch" style editor. You can move up, down, left, right and few other things, like end-of line and beginning of line. That is a microscopic proportion of what you can do in emacs. I'm used to being able to get to where ever I want in a document with a few key strokes. So, I start to feel like I have oven mitts on my hands after a short while editing in oxygen, if I have to do a lot of typing.

For XML specific editing features, I switch between nxml mode in emacs and oxygen. The advantage to nxml mode is that it is inside emacs, so I can use all of the power of emacs while editing, but oxygen has various features that nxml mode doesn't, so I switch to oxygen when it's easier to do so.

Generally, the less typing involved in an editing task, the more likely I am to use oxygen for it, like moving one element from one place to another. If there is a lot of typing that I need to do, it becomes much too slow in oxygen, so I switch over to emacs.
Post Reply