[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.tmf] Re: XText Editor with Read Only sections

Hi,

I am not sure I understand all of the implications of your use case. The following is an untested sketch. If you want to make sure that a user does not modify certain sections in the document (using the DSL editor, with others it will be possible), you could bind your own XtextDocumentProvider. There you override the isModifiable-method. This seems to be called whenever you open an Xtext document, give it focus or change the cursor position within the document. You would then return false if the cursor is within a read only section, true otherwise. For calculating the cursor position you will probably have to ask the IDE for the active editor which should be an XtextEditor. The SelectionProvider will give you access to the cursor's position.

Alex

Ioan schrieb:

I am using XText in collabotration with other Eclipse EMF based projects and I would like to integrate XText with graphic based editors in order to define textual annotations for graphical elements. One of the feature I would like to have from XText, is to be able to define areas inside of XText Editor which are read only. These sections are suppose to be automatically generated/maintained by other modules. How difficult is to implement a such feature?


Regards,

Ioan