Bug 27259 - [resources] Need better error code in status returned from validateEdit
Summary: [resources] Need better error code in status returned from validateEdit
Status: RESOLVED DUPLICATE of bug 42230
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P2 critical (vote)
Target Milestone: ---   Edit
Assignee: John Arthorne CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2002-11-27 12:45 EST by Dirk Baeumer CLA
Modified: 2003-10-15 13:57 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2002-11-27 12:45:23 EST
Build I20021126

The code contained in the status returned from IWorkspace#validateEdit() can't 
be used to derive why validateEdit failed (the current CVS plugin simple uses 
IStatus.ERROR as a code). For example if it failed because a read-only file 
couldn't be made writable (since the file is locked by another user) JDT-UI 
would like to present a dialog to the user but not log the status. If it fialed 
due to another reason the status should be logged as well.

I propose that core resources defines a corresponding error code and that the 
spec of validateEdit is extended is a way that all "implementors" of this hook 
must use this constant to signal the case that a file couldn't be 
made "writable".
Comment 1 DJ Houghton CLA 2003-01-16 14:19:53 EST
Adding Jeem to CC for comment.
Comment 2 John Arthorne CLA 2003-02-19 11:47:20 EST
Since you're in UI code, I assume you are passing in a context (Shell) to
validate edit.  If so, you don't need to report anything, as the spec states:

"If a shell is passed in as the context, the VCM component may bring up a
dialogs to query the user or report difficulties; the shell should be used to
parent any such dialogs; the caller may safely assume that the reasons for
failure will have been made clear to the user."

If you're not in UI code, just display the given status to the user, and don't
log anything. This is really a boolean operation: OK signals that the files are
writable, ERROR signals they are not writable.  There is no reason to log
anything here.  If the VCM component had some kind of internal error, it can log
that itself.
Comment 3 Dirk Baeumer CLA 2003-02-19 11:54:17 EST
Then this should be at least speced in the Javadoc. And I am still convinced 
that the status returned should have a meaning full code.
Comment 4 John Arthorne CLA 2003-02-19 15:02:13 EST
I'm not sure what cases are not covered by the doc.  Are you thinking that the
checkout might suceed but an ERROR status be returned for another reason? If
there are only two possible outcomes ("the files are modifiable" or "the files
are not modifiable"), then another status code isn't useful.

Comment 5 John Arthorne CLA 2003-10-15 13:57:34 EDT

*** This bug has been marked as a duplicate of 42230 ***