]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ProceduralComponentTypeCodeDocumentProvider.java
UC SCL script/procedural code editors respect L0.readOnly
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / ProceduralComponentTypeCodeDocumentProvider.java
index 25663edf2878f9592d27424a82aef397fdd058e6..5cc209943b920d58bbb2a037efbe71b807bdd112 100644 (file)
@@ -31,6 +31,7 @@ import org.simantics.scl.ui.editor.SCLSourceViewerConfigurationNew;
 import org.simantics.scl.ui.editor.TextAndErrors;
 import org.simantics.structural2.scl.procedural.CompileProceduralComponentTypeRequest;
 import org.simantics.structural2.scl.procedural.ProceduralComponentTypeCompilationException;
+import org.simantics.structural2.utils.StructuralUtils;
 import org.simantics.ui.workbench.ResourceEditorInput;
 import org.simantics.utils.logging.TimeLogger;
 import org.simantics.utils.ui.SWTUtils;
@@ -55,8 +56,9 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor
                 @Override
                 public Document perform(ReadGraph graph) throws DatabaseException {
                     currentText = graph.getValue(resource, Bindings.STRING);
+                    immutable = StructuralUtils.isImmutable(graph, resource);
                     errorHappened = false;
-                    return new Document(currentText != null ? currentText : "");
+                    return new Document(currentText != null ? currentText : ""); //$NON-NLS-1$
                 }
             });
         } catch (DatabaseException e) {
@@ -111,7 +113,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor
             @Override
             public void exception(Throwable t) {
                 Activator.getDefault().getLog().log(
-                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Internal error in procedural user component code compilation.", t));
+                        new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.ProceduralComponentTypeCodeDocumentProvider_ActivatorInternalErrorMsg, t));
             }
 
             @Override
@@ -124,7 +126,7 @@ public class ProceduralComponentTypeCodeDocumentProvider extends SCLModuleEditor
     @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