]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.ui.editor/src/org/simantics/scl/ui/editor/SCLSourceViewerConfiguration.java
(refs #7219) Remove deprecated code (scl.compiler.dummy and editor)
[simantics/platform.git] / bundles / org.simantics.scl.ui.editor / src / org / simantics / scl / ui / editor / SCLSourceViewerConfiguration.java
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();
-    }
-}