Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to make one page on a Multi-Page read-only ?
How to make one page on a Multi-Page read-only ? [message #326694] Fri, 28 March 2008 19:37 Go to next message
Eclipse UserFriend
Originally posted by: marcio.debarros.gmail.com

Hi,

I have a MultiPage that implements a FormEditor, and it has 4 pages.
Three of these pages are form pages and have sub-sets of the model, and
the last page is a plain text editor, which has the complete model in a
XML format. All changes to the model must be made through one of the
form pages, and once the Save button is pressed, it should update the
XML text. However the users should be able to see the text based page,
but can not type or make changes directly to it.


Any suggestion on how can I do that ?

Thanks,

--MD.
Re: How to make one page on a Multi-Page read-only ? [message #326729 is a reply to message #326694] Mon, 31 March 2008 12:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Marcio DeBarros wrote:
> Hi,
>
> I have a MultiPage that implements a FormEditor, and it has 4 pages.
> Three of these pages are form pages and have sub-sets of the model, and
> the last page is a plain text editor, which has the complete model in a
> XML format. All changes to the model must be made through one of the
> form pages, and once the Save button is pressed, it should update the
> XML text. However the users should be able to see the text based page,
> but can not type or make changes directly to it.

It would depend on what class implements that text editor - I would
imagine whatever it is, it has a read-only or editable property that can
be set...

Eric
Re: How to make one page on a Multi-Page read-only ? [message #326752 is a reply to message #326729] Mon, 31 March 2008 15:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: marcio.debarros.gmail.com

Eric Rizzo wrote:
> Marcio DeBarros wrote:
>> Hi,
>>
>> I have a MultiPage that implements a FormEditor, and it has 4 pages.
>> Three of these pages are form pages and have sub-sets of the model,
>> and the last page is a plain text editor, which has the complete model
>> in a XML format. All changes to the model must be made through one of
>> the form pages, and once the Save button is pressed, it should update
>> the XML text. However the users should be able to see the text based
>> page, but can not type or make changes directly to it.
>
> It would depend on what class implements that text editor - I would
> imagine whatever it is, it has a read-only or editable property that can
> be set...
>
> Eric


Hi Eric,

The class is org.eclipse.ui.editors.text.TextEditor, the only two
methods that make a reference to a read-only state are:

isEditorInputReadOnly() and isEditorInputModifiable() inherited from
AbstractTextEditor. I also looked at the IEditorInput hierarchy and
there is nothing there as well. But I am not sure if the EditorInput is
the answer for me, because what I am trying to do is to prevent changes
to be made from that specific page, while the file (EditorInput) can be
modified.

It is like if on the plugin.xml editor you could make and save changes
from to the file from the Extensions tab, but could only see, not even
type on the plugin.xml tab.
Re: How to make one page on a Multi-Page read-only ? [message #326765 is a reply to message #326752] Tue, 01 April 2008 01:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Marcio DeBarros wrote:
> Eric Rizzo wrote:
>> Marcio DeBarros wrote:
>>> Hi,
>>>
>>> I have a MultiPage that implements a FormEditor, and it has 4 pages.
>>> Three of these pages are form pages and have sub-sets of the model,
>>> and the last page is a plain text editor, which has the complete
>>> model in a XML format. All changes to the model must be made through
>>> one of the form pages, and once the Save button is pressed, it should
>>> update the XML text. However the users should be able to see the text
>>> based page, but can not type or make changes directly to it.
>>
>> It would depend on what class implements that text editor - I would
>> imagine whatever it is, it has a read-only or editable property that
>> can be set...
>>
>> Eric
>
>
> Hi Eric,
>
> The class is org.eclipse.ui.editors.text.TextEditor, the only two
> methods that make a reference to a read-only state are:
>
> isEditorInputReadOnly() and isEditorInputModifiable() inherited from
> AbstractTextEditor. I also looked at the IEditorInput hierarchy and
> there is nothing there as well. But I am not sure if the EditorInput is
> the answer for me, because what I am trying to do is to prevent changes
> to be made from that specific page, while the file (EditorInput) can be
> modified.

Would it be enough for you to subclass TextEditor and override one of
those methods or isEditable() to return false?

It is kind of a brute-force approach, but might be the most
straightforward approach. From looking at the implementations of those
methods, it looks like the other way is to get knee deep into document
providers.

Hope this helps,
Eric
Re: How to make one page on a Multi-Page read-only ? [message #326796 is a reply to message #326765] Tue, 01 April 2008 14:08 Go to previous message
Eclipse UserFriend
Originally posted by: marcio.debarros.gmail.com

Eric Rizzo wrote:
> Marcio DeBarros wrote:
>> Eric Rizzo wrote:
>>> Marcio DeBarros wrote:
>>>> Hi,
>>>>
>>>> I have a MultiPage that implements a FormEditor, and it has 4 pages.
>>>> Three of these pages are form pages and have sub-sets of the model,
>>>> and the last page is a plain text editor, which has the complete
>>>> model in a XML format. All changes to the model must be made through
>>>> one of the form pages, and once the Save button is pressed, it
>>>> should update the XML text. However the users should be able to see
>>>> the text based page, but can not type or make changes directly to it.
>>>
>>> It would depend on what class implements that text editor - I would
>>> imagine whatever it is, it has a read-only or editable property that
>>> can be set...
>>>
>>> Eric
>>
>>
>> Hi Eric,
>>
>> The class is org.eclipse.ui.editors.text.TextEditor, the only two
>> methods that make a reference to a read-only state are:
>>
>> isEditorInputReadOnly() and isEditorInputModifiable() inherited from
>> AbstractTextEditor. I also looked at the IEditorInput hierarchy and
>> there is nothing there as well. But I am not sure if the EditorInput
>> is the answer for me, because what I am trying to do is to prevent
>> changes to be made from that specific page, while the file
>> (EditorInput) can be modified.
>
> Would it be enough for you to subclass TextEditor and override one of
> those methods or isEditable() to return false?
>
> It is kind of a brute-force approach, but might be the most
> straightforward approach. From looking at the implementations of those
> methods, it looks like the other way is to get knee deep into document
> providers.
>
> Hope this helps,
> Eric

I took an approach similar do what you suggested by extending TextEditor
and then creating two methods disablePage() and enablePage(), inside
each method is call: getSourceViewer().setEditable(true || false);

Then from the main editor before the text page goes in focus I disable
it, and enable it for all the others.

Thanks for your help Eric.

--Marcio.
Previous Topic:Docs for getting started with org.eclipse.ui.menus / handlers ?
Next Topic:executing org.eclipse.ant.core.antRunner with or without shell
Goto Forum:
  


Current Time: Thu Jun 27 20:47:59 GMT 2024

Powered by FUDForum. Page generated in 0.02828 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top