]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7219) Remove deprecated code (scl.compiler.dummy and editor) 18/518/2
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 12 May 2017 21:12:51 +0000 (00:12 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Sat, 13 May 2017 04:58:00 +0000 (07:58 +0300)
Change-Id: Ibd2bc7b4ca78637460701351b7511dc77ba6ef2f

30 files changed:
bundles/org.simantics.browsing.ui.swt/META-INF/MANIFEST.MF
bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/SCLEditor.java [deleted file]
bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/SCLEditorComposite.java
bundles/org.simantics.modeling.ui/META-INF/MANIFEST.MF
bundles/org.simantics.scl.compiler.dummy/.classpath [deleted file]
bundles/org.simantics.scl.compiler.dummy/.project [deleted file]
bundles/org.simantics.scl.compiler.dummy/.settings/org.eclipse.jdt.core.prefs [deleted file]
bundles/org.simantics.scl.compiler.dummy/META-INF/MANIFEST.MF [deleted file]
bundles/org.simantics.scl.compiler.dummy/build.properties [deleted file]
bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/ErrorMessage.java [deleted file]
bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/InvalidInputException.java [deleted file]
bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/SCLCompiler.java [deleted file]
bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/SCLCompilerConfiguration.java [deleted file]
bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/StandardSCLCompilerConfiguration.java [deleted file]
bundles/org.simantics.scl.ui.editor/.classpath [deleted file]
bundles/org.simantics.scl.ui.editor/.gitignore [deleted file]
bundles/org.simantics.scl.ui.editor/.project [deleted file]
bundles/org.simantics.scl.ui.editor/.settings/org.eclipse.jdt.core.prefs [deleted file]
bundles/org.simantics.scl.ui.editor/META-INF/MANIFEST.MF [deleted file]
bundles/org.simantics.scl.ui.editor/build.properties [deleted file]
bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLAnnotationAccess.java [deleted file]
bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLSourceViewerConfiguration.java [deleted file]
bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLTextEditor.java [deleted file]
bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SharedTextColors.java [deleted file]
bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/TestTextEditor.java [deleted file]
bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/error_tsk.gif [deleted file]
bundles/org.simantics.spreadsheet.graph/META-INF/MANIFEST.MF
bundles/pom.xml
features/org.simantics.browsing.ui.feature/feature.xml
features/org.simantics.scl.feature/feature.xml

index 37466aedaec815dd3ae618a0c57592d90bfedc92..4eaa04be30a13ee80dc906ee7c41200992243257 100644 (file)
@@ -14,8 +14,6 @@ Require-Bundle: org.simantics.utils.thread.swt;bundle-version="1.0.0",
  org.simantics.g2d;bundle-version="[1.0.0,2.0.0)",
  org.eclipse.ui.forms;bundle-version="3.4.1",
  com.lowagie.text;bundle-version="2.1.5",
- org.simantics.scl.ui.editor;bundle-version="0.1.3";visibility:=reexport,
- org.simantics.scl.compiler.dummy;bundle-version="0.1.3",
  org.eclipse.e4.core.contexts;bundle-version="1.4.0",
  org.slf4j.api;bundle-version="1.7.20"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/SCLEditor.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/widgets/SCLEditor.java
deleted file mode 100644 (file)
index 109d840..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2012 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *     VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.browsing.ui.swt.widgets;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.simantics.browsing.ui.swt.widgets.impl.ReadFactory;
-import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
-import org.simantics.db.management.ISessionContext;
-import org.simantics.db.procedure.Listener;
-import org.simantics.scl.compiler.StandardSCLCompilerConfiguration;
-import org.simantics.scl.ui.editor.SCLTextEditor;
-import org.simantics.utils.ui.SWTUtils;
-
-public class SCLEditor extends WidgetImpl {
-
-       private ReadFactory<?, String> textFactory;
-       
-       final private SCLTextEditor editor;
-       
-       public SCLEditor(Composite parent, WidgetSupport support, int style) {
-               super(support);
-               editor = new SCLTextEditor(parent, style, StandardSCLCompilerConfiguration.INSTANCE);
-               support.register(this);
-       }
-       
-       public void setTextFactory(ReadFactory<?, String> textFactory) {
-               this.textFactory = textFactory;
-       }
-       
-       public SCLTextEditor getWidget() {
-               return editor;
-       }
-       
-       @Override
-       public Control getControl() {
-               return editor;
-       }
-
-       @Override
-       public void setInput(ISessionContext context, Object input) {
-
-               if(textFactory != null) {
-                       textFactory.listen(context, input, new Listener<String>() {
-
-                               public void exception(final Throwable t) {
-                                       SWTUtils.asyncExec(editor, new Runnable() {
-
-                                               @Override
-                                               public void run() {
-                                                       if(isDisposed()) return;
-//                                                     System.out.println("Button received new text: " + text);
-                                                       editor.setContent(t.toString());
-                                               }
-
-                                       });
-                               }
-
-                               @Override
-                               public void execute(final String s) {
-                                       SWTUtils.asyncExec(editor, new Runnable() {
-
-                                               @Override
-                                               public void run() {
-                                                       if(isDisposed()) return;
-                                                       editor.setContent(s);
-                                               }
-
-                                       });
-                               }
-
-                               @Override
-                               public boolean isDisposed() {
-                                       return editor.isDisposed();
-                               }
-
-                       });
-               
-               }
-               
-       }
-       
-       public void setContent(String s) {
-               editor.setContent(s);
-       }
-       
-       public String getContent() {
-               return editor.getContent();
-       }
-
-}
index c73efe63f1b3df5a549bd5f6ab183d922db24b81..391648b62117b6c9b0add1664def09f31355fc37 100644 (file)
@@ -18,8 +18,8 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IWorkbenchSite;
 import org.simantics.browsing.ui.swt.widgets.Button;
-import org.simantics.browsing.ui.swt.widgets.SCLEditor;
 import org.simantics.browsing.ui.swt.widgets.StringPropertyFactory;
+import org.simantics.browsing.ui.swt.widgets.Text;
 import org.simantics.browsing.ui.swt.widgets.impl.SelectionListenerImpl;
 import org.simantics.browsing.ui.swt.widgets.impl.WidgetSupport;
 import org.simantics.db.Resource;
@@ -32,7 +32,7 @@ import org.simantics.selectionview.ConfigurationComposite;
 
 public class SCLEditorComposite extends ConfigurationComposite {
     
-       private SCLEditor editor;
+       private Text editor;
        
     public void create(Composite body, IWorkbenchSite site, ISessionContext context, final WidgetSupport support) {
         
@@ -47,10 +47,10 @@ public class SCLEditorComposite extends ConfigurationComposite {
                
                @Override
                public void beforeApply() {
-                       content = editor.getContent();
-                       editor.getWidget().storeSelectedRange();
+                       content = editor.getWidget().getText();
+                       //editor.getWidget().storeSelectedRange();
                        editor.getControl().setFocus();
-                       editor.getWidget().restoreSelectedRange();
+                       //editor.getWidget().restoreSelectedRange();
                }
                
                        @Override
@@ -61,7 +61,7 @@ public class SCLEditorComposite extends ConfigurationComposite {
                        
                });
        
-       editor = new SCLEditor(body, support, SWT.BORDER | SWT.FLAT);
+       editor = new Text(body, support, SWT.BORDER | SWT.FLAT);
        editor.setTextFactory(new StringPropertyFactory(Layer0X.URIs.HasExpression));
        //editor.addModifyListener(new StringPropertyModifier(context, Layer0.URIs.HasExpression));
        GridDataFactory.fillDefaults().grab(true, true).span(2, 1).applyTo(editor.getControl());
index 525c8da5244abc27f19951b450c52d5136266dc0..a426ba5c9b0c0bbc61df9c9419238d68712df11f 100644 (file)
@@ -35,7 +35,6 @@ Require-Bundle: org.simantics.project;bundle-version="1.0.0",
  org.bouncycastle.bcprov-jdk14;bundle-version="1.38.0",
  org.simantics.image2.ontology;bundle-version="1.1.0",
  org.simantics.scl.compiler;bundle-version="0.4.0",
- org.simantics.scl.compiler.dummy;bundle-version="1.0.0",
  org.simantics.scl.osgi;bundle-version="1.0.4",
  org.eclipse.jface.text;bundle-version="3.7.1",
  org.simantics.graphviz,
diff --git a/bundles/org.simantics.scl.compiler.dummy/.classpath b/bundles/org.simantics.scl.compiler.dummy/.classpath
deleted file mode 100644 (file)
index eca7bdb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.simantics.scl.compiler.dummy/.project b/bundles/org.simantics.scl.compiler.dummy/.project
deleted file mode 100644 (file)
index 62879b7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.simantics.scl.compiler.dummy</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.ManifestBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.SchemaBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.pde.PluginNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/bundles/org.simantics.scl.compiler.dummy/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.compiler.dummy/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 0c68a61..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bundles/org.simantics.scl.compiler.dummy/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.compiler.dummy/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index da14e13..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Dummy SCL compiler
-Bundle-SymbolicName: org.simantics.scl.compiler.dummy
-Bundle-Version: 1.0.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.simantics.scl.compiler
-Require-Bundle: org.simantics.scl.runtime;bundle-version="0.2.0"
diff --git a/bundles/org.simantics.scl.compiler.dummy/build.properties b/bundles/org.simantics.scl.compiler.dummy/build.properties
deleted file mode 100644 (file)
index 34d2e4d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .
diff --git a/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/ErrorMessage.java b/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/ErrorMessage.java
deleted file mode 100644 (file)
index 958fd12..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.simantics.scl.compiler;
-
-public class ErrorMessage {
-    int line;
-    int start;
-    int stop;
-    String message;
-    
-    public ErrorMessage(int line, int start, int stop, String message) {
-        this.line = line;
-        this.start = start;
-        this.stop = stop;
-        this.message = message;
-    }
-    
-    public int getLine() {
-        return line;
-    }
-    
-    public int getStart() {
-        return start;
-    }
-    
-    public int getStop() {
-        return stop;
-    }
-    
-    public String getMessage() {
-        return message;
-    }
-    
-    @Override
-    public String toString() {
-        return "at " + line + ":" + start + "-" + stop + " " + message;
-    }
-}
diff --git a/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/InvalidInputException.java b/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/InvalidInputException.java
deleted file mode 100644 (file)
index 7a61c27..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.simantics.scl.compiler;
-
-import java.util.Collection;
-
-public class InvalidInputException extends Exception {
-
-    private static final long serialVersionUID = 2923907879583127677L;
-    
-    Collection<ErrorMessage> errors;
-
-    public InvalidInputException(Collection<ErrorMessage> errors) {
-        this.errors = errors;
-    }
-    
-    public Collection<ErrorMessage> getErrors() {
-        return errors;
-    }
-
-}
diff --git a/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/SCLCompiler.java b/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/SCLCompiler.java
deleted file mode 100644 (file)
index b552c70..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.simantics.scl.compiler;
-
-import java.io.InputStream;
-import java.util.Collections;
-
-import org.simantics.scl.runtime.Computation;
-
-public class SCLCompiler {
-    
-    public SCLCompiler(SCLCompilerConfiguration configuration) {
-    }
-    
-    public static Computation compileExpression(SCLCompilerConfiguration configuration, InputStream code) throws InvalidInputException {
-       throw new InvalidInputException(Collections.singleton(new ErrorMessage(0, 0, 0, "No SCL compiler")));
-    }
-    
-    public static Computation compileExpression(SCLCompilerConfiguration configuration, String code) throws InvalidInputException {
-       throw new InvalidInputException(Collections.singleton(new ErrorMessage(0, 0, 0, "No SCL compiler")));
-    }
-    
-}
diff --git a/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/SCLCompilerConfiguration.java b/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/SCLCompilerConfiguration.java
deleted file mode 100644 (file)
index de0461f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.simantics.scl.compiler;
-
-
-public interface SCLCompilerConfiguration {
-}
diff --git a/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/StandardSCLCompilerConfiguration.java b/bundles/org.simantics.scl.compiler.dummy/src/org/simantics/scl/compiler/StandardSCLCompilerConfiguration.java
deleted file mode 100644 (file)
index e86be85..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-package org.simantics.scl.compiler;
-
-
-public class StandardSCLCompilerConfiguration implements SCLCompilerConfiguration {
-
-    public static final SCLCompilerConfiguration INSTANCE = new StandardSCLCompilerConfiguration();
-
-}
diff --git a/bundles/org.simantics.scl.ui.editor/.classpath b/bundles/org.simantics.scl.ui.editor/.classpath
deleted file mode 100644 (file)
index eca7bdb..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.simantics.scl.ui.editor/.gitignore b/bundles/org.simantics.scl.ui.editor/.gitignore
deleted file mode 100644 (file)
index c5e82d7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/bundles/org.simantics.scl.ui.editor/.project b/bundles/org.simantics.scl.ui.editor/.project
deleted file mode 100644 (file)
index aef84f5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>org.simantics.scl.ui.editor</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-               <buildCommand>
-                       <name>org.eclipse.jdt.core.javabuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.ManifestBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-               <buildCommand>
-                       <name>org.eclipse.pde.SchemaBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
-       </buildSpec>
-       <natures>
-               <nature>org.eclipse.pde.PluginNature</nature>
-               <nature>org.eclipse.jdt.core.javanature</nature>
-       </natures>
-</projectDescription>
diff --git a/bundles/org.simantics.scl.ui.editor/.settings/org.eclipse.jdt.core.prefs b/bundles/org.simantics.scl.ui.editor/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644 (file)
index 0c68a61..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
diff --git a/bundles/org.simantics.scl.ui.editor/META-INF/MANIFEST.MF b/bundles/org.simantics.scl.ui.editor/META-INF/MANIFEST.MF
deleted file mode 100644 (file)
index 6dc71a6..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: SCL Workbench Editor
-Bundle-SymbolicName: org.simantics.scl.ui.editor
-Bundle-Version: 0.1.3
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Require-Bundle: org.eclipse.swt;bundle-version="3.104.0",
- gnu.trove3;bundle-version="3.0.3",
- org.simantics.scl.compiler.dummy;bundle-version="0.0.9",
- org.simantics.scl.runtime;bundle-version="0.0.9",
- org.eclipse.jface;bundle-version="3.11.0",
- org.eclipse.jface.text;bundle-version="3.6.0",
- org.eclipse.core.runtime;bundle-version="3.11.0",
- org.eclipse.ui.workbench.texteditor;bundle-version="3.6.0",
- org.eclipse.ui.editors;bundle-version="3.6.0"
-Export-Package: org.simantics.scl.ui.editor
-Bundle-Vendor: VTT Technical Research Centre of Finland
diff --git a/bundles/org.simantics.scl.ui.editor/build.properties b/bundles/org.simantics.scl.ui.editor/build.properties
deleted file mode 100644 (file)
index 34d2e4d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
-               .
diff --git a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLAnnotationAccess.java b/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLAnnotationAccess.java
deleted file mode 100644 (file)
index 5a300fb..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.simantics.scl.ui.editor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.IAnnotationAccess;
-import org.eclipse.jface.text.source.IAnnotationAccessExtension;
-import org.eclipse.jface.text.source.ImageUtilities;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-
-final class SCLAnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension {
-
-    ImageRegistry registry;
-    
-    public SCLAnnotationAccess(ImageRegistry registry) {
-        this.registry = registry;
-    }
-
-    @Override
-    public Object getType(Annotation annotation) {
-        return annotation.getType();
-    }
-
-    @Override
-    public boolean isMultiLine(Annotation annotation) {
-        return true;
-    }
-
-    @Override
-    public boolean isTemporary(Annotation annotation) {
-        return !annotation.isPersistent();
-    }
-
-    @Override
-    public String getTypeLabel(Annotation annotation) {
-        return annotation.getType();
-    }
-
-    @Override
-    public int getLayer(Annotation annotation) {
-        return 0;
-    }
-
-    @Override
-    public void paint(Annotation annotation, GC gc, Canvas canvas, Rectangle bounds) {
-        Image image = registry.get("error");
-        if(image == null) {
-            registry.put("error", ImageDescriptor.createFromFile(getClass(), "error_tsk.gif"));
-            image = registry.get("error");
-        }
-        ImageUtilities.drawImage(image, gc, canvas, bounds, SWT.CENTER, SWT.TOP);
-    }
-
-    @Override
-    public boolean isPaintable(Annotation annotation) {
-        return true;
-    }
-
-    @Override
-    public boolean isSubtype(Object annotationType, Object potentialSupertype) {
-        return annotationType.equals(potentialSupertype);
-    }
-
-    @Override
-    public Object[] getSupertypes(Object annotationType) {
-        return new Object[0];
-    }
-}
\ No newline at end of file
diff --git a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLSourceViewerConfiguration.java b/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLSourceViewerConfiguration.java
deleted file mode 100644 (file)
index 0ceb9f6..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-package org.simantics.scl.ui.editor;
-
-import org.eclipse.jface.text.DefaultTextHover;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextHover;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.presentation.IPresentationReconciler;
-import org.eclipse.jface.text.presentation.PresentationReconciler;
-import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
-import org.eclipse.jface.text.rules.IRule;
-import org.eclipse.jface.text.rules.ITokenScanner;
-import org.eclipse.jface.text.rules.IWordDetector;
-import org.eclipse.jface.text.rules.MultiLineRule;
-import org.eclipse.jface.text.rules.PatternRule;
-import org.eclipse.jface.text.rules.RuleBasedScanner;
-import org.eclipse.jface.text.rules.Token;
-import org.eclipse.jface.text.rules.WordRule;
-import org.eclipse.jface.text.source.DefaultAnnotationHover;
-import org.eclipse.jface.text.source.IAnnotationHover;
-import org.eclipse.jface.text.source.ISharedTextColors;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Device;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.RGB;
-
-public class SCLSourceViewerConfiguration extends SourceViewerConfiguration {
-
-    public static final char[] CONTENT_ASSIST_AUTO_CHARS = new char[] { '.' };
-    Device device;
-    
-    ISharedTextColors sharedTextColors;
-    
-    public SCLSourceViewerConfiguration(Device device,
-            ISharedTextColors sharedTextColors) {
-        this.device = device;
-        this.sharedTextColors = sharedTextColors;
-    }
-
-    public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
-        return new String[] {
-            IDocument.DEFAULT_CONTENT_TYPE
-        };
-    }
-    
-    public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
-        PresentationReconciler reconciler = new PresentationReconciler();
-        
-        DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getSclTokenScanner());
-        
-        reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
-        reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
-        
-        return reconciler;
-    }
-    
-    ITokenScanner getSclTokenScanner() {
-        RuleBasedScanner scanner = new RuleBasedScanner();
-        
-        Font font = new Font(device, "Courier New", 10, SWT.NORMAL);
-        Font boldFont = new Font(device, "Courier New", 10, SWT.BOLD);
-
-        Token defaultToken = new Token(
-                new TextAttribute(
-                        sharedTextColors.getColor(new RGB(0, 0, 0)),
-                        null,
-                        0,
-                        font
-                ));
-        Token string = new Token(new TextAttribute(
-                sharedTextColors.getColor(new RGB(42, 0, 255)),
-                null,
-                0,
-                font
-                ));
-        Token reserved = new Token(
-                new TextAttribute(
-                        sharedTextColors.getColor(new RGB(127, 0, 85)),
-                        null,
-                        SWT.BOLD,
-                        boldFont
-                ));
-        Token comment = new Token(new TextAttribute(
-                sharedTextColors.getColor(new RGB(63, 127, 95)),
-                null,
-                0,
-                font
-                ));
-
-        WordRule reservedWord = new WordRule(new IWordDetector() {          
-            @Override
-            public boolean isWordStart(char c) {
-                return Character.isJavaIdentifierStart(c);
-            }
-            
-            @Override
-            public boolean isWordPart(char c) {
-                return Character.isJavaIdentifierPart(c) || c=='.';
-            }
-        });
-
-        reservedWord.addWord("if", reserved);
-        reservedWord.addWord("then", reserved);
-        reservedWord.addWord("else", reserved);
-        reservedWord.addWord("match", reserved);
-        reservedWord.addWord("with", reserved);
-        reservedWord.addWord("data", reserved);
-        reservedWord.addWord("type", reserved);
-        reservedWord.addWord("class", reserved);
-        
-        IRule[] rules = new IRule[] {
-            //new MultiLineRule("\"\"\"", "\"\"\"", string),
-            new PatternRule("\"", "\"", string, '\\', true),
-            new MultiLineRule("/*", "*/", comment),
-            new PatternRule("//", null, comment, '\0', true),
-            reservedWord
-        };
-        scanner.setRules(rules);
-        scanner.setDefaultReturnToken(defaultToken);
-        
-        return scanner;     
-    }
-    
-    @Override
-    public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
-        return new DefaultTextHover(sourceViewer);
-    }
-    
-    @Override
-    public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
-        return new DefaultAnnotationHover();
-    }
-}
diff --git a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLTextEditor.java b/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLTextEditor.java
deleted file mode 100644 (file)
index ee081ff..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-package org.simantics.scl.ui.editor;
-
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.ITextListener;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextEvent;
-import org.eclipse.jface.text.source.Annotation;
-import org.eclipse.jface.text.source.AnnotationModel;
-import org.eclipse.jface.text.source.AnnotationPainter;
-import org.eclipse.jface.text.source.IAnnotationModel;
-import org.eclipse.jface.text.source.ISharedTextColors;
-import org.eclipse.jface.text.source.OverviewRuler;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.VerticalRuler;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.simantics.scl.compiler.ErrorMessage;
-import org.simantics.scl.compiler.InvalidInputException;
-import org.simantics.scl.compiler.SCLCompiler;
-import org.simantics.scl.compiler.SCLCompilerConfiguration;
-
-public class SCLTextEditor extends Composite {
-
-    private static final int DELAY_BEFORE_COMPILATION = 500 /*ms*/;
-    
-    SCLCompilerConfiguration configuration;
-    
-    SourceViewer viewer;
-    ImageRegistry imageRegistry;
-    SCLAnnotationAccess annotationAccess;
-    ISharedTextColors sharedTextColors;
-    IAnnotationModel annotationModel;    
-    
-    public SCLTextEditor(Composite parent, int style, SCLCompilerConfiguration configuration) {
-        super(parent, style);
-        setLayout(new FillLayout());
-        
-        this.configuration = configuration;
-        
-        imageRegistry = new ImageRegistry(parent.getDisplay());
-        annotationAccess = new SCLAnnotationAccess(imageRegistry);
-        sharedTextColors = new SharedTextColors(getDisplay());
-        annotationModel = new AnnotationModel();
-        
-        VerticalRuler leftRuler = new VerticalRuler(12, annotationAccess);
-        leftRuler.setModel(annotationModel);
-        
-        OverviewRuler rightRuler = 
-            new OverviewRuler(annotationAccess, 12, sharedTextColors);
-        rightRuler.setModel(annotationModel);
-        rightRuler.addAnnotationType("error");
-        rightRuler.setAnnotationTypeLayer("error", 0);
-        rightRuler.setAnnotationTypeColor("error", sharedTextColors.getColor(new RGB(255,0,128)));
-        
-        viewer = new SourceViewer(this, 
-                leftRuler, rightRuler,
-                true,
-                SWT.H_SCROLL | SWT.V_SCROLL);
-        Document document = new Document();
-        viewer.setDocument(document, annotationModel);
-        viewer.setEditable(true);
-        viewer.configure(new SCLSourceViewerConfiguration(
-                getDisplay(), sharedTextColors));
-        
-        // Annotations to text area
-        AnnotationPainter annotationPainter = 
-            new AnnotationPainter(viewer, annotationAccess);
-        annotationPainter.addAnnotationType("error");
-        annotationPainter.setAnnotationTypeColor("error", sharedTextColors.getColor(new RGB(255,0,128)));
-        viewer.addPainter(annotationPainter);
-        annotationModel.addAnnotationModelListener(annotationPainter);
-        
-        // Undo support (maybe not needed in workbench?)
-        viewer.getTextWidget().addKeyListener(new KeyAdapter() {
-            @Override
-            public void keyReleased(KeyEvent e) {
-            }
-            @Override
-            public void keyPressed(KeyEvent e) {
-                if(e.keyCode=='z'&& e.stateMask == SWT.CTRL) {
-                    viewer.getUndoManager().undo();
-                }
-                else if(e.keyCode=='y'&& e.stateMask == SWT.CTRL) {
-                    viewer.getUndoManager().redo();
-                }
-            }
-        });        
-        
-        // Automatic compilation when text changes
-        viewer.addTextListener(new ITextListener() {            
-            @Override
-            public void textChanged(TextEvent event) {
-                scheduleCompilation();                
-            }
-        });
-    }
-    
-    @Override
-    public void dispose() {
-        super.dispose();
-        sharedTextColors.dispose();
-    }    
-    
-    @SuppressWarnings("unchecked")
-    private void removeAnnotations() {
-        Iterator<Annotation> it = annotationModel.getAnnotationIterator();
-        while(it.hasNext()) {
-            Annotation annotation = it.next();
-            annotationModel.removeAnnotation(annotation);
-        }
-    }
-    
-    private void setAnnotations(Collection<ErrorMessage> messages) {
-        removeAnnotations();
-        for(ErrorMessage message : messages) {
-            annotationModel.addAnnotation(
-                    new Annotation("error", true, message.getMessage()), 
-                    new Position(message.getStart(), message.getStop()-message.getStart()+1));   
-        }
-    }
-    
-    /**
-     * Tries to compile current 
-     */
-    private void compileSync(String code) {
-        try {            
-            SCLCompiler.compileExpression(configuration, code);
-            getDisplay().asyncExec(new Runnable() {
-                @Override
-                public void run() {
-                    removeAnnotations();                    
-                }
-            });            
-        } catch (final InvalidInputException e) {
-            getDisplay().asyncExec(new Runnable() {
-                @Override
-                public void run() {
-                    setAnnotations(e.getErrors());                    
-                }
-            });            
-        } catch(Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    Object compilationLock = new Object();
-    String codeToBeCompiled;
-    
-    private synchronized void scheduleCompilation() {
-        synchronized(compilationLock) {
-            if(codeToBeCompiled == null) {
-                new Thread("SCLTextEditor compilation") {
-                    public void run() {                        
-                        while(true) {     
-                            String code;
-                            // Waits until code has remained unmodified for
-                            // time specified by DELAY_BEFORE_COMPILATION. 
-                            synchronized(compilationLock) {
-                                do {
-                                    code = codeToBeCompiled;  
-                                    try {
-                                        compilationLock.wait(DELAY_BEFORE_COMPILATION);
-                                    } catch (InterruptedException e) {
-                                    }
-                                } while(!code.equals(codeToBeCompiled));
-                            }
-                            
-                            // Does the actual compilation and updates
-                            // annotations.
-                            compileSync(code);
-                            
-                            // If code was not modified during compilation,
-                            // exits the compilation thread and sets
-                            // codeToBeCompiled null to signal inactivity.
-                            synchronized(compilationLock) {
-                                if(code.equals(codeToBeCompiled)) {
-                                    codeToBeCompiled = null;
-                                    return;
-                                }
-                            }
-                        }                        
-                    }
-                }.start();            
-            }
-            codeToBeCompiled = viewer.getDocument().get();
-            compilationLock.notify();
-        }
-    }
-    
-    public String getContent() {
-        final String[] result = new String[1];
-        getDisplay().syncExec(new Runnable() {
-            @Override
-            public void run() {
-                result[0] = viewer.getDocument().get();
-            }
-        });
-        return result[0];
-    }
-    
-    public void setContent(final String content) {
-        getDisplay().asyncExec(new Runnable() {
-            @Override
-            public void run() {
-                if (viewer.getTextWidget().isDisposed()) return;
-                viewer.getDocument().set(content);
-            }
-        });
-    }
-
-    private Point storedSelectedRange;
-
-    public void storeSelectedRange() {
-        storedSelectedRange = viewer.getSelectedRange();
-    }
-
-    public void restoreSelectedRange() {
-        if (storedSelectedRange != null) {
-            viewer.setSelectedRange(storedSelectedRange.x, storedSelectedRange.y);
-            storedSelectedRange = null;
-        }
-    }
-
-}
diff --git a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SharedTextColors.java b/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SharedTextColors.java
deleted file mode 100644 (file)
index f5c71dc..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.simantics.scl.ui.editor;
-
-import gnu.trove.map.hash.THashMap;
-
-import org.eclipse.jface.text.source.ISharedTextColors;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-final class SharedTextColors implements ISharedTextColors {
-
-    Display display;
-    THashMap<RGB,Color> map = new THashMap<RGB,Color>();
-    
-    public SharedTextColors(Display display) {
-        this.display = display;
-    }
-
-    @Override
-    public Color getColor(RGB rgb) {
-        Color color = map.get(rgb);
-        if(color == null) {
-            color = new Color(display, rgb);
-            map.put(rgb, color);
-        }
-        return color;
-    }
-
-    @Override
-    public void dispose() {
-        for(Color color : map.values())
-            color.dispose();
-        map.clear();
-    }
-}
\ No newline at end of file
diff --git a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/TestTextEditor.java b/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/TestTextEditor.java
deleted file mode 100644 (file)
index 7f29fbb..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.simantics.scl.ui.editor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.simantics.scl.compiler.SCLCompiler;
-import org.simantics.scl.compiler.StandardSCLCompilerConfiguration;
-
-public class TestTextEditor {
-
-    public static void main(String[] args) {
-        Display display = new Display();
-        final Shell shell = new Shell(display);
-        shell.setText("SCL text widget example");
-        shell.setLayout(new FillLayout());
-        
-        SashForm sashForm = new SashForm(shell, SWT.VERTICAL);        
-        
-        final SCLTextEditor editor = new SCLTextEditor(sashForm, 0, StandardSCLCompilerConfiguration.INSTANCE);
-        editor.setContent(
-             "// Difficulty: 0\n" +
-             "// Expected: [2.0, 3.0, 5.0, 7.0, 11.0, 13.0, 17.0, 19.0]\n\n" +
-             "// and : [Boolean] -> Boolean\n" +
-             "and = fold (&&) True\n\n" +
-             "// isPrime : Integer -> Boolean\n" +
-             "isPrime p = and (\n" +
-             "    d <- [2 .. sqrt p]\n" +
-             "    [p % d > 0]\n" +
-             ")\n\n" +
-             "x <- [2 .. 20]\n" +
-             "isPrime x\n" +
-             "[x]"
-          );
-        
-        final Text resultArea = new Text(sashForm, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
-        resultArea.setText("Ctrl-S executes the code.");
-        resultArea.setEditable(false);
-        resultArea.setBackground(new Color(shell.getDisplay(), 255, 255, 255));
-        resultArea.setFont(new Font(shell.getDisplay(), "Courier New", 10, SWT.NORMAL));
-        
-        sashForm.setWeights(new int[] {5, 1});
-        
-        display.addFilter(SWT.KeyDown, new Listener() {
-            @Override
-            public void handleEvent(Event event) {
-                if(event.keyCode == 's' && event.stateMask == SWT.CTRL) {
-                    final String code = editor.getContent();
-                    new Thread() {
-                        public void run() {
-                            try {
-                                final String result = SCLCompiler.compileExpression(StandardSCLCompilerConfiguration.INSTANCE, code).execute().toString();
-                                shell.getDisplay().asyncExec(new Runnable() {
-                                    public void run() {
-                                        resultArea.setText(result);    
-                                    }                                                
-                                });
-                            } catch (Exception e) {
-                            }
-                        }
-                    }.start();
-                    event.doit = false;
-                }
-            }
-        });
-        shell.addKeyListener(new KeyAdapter() {
-            @Override
-            public void keyPressed(KeyEvent e) {
-                System.out.println(e);
-            }
-        });
-        
-        shell.open();
-        while (!shell.isDisposed ()) {
-            if (!display.readAndDispatch ()) display.sleep ();
-        }
-        display.dispose ();
-    }
-    
-}
diff --git a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/error_tsk.gif b/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/error_tsk.gif
deleted file mode 100644 (file)
index 9b048d6..0000000
Binary files a/bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/error_tsk.gif and /dev/null differ
index 08fdd9180b498205454594de8b8a619b90322ce5..8ecef199d819ff57e72b3dabf1079e6acdbb7612 100644 (file)
@@ -11,7 +11,6 @@ Require-Bundle: org.simantics.layer0.utils,
  org.simantics.diagram.ontology;bundle-version="1.0.0",
  org.simantics.structural.ontology;bundle-version="1.0.0",
  org.simantics.basicexpression;bundle-version="1.0.0",
- org.simantics.scl.compiler.dummy;bundle-version="0.1.2",
  org.simantics.db.layer0;bundle-version="1.1.0",
  org.simantics.scl.db;bundle-version="0.1.2",
  org.simantics.scl.runtime;bundle-version="0.1.2",
index beafd6ec71f61ea68e172b949025d296be6cb474..bc89d553cc37edc4e20dab908884eec8c43d03b2 100644 (file)
                <module>org.simantics.scenegraph.ui</module>
                <module>org.simantics.scl.commands</module>
                <module>org.simantics.scl.compiler</module>
-               <module>org.simantics.scl.compiler.dummy</module>
                <module>org.simantics.scl.data</module>
                <module>org.simantics.scl.db</module>
                <module>org.simantics.scl.expressions</module>
                <module>org.simantics.scl.reflection</module>
                <module>org.simantics.scl.runtime</module>
                <module>org.simantics.scl.ui</module>
-               <module>org.simantics.scl.ui.editor</module>
                <module>org.simantics.selectionview</module>
                <module>org.simantics.selectionview.ontology</module>
                <module>org.simantics.selectionview.ui.ontology</module>
index 39291c7d6a2ee2361412190f8a988d7524b201b8..bedbde323266e2b4af27c608f0e260bab47f0871 100644 (file)
@@ -160,11 +160,4 @@ This Agreement is governed by the laws of the State of New York and the intellec
          version="0.0.0"
          unpack="false"/>
 
-   <plugin
-         id="org.simantics.scl.ui.editor"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
 </feature>
index 1ddb061405163c96262a047cefb98a335290adce..5c8f6fd1d9d236980f96d055fb245ae923a56d7c 100644 (file)
@@ -143,20 +143,6 @@ This Agreement is governed by the laws of the State of New York and the intellec
          version="0.0.0"
          unpack="false"/>
 
-   <plugin
-         id="org.simantics.scl.compiler.dummy"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
-   <plugin
-         id="org.simantics.scl.ui.editor"
-         download-size="0"
-         install-size="0"
-         version="0.0.0"
-         unpack="false"/>
-
    <plugin
          id="org.simantics.scl.db"
          download-size="0"