Bug 112915 - [WorkbenchParts] Remove TextEditor dependency from RevertToSavedAction
Summary: [WorkbenchParts] Remove TextEditor dependency from RevertToSavedAction
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2005-10-18 06:13 EDT by Hirotaka Matsumoto CLA
Modified: 2019-09-06 15:36 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hirotaka Matsumoto CLA 2005-10-18 06:13:16 EDT
Currently RevertToSavedAction depends on TextEditor, but I think
this should depend on only IDocumentProvider, not an ITextEditor
so that other editors which are basedon IDocumentProvider can reuse
this action.

.
Comment 1 Dani Megert CLA 2005-10-18 06:54:33 EDT
The document provider is shared and does not know the element. We would have to
pass in the document provider and an element to save. In addition, actions often
report failure which requires a handle to a shell (parent).

If you need such an action you can write it using existing API. There are no
plans to add this.
Comment 2 Hirotaka Matsumoto CLA 2005-10-18 08:04:57 EDT
If this action needs the document provider, an
element and the shell, there are many ways to provide them to Action.

Creating the action which has the same functionality 
is a duplicate effort. 

Please reconsider.
Comment 3 Dani Megert CLA 2005-10-18 08:10:36 EDT
Sorry, but we won't add this. In order to work with the document provider you'll
need the editor input which you most likely get from the editor. Hence you can
pass in the editor directly.
Comment 4 Hirotaka Matsumoto CLA 2005-10-18 08:35:18 EDT
Reopening again. If you need IEditorInput, we can pass it through,
for example, IEditorPart. ( Editor needs to be the implementaion of
IEditorPart, so requiring this interface is fair enough. )

Let me explain more. We develop MultiPageEditor which has mainly 
two editors. One is a graphical editor and another one is a TextEditor
(for its source file.) Most users use its graphical editor, but
TextEditor provides very useful IActions and if they are not
TextEditor specific ( like the action I'm talking about ) we would
like to offer them to our users. But to use them, we need to instantiate
TextEditor for only using these actions, and this is a memory usage/performance
consideration. ( so we usually instantiate
either of graphical or text editor )


Hence, we would like to ask this enhancement. 

Please reconsider again.



Comment 5 Dani Megert CLA 2005-10-18 09:13:47 EDT
If you don't instantiate the text editor then the editor input which connects to
the editor input to the document won't be in the document provider and hence the
action would not work. Or does your graphical editor create the document and
register it correctly with the document provider even if the text editor is not
there?
Comment 6 Hirotaka Matsumoto CLA 2005-10-18 21:11:52 EDT
(In reply to comment #5)
> action would not work. Or does your graphical editor create the document and
> register it correctly with the document provider even if the text editor is not
> there?

yes.
Comment 7 Dani Megert CLA 2005-10-19 03:00:26 EDT
The RevertToSaved action is an action that acts on the text editor i.e. the UI:
it reverts the presentation to the saved state of the model. Providing this
action for a case where the UI isn't even constructed makes no sense and is
against the API specification of that action. In addition most editors - be it a
text editor or a graphical editor - will also have to perform some UI resetting.
If you think revert to saved is interesting for a general set of editors
including multi-page editor you should file a bug report against Platform UI to
add doRevertToSaved() to IEditorPart and provide a generic RevertToSaved action
that calls IEditorPart.doRevertToSaved().

In your case revert to saved should only revert the graphical editor to the
saved state of its model. If the model is the same as the one for the text
editor i.e. if you use a document via document provider then please copy the
code in AbstractTextEditor.performRevert()

Please do not reopen again.
Comment 8 Hirotaka Matsumoto CLA 2005-10-19 03:17:56 EDT
Having IEditorPart.doRevertToSaved() might be a good idea.

Per request, I'm assigning this enhancment request to PlatformUI 
component.

Comment 9 Dani Megert CLA 2005-10-19 03:25:23 EDT
>Per request,
For the records: I did not request this.
Comment 10 Paul Webster CLA 2006-09-28 11:01:20 EDT
There are currently no plans to work on this feature.

PW
Comment 11 Denis Roy CLA 2007-06-22 09:33:06 EDT
Changes requested on bug 193523
Comment 12 Eclipse Webmaster CLA 2019-09-06 15:36:17 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.