How to set an editor unmodifiable? [message #497621] |
Fri, 13 November 2009 04:57  |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
I have to open arbitrary editors in my RCP app programmatically. But the
user mustn't modify the content. is it possible to set the editor
unmodifiable?
|
|
|
|
|
|
|
|
|
Re: How to set an editor unmodifiable? [message #498259 is a reply to message #498224] |
Mon, 16 November 2009 03:43  |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
Hi Wang,
yes this is clear. I imagined that it is possible with a wrapper but I
thought there is a setModifiable method or something similar anywhere ;)
Thanks so much.
best regards,
Gilbert
> Hi Gilbert,
> Sorry I didn't check new group at weekend :)
> I assume the input is an IFileEditorInput.
>
> 1. You need write a FileEditorInput wrapper.
>
> 2. File Wrapper which indicates all files as readonly.
>
> The idea is that in the FileEditorInput wrapper delegates all the method
> to the warpped FileEditorInput, but overwrite the getFile method. In the
> getFile method, return the read only file wrapper.
>
> Since all other methods are just delegating to the original one, it'll
> not affect the normal file opening process. The only change is that all
> files will be marked as read only, so that the editor will be read only
> as well.
>
> Hope this is clear.
>
> Cheers
> Q.S. Wang
>
>
> Gilbert Mirenque wrote:
>> Hi Wang,
>> yes I have control of opening the editor.
>>
>> IWorkbenchPage page = window.getActivePage();
>> IEditorInput input = // generically determine input
>> String editorID = // determine id for input
>> IEditorPart editorPart = page.openEditor(input, newEditorID);
>>
>> Input and id definitely belong together. I searched in the editorPart
>> for possibilities of setting it unmodifiable but without success. Do you
>> have an idea?
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03820 seconds