Bug 200933 - [TOC][Editors] HTML file wizard has validation errors on open
Summary: [TOC][Editors] HTML file wizard has validation errors on open
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Noam Chitayat CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-08-23 08:13 EDT by Mike Pawlowski CLA
Modified: 2007-08-29 11:28 EDT (History)
3 users (show)

See Also:
mike.pawlowski: review+


Attachments
Patch for bug 200933. (2.47 KB, patch)
2007-08-24 15:27 EDT, Noam Chitayat CLA
no flags Details | Diff
Revised patch, as per Brian's suggestion. (4.27 KB, patch)
2007-08-28 17:30 EDT, Noam Chitayat CLA
mike.pawlowski: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Pawlowski CLA 2007-08-23 08:13:49 EDT
Steps To Reproduce:

(1) Open any TOC
(2) Select any Topic
(3) Input 'a.x' into the 'Location' field
(4) Click 'Location' hyperlink
    -> BUG:  New HTML file wizard opens with an error indicating the filename
       must have an HTML extension

Valid extensions are ".xhtml", ".htm", ".html".

I think we should just force an extension of '.htm' for any files we create 
(i.e. set as the default extension in the wizard and remove the validation regarding whether the file extension is valid or not).

These are the reasons:

(1) We are not in the business of creating HTML files (leave that to WTP)
(2) The new HTML wizard was added for convenience only and is spawned off 
    a hyperlink
(3) The HTML file content we generate is HTML 4.01 Transitional
(4) .htm is the common extension used for doc files in the Eclipse Project
Comment 1 Noam Chitayat CLA 2007-08-24 15:27:33 EDT
Created attachment 76949 [details]
Patch for bug 200933.

This patch changes the wizard so that ".htm" is automatically added.
To me this seems like a reduction in functionality, in that users are not able to specify the extensions that they want for the wizard. 

For example, a user types "index.xhtml" into a Topic, and then proceeds to attempt to make the file. The result is "index.xhtml.htm", which was not their intention.

If possible, I'd like to hear a third opinion before we go ahead and commit this. We were violating a convention before, but this may be too restrictive a solution.
Comment 2 Mike Pawlowski CLA 2007-08-24 16:17:18 EDT
CC'ing Brian.
What are your thoughts on this Brian? (ping either of us if you need some background information)
Comment 3 Brian Bauman CLA 2007-08-27 14:36:41 EDT
It is my understanding that the content we create in the wizard is valid for each of the three valid extensions .htm, .html and .xhtml. 

With this in mind, what we can do is check to see if the user specified one of the valid extensions in the file name.  If so, keep the extension.  If they specified "index.xhtml", write our template our but keep the name the user specified.

If the file extension does not exist or is not one of the three valid types, then we can default back to the .htm extension.

This solution allows us to be as user friendly and least restrictive as possible with very little work (simply check to see if the file extension is valid one of the three valid types).  We are not in the business of creating web files.  I don't want to multiple template file for each file type(.htm, .html, .xhtml), but if the content is the same and it is only a matter of file name, we can try to accommodate user's intent.
Comment 4 Mike Pawlowski CLA 2007-08-27 17:00:58 EDT
RE:  Comment #3

>> simply check to see if the file extension is valid one of the 
>> three valid types

One complication is that this type of checking / validation is done at
a higher level in the IDE wizard component.  This mechanism does not
support multiple valid file extensions. We will have to either replicate
the functionality we require within PDE or submit a patch to the IDE team
to adjust their mechanism.

>> I don't want to have multiple template files for each file type 

Unfortunately, if we do allow the xhtml file extension, then the HTML 4.01
template content is invalid and misleading.  If we do end up supporting
all three extensions (really two  xhtml and htm/html) then we should have 
template content for each.
Comment 5 Mike Pawlowski CLA 2007-08-27 17:02:24 EDT
CC'ing Chris.
Chris we are sort of deadlocked on this issue.
What are your thoughts? (ping any of us if you need some
background information)
Comment 6 Chris Goldthorpe CLA 2007-08-27 17:58:26 EDT
I think that we should let the user type in whatever extension they want. If the file exists clicking on "Location" should open it. If the file does not exist and the extension is not one of our three favorites let the user know that we can't create it. 

Is "Location" the best name for this label, I find it a litle surprising that clicking on a hyperlink called "Location" will try to create a file for me.
Comment 7 Brian Bauman CLA 2007-08-27 18:06:03 EDT
So now that I talked to Mike, the main issue is the error showing up in the
wizard upon being opened.  I found a similar scenario.  In any plug-in project,
create a view extension.  Create a view element.  Add "1" to the beginning of
any segment of the package.  Since this is not a valid package, the New Java
Wizard will open in an invalid state.  

Click the hyperlink in our editor and you get a wizard which displays no error
but does have the finish button disabled.  Once you modify any setting, it
comes up with the error message.  For consistency, we should do the same.  Open
the wizard with no error but keep the finish button disabled.  Then when
anything is modified, go ahead and display errors/warnings.

It is arguable if this is the best behavior, but it is important that we stay
consistent with the behavior of other components.  If our users are gravely
upset with the behavior, they can open a bug and we can consider what action
should be taken.
Comment 8 Noam Chitayat CLA 2007-08-28 17:30:29 EDT
Created attachment 77186 [details]
Revised patch, as per Brian's suggestion.
Comment 9 Mike Pawlowski CLA 2007-08-29 11:27:40 EDT
Comment on attachment 77186 [details]
Revised patch, as per Brian's suggestion.

Excellent patch.  Thanks Noam.
Comment 10 Mike Pawlowski CLA 2007-08-29 11:28:45 EDT
Patch released to HEAD.

Target:  3.4 M2