| Summary: | when invoking "IDE.saveAllEditors(...)" on CM operations, choosing discard fails to refresh dirty editors. | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | John P. Petrakis <jpetrakis> | ||||
| Component: | IDE | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> | ||||
| Status: | RESOLVED WONTFIX | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | daniel_megert, prakash | ||||
| Version: | 3.4.2 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
John P. Petrakis
By the way, I've tried this using eclipse distributions back to 3.4.0 with the same results. Is there a way I can reproduce this one without clearcase? What ClearCase plug-in / Team provider do you use? This is responsible to handle those cases.
>3. undo the checkout - editor never refreshes.
How exactly do you do this?
This is the ClearCase SCM Adapter. saveAllEditors can save them but it cannot discard when the user clicks "discard"??? Reverting editors would require knowledge of the type of editor... and in fact, things like "doRevertToLastSaved" only seems to be available in the ITextEditor implementation. Other editors such as the manifest editor, are *internal* classes which I cannot access. There is no provision in the IEditorPart interface for such a reversion... this functionality seems to be hidden in the implementation. The only clean way appears to handle this is in saveAllEditors. Calling this prior to the CM operation would be the only way to properly handle this it would seem. I cannot access (for example) the xtools editor classes without resorting to reflection since eclipse and desktop product both must be supported. >>3. undo the checkout - editor never refreshes. How exactly do you undo the check out? The SDK does not offer this. Is the main purpose of this bug to make the ClearCase undo feature work? Couldn't you store the relevant information so that you can later refresh the dirty editors in your implementation of org.eclipse.core.commands.operations.IUndoableOperation.undo(IProgressMonitor, IAdaptable)? Using saveAll should be the last resort as it also saves potentially unrelated files. >This is the ClearCase SCM Adapter. saveAllEditors can save them but it cannot >discard when the user clicks "discard"??? I'm not sure what "discard" you mean exactly. Out of the box there is no dialog when 'Save All' is invoked and AFAIK there is only a "prompt" option on the saveAll API. When I invoke savveAllEditors with confirm = true, I get a three-button popup, with "save", "discard", and "cancel". I *have* the list of IResource objects that will be "uncheckedout" I have tried to use this specific method: public static boolean saveAllEditors(final IResource[] resourceRoots, final boolean confirm) Does this *not* limit the action of the save to the list of IResources involved in the cm operation? Save does the save... and cleans up the dirtyness of the editors. Discard does not. It seems to me it should. (In reply to comment #6) > When I invoke savveAllEditors with confirm = true, I get a three-button popup, > with "save", "discard", and "cancel". Mmh. I really don't think there is a 'Discard' button on it. Can you attach a screen shot of the dialog you're seeing? > I *have* the list of IResource objects that will be "uncheckedout" > I have tried to use this specific method: > > public static boolean saveAllEditors(final IResource[] resourceRoots, > final boolean confirm) > > Does this *not* limit the action of the save to the list of IResources > involved in the cm operation? There are several saveAllEditors APIs. This one indeed knows what it saves, so you're fine here. Created attachment 193494 [details]
png showing saveAllEditor popup for single selection...
Ok... so it isn't discard, but "No"... but the question is: "Save selection?". If I say no it means no... perhaps I'm seeing this wrong? However if you multiple select, you get a different kind of popup with checkboxes and a TWO button choice. If I deselect one or more of the items in THAT case I would not necessarily expect a reversion. (In reply to comment #9) > Ok... so it isn't discard, but "No"... but the question is: "Save selection?". > If I say no it means no... perhaps I'm seeing this wrong? I think so: you simply say "no" to saving one of the dirty editors when performing 'Save All'. What you are looking for is an additional mode or API where one can specify to not only save but also revert the editor instead of saving. This however, will be hard to introduce after the fact: as you already noted there is no API on IEditorPart to request such a behavior from the editor. (In reply to comment #10) > What you are looking for is an additional mode or API > where one can specify to not only save but also revert the editor instead of > saving. This however, will be hard to introduce after the fact: as you already > noted there is no API on IEditorPart to request such a behavior from the > editor. Which does not sound like a practical enhancement. As always, please feel free to reopen, especially if there is a patch. (In reply to comment #10) > (In reply to comment #9) > > Ok... so it isn't discard, but "No"... but the question is: "Save selection?". > > If I say no it means no... perhaps I'm seeing this wrong? > I think so: you simply say "no" to saving one of the dirty editors when > performing 'Save All'. What you are looking for is an additional mode or API > where one can specify to not only save but also revert the editor instead of > saving. This however, will be hard to introduce after the fact: as you already > noted there is no API on IEditorPart to request such a behavior from the > editor. That's fine... *I* wouldn't have to do it explicitly if a "No" response to to the save would actually discarded changes when it asked: "do you want to save the changes" > That's fine... *I* wouldn't have to do it explicitly if a "No" response to to
> the save would actually discarded changes when it asked: "do you want to save
> the changes"
The operation is 'Save' and not 'SaveOrDiscard'. The only thing you can choose is whether to save or not and that is the expected behavior.
|