I'm developing an Eclipse plugin, where I need every editor of the application to be readonly, depending on the path of the contained file (relative to the project).
I've made my own editor class, and been able to override some method to get what I want:
public class MyTextEditor extends TextEditor {
/**
* Overridden to inhibit the replace action in find&replace dialog.
*/
@Override
public boolean isEditorInputModifiable() {
if (!super.isEditorInputModifiable()) {
return false;
}
return Utils.checkEditorInputModifiable(getEditorInput());
}
/**
* Overridden to inhibit any user edit in the editor input.
*/
@Override
public boolean isEditable() {
if (!super.isEditable()) {
return false;
}
return Utils.checkEditorInputModifiable(getEditorInput());
}
How to make read only editor in Eclipse (Eclipse Plugin Development)
But the question is: how to do that on the compare editor??
The editor used by eclipse in each compare dialog is a different editor, I can use my content ContentMergeViewer and set the compareConfiguration as readonly (on one side or both) but this is not sufficient. The compareInput on each side should be made readonly!
Or is there any other more convenient way to achive what I want??
Thank you!