X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FcomponentTypeEditor%2FComponentTypeScriptDocumentProvider.java;h=a8e637a04dd240b0d8cd51aa9398e6dc5694bbc5;hb=b4374193caf61635d382af556ec913bf278d53a8;hp=0425ac149b81187a6ea64913b829506ad2c42cb5;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java index 0425ac149..a8e637a04 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeScriptDocumentProvider.java @@ -21,6 +21,7 @@ import org.simantics.db.WriteGraph; import org.simantics.db.common.request.UniqueRead; import org.simantics.db.common.request.WriteRequest; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.db.procedure.Listener; import org.simantics.db.request.Read; import org.simantics.modeling.ComponentTypeScriptRequest; @@ -60,9 +61,10 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide StructuralResource2 STR = StructuralResource2.getInstance(graph); currentText = graph.getRelatedValue(resource, STR.ComponentTypeScript_code, Bindings.STRING); Resource owner = graph.getPossibleObject(resource, STR.ComponentType_hasScript_Inverse); - immutable = owner != null && StructuralUtils.isImmutable(graph, owner); + immutable = Layer0Utils.isMarkedReadOnly(graph, resource) + || owner != null && StructuralUtils.isImmutable(graph, owner); errorHappened = false; - return new Document(currentText != null ? currentText : ""); + return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$ } }); } catch (DatabaseException e) { @@ -91,7 +93,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide synchronized(annotationModel.getLockObject()) { annotationModel.removeAllAnnotations(); for(CompilationError error : result.getErrors()) { - Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, error.description); + Annotation annotation = new Annotation("org.eclipse.ui.workbench.texteditor.error", true, error.description); //$NON-NLS-1$ int begin = Locations.beginOf(error.location); int end = Locations.endOf(error.location); Position position = new Position(begin, end - begin); @@ -115,7 +117,7 @@ public class ComponentTypeScriptDocumentProvider extends AbstractDocumentProvide @Override protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException { - TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); + TimeLogger.resetTimeAndLog(getClass(), "doSaveDocument"); //$NON-NLS-1$ currentText = document.get(); Simantics.getSession().asyncRequest(new WriteRequest() { @Override