@Override public void propertyChanged(PartPresenter source, int propId) { if (!(source instanceof EditorPartPresenter)) { return; } boolean isReadOnly = ((EditorPartPresenter) source).getEditorInput().getFile().isReadOnly(); if (!isReadOnly && propId == EditorPartPresenter.PROP_DIRTY) { editorTab.setUnsavedDataMark(((EditorPartPresenter) source).isDirty()); } } });
private void finalizeInit( VirtualFile file, EditorPartPresenter editor, EditorProvider editorProvider) { openedEditorsToProviders.put(editor, editorProvider.getId()); editor.addCloseHandler(this); editor.addPropertyListener( (source, propId) -> { if (propId == EditorPartPresenter.PROP_INPUT) { if (editor instanceof HasReadOnlyProperty) { ((HasReadOnlyProperty) editor).setReadOnly(file.isReadOnly()); } if (editor instanceof TextEditor) { editorContentSynchronizer.trackEditor(editor); } } }); }
boolean isReadOnly = editorPart.getEditorInput().getFile().isReadOnly(); editorTab.setReadOnlyMark(isReadOnly);