Revision: 4817
          http://sourceforge.net/p/vexi/code/4817
Author:   mkpg2
Date:     2015-10-26 22:19:54 +0000 (Mon, 26 Oct 2015)
Log Message:
-----------
Support for multi line strings.
Separate .script editor.
Update vexi.

Modified Paths:
--------------
    trunk/tools/org.vexi.vexidev/.classpath
    trunk/tools/org.vexi.vexidev/.settings/org.eclipse.jdt.core.prefs
    trunk/tools/org.vexi.vexidev/META-INF/MANIFEST.MF
    trunk/tools/org.vexi.vexidev/build.properties
    trunk/tools/org.vexi.vexidev/plugin.xml
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/ConsoleLineTracker.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/TemplateFilePartitionScanner.java
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VSScanner.java
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditorConfiguration.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/IndentActionDelegate.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/ToggleCommentActionDelegate.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/outline/VexiOutlinePage.java

Added Paths:
-----------
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/AbstractVexiEditor.java
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditor.java
    
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditorConfiguration.java

Property Changed:
----------------
    trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java

Modified: trunk/tools/org.vexi.vexidev/.classpath
===================================================================
--- trunk/tools/org.vexi.vexidev/.classpath     2015-10-06 21:51:22 UTC (rev 
4816)
+++ trunk/tools/org.vexi.vexidev/.classpath     2015-10-26 22:19:54 UTC (rev 
4817)
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-       <classpathentry kind="src" path="src"/>
-       <classpathentry kind="src" path="src_junit"/>
-       <classpathentry kind="src" path="src_dev"/>
-       <classpathentry exported="true" kind="lib" 
path="lib/vexidev_lib-working.jar"/>
-       <classpathentry exported="true" kind="con" 
path="org.eclipse.pde.core.requiredPlugins"/>
-       <classpathentry exported="true" kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
-       <classpathentry combineaccessrules="false" kind="src" 
path="/org.vexi-vexidev.conf"/>
-       <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="src_junit"/>
+       <classpathentry kind="src" path="src_dev"/>
+       <classpathentry kind="lib" path="lib/vexidev_lib-rev_4805.jar"/>
+       <classpathentry exported="true" kind="con" 
path="org.eclipse.pde.core.requiredPlugins"/>
+       <classpathentry combineaccessrules="false" kind="src" 
path="/org.vexi-vexidev.conf"/>
+       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>

Modified: trunk/tools/org.vexi.vexidev/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/tools/org.vexi.vexidev/.settings/org.eclipse.jdt.core.prefs   
2015-10-06 21:51:22 UTC (rev 4816)
+++ trunk/tools/org.vexi.vexidev/.settings/org.eclipse.jdt.core.prefs   
2015-10-26 22:19:54 UTC (rev 4817)
@@ -1,9 +1,9 @@
-#Sun Oct 05 19:24:28 BST 2008
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=optimize out
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.7
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -63,4 +63,4 @@
 
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
 org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
 org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.7

Modified: trunk/tools/org.vexi.vexidev/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/org.vexi.vexidev/META-INF/MANIFEST.MF   2015-10-06 21:51:22 UTC 
(rev 4816)
+++ trunk/tools/org.vexi.vexidev/META-INF/MANIFEST.MF   2015-10-26 22:19:54 UTC 
(rev 4817)
@@ -84,7 +84,7 @@
 Eclipse-AutoStart: true
 Plugin-Class: org.vexi.vexidev.VexidevPlugin
 Bundle-ClassPath: vexidev.jar,
- lib/vexidev_lib-working.jar
+ lib/vexidev_lib-rev_4805.jar
 Bundle-Vendor: vexi.org
 Import-Package: junit.framework
 

Modified: trunk/tools/org.vexi.vexidev/build.properties
===================================================================
--- trunk/tools/org.vexi.vexidev/build.properties       2015-10-06 21:51:22 UTC 
(rev 4816)
+++ trunk/tools/org.vexi.vexidev/build.properties       2015-10-26 22:19:54 UTC 
(rev 4817)
@@ -2,7 +2,7 @@
                plugin.xml,\
                icons/,\
                vexidev.jar,\
-               lib/vexidev_lib-working.jar
+               lib/vexidev_lib-rev_4805.jar
 src.includes = src/,\
                plugin.xml,\
                icons/,\

Modified: trunk/tools/org.vexi.vexidev/plugin.xml
===================================================================
--- trunk/tools/org.vexi.vexidev/plugin.xml     2015-10-06 21:51:22 UTC (rev 
4816)
+++ trunk/tools/org.vexi.vexidev/plugin.xml     2015-10-26 22:19:54 UTC (rev 
4817)
@@ -161,11 +161,20 @@
             name="Vexi XML Editor"
             extensions="t"
             icon="icons/vexi.png"
-            
contributorClass="org.vexi.vexidev.editor.VexiEditorActionContributor"
+            
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
             class="org.vexi.vexidev.editor.VexiEditor"
             id="org.vexi.vexidev.editor.VexiEditor">
          <contentTypeBinding 
contentTypeId="org.vexi.vexidev.contentTypeBinding1"/>
       </editor>
+      <editor
+            name="Vexi Script Editor"
+            extensions="script"
+            icon="icons/vexi.png"
+            
contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
+            class="org.vexi.vexidev.editor.ScriptEditor"
+            id="org.vexi.vexidev.editor.ScriptEditor">
+         <contentTypeBinding 
contentTypeId="org.vexi.vexidev.contentTypeBinding1"/>
+      </editor>
    </extension>
    <extension
          point="org.eclipse.ui.editorActions">

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/ConsoleLineTracker.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/ConsoleLineTracker.java
  2015-10-06 21:51:22 UTC (rev 4816)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/debug/ui/ConsoleLineTracker.java
  2015-10-26 22:19:54 UTC (rev 4817)
@@ -20,7 +20,7 @@
 import org.eclipse.jface.text.IRegion;
 import org.eclipse.ui.console.IHyperlink;
 import org.vexi.vexidev.VexidevPlugin;
-import org.vexi.vexidev.editor.VexiEditor;
+import org.vexi.vexidev.editor.AbstractVexiEditor;
 import org.vexi.vexidev.editor.model.ItemPointer;
 import org.vexi.vexidev.editor.model.Location;
 /*
@@ -62,9 +62,7 @@
                public void linkExited() {}
 
                public void linkActivated() {
-                  VexiEditor.open(pointer);
-                       //PyOpenAction open = new PyOpenAction();
-                       ///open.run(pointer);
+                  AbstractVexiEditor.open(pointer);
                }
 
                public IRegion getHyperlinkRegion() {

Copied: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/AbstractVexiEditor.java
 (from rev 4816, 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java)
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/AbstractVexiEditor.java
                            (rev 0)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/AbstractVexiEditor.java
    2015-10-26 22:19:54 UTC (rev 4817)
@@ -0,0 +1,199 @@
+package org.vexi.vexidev.editor;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewerExtension2;
+import org.eclipse.jface.text.TextSelection;
+import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
+import org.eclipse.jface.text.source.MatchingCharacterPainter;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+import org.vexi.vexidev.IConstants;
+import org.vexi.vexidev.VexidevPlugin;
+import org.vexi.vexidev.editor.model.ItemPointer;
+import org.vexi.vexidev.editor.model.Location;
+import org.vexi.vexidev.outline.VexiOutlinePage;
+
+
+public class AbstractVexiEditor extends TextEditor {
+       // REMARK - could this be made static? Disable disposing in which case
+       protected  ColorManager colorManager = new ColorManager();
+    
+    private VexiOutlinePage outline;
+
+
+       public void dispose() {
+               colorManager.dispose();
+               super.dispose();
+       }
+       @Override
+       public void createPartControl(Composite parent) {
+               super.createPartControl(parent);
+               MatchingCharacterPainter mcp = new MatchingCharacterPainter(
+                       getSourceViewer(),
+                       new DefaultCharacterPairMatcher(new char[] {'(', ')', 
'{', '}', '[', ']'}));
+               mcp.setColor(colorManager.getColor(new RGB(125,125,125)));
+               ITextViewerExtension2 extension = (ITextViewerExtension2) 
getSourceViewer();
+        extension.addPainter(mcp);
+       }
+       
+       /*
+       protected void createActions() {
+               super.createActions();
+               IAction a = new FormatActionDelegate();
+               a.
+               createAction();
+       }
+       
+       
+       protected void editorContextMenuAboutToShow(IMenuManager menu) {
+               super.editorContextMenuAboutToShow(menu);
+               addAction(menu, "Format"); 
+       }*/
+       
+       
+       static private void showInEditor(
+               ITextEditor textEdit,
+               Location start,
+               Location end) {
+               try {
+                       IDocument doc =
+                               textEdit.getDocumentProvider().getDocument(
+                                       textEdit.getEditorInput());
+                       int s;
+                       s = start.toOffset(doc);
+                       int e = end == null ? s : end.toOffset(doc);
+                       TextSelection sel = new TextSelection(s, e - s);
+                       textEdit.getSelectionProvider().setSelection(sel);
+               } catch (BadLocationException e1) {
+                       VexidevPlugin.log(IStatus.ERROR, "Error setting 
selection", e1);
+               }
+       }
+       
+    /**
+     * Utility function that opens an editor on a given path.
+     * 
+     * @return part that is the editor
+     */
+       static public IEditorPart doOpenEditor(IPath path, boolean activate) {
+        if (path == null)
+            return null;
+        VexidevPlugin plugin = VexidevPlugin.getDefault();
+        IWorkspace w = ResourcesPlugin.getWorkspace();
+        IFile file = w.getRoot().getFileForLocation(path);
+        IWorkbenchPage wp = 
plugin.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        try {
+            if (file != null && file.exists()) {
+                // File is inside the workspace
+               VexiEditorInput input = new VexiEditorInput(file);
+                return IDE.openEditor(wp, input, IConstants.ID_EDITOR, 
activate);
+            } else {
+                return openExternalFile(path, wp, activate);
+            }
+        } catch (Exception e) {
+               VexidevPlugin.log(IStatus.ERROR, "Unexpected error opening path 
" + path.toString(), e);
+            return null;
+        }
+    }
+       
+       
+
+       
+    private static IEditorPart openExternalFile(IPath location, IWorkbenchPage 
wp, boolean activate) throws CoreException {
+      IWorkspace ws = ResourcesPlugin.getWorkspace();
+      IProject project = ws.getRoot().getProject("External Files");
+      if (!project.exists())
+          project.create(null);
+      if (!project.isOpen())
+          project.open(null);
+
+      //IWorkbenchWindow window = 
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+
+      IFile file = project.getFile(location.lastSegment());
+      file.createLink(location, IResource.NONE, null);
+      if (wp != null)
+          return IDE.openEditor(wp, file, activate);
+      return null;
+
+      //        IStorage storage = new FileStorage(path);
+      //        IEditorRegistry registry = 
PlatformUI.getWorkbench().getEditorRegistry();
+      //        IEditorDescriptor desc = 
registry.getDefaultEditor(path.lastSegment());
+      //        if (desc == null)
+      //               desc = 
registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
+      //        IEditorInput input = new ExternalEditorInput(storage);
+      //        return wp.openEditor(input, desc.getId());
+  }
+    
+       static public void open(ItemPointer p) {
+               IEditorPart editor = null;
+               if (p.file instanceof IFile)
+                       editor = doOpenEditor(((IFile)p.file).getFullPath(), 
true);
+               else if (p.file instanceof IPath) {
+                       editor = doOpenEditor((IPath)p.file, true);
+               }
+               else if (p.file instanceof File) {
+                       Path path = new Path(((File)p.file).getAbsolutePath());
+                       editor = doOpenEditor(path, true);
+               }
+               if (editor instanceof ITextEditor && p.start.line >= 0) {
+                       showInEditor((ITextEditor)editor, p.start, p.end);
+               }
+       }
+       
+       public void gotoLine(int l){
+               getSourceViewer().setTopIndex(l);
+       }
+
+       
+       public int getTabWidth(){
+               return getSourceViewer().getTextWidget().getTabs();
+       }
+
+       public String[] getPrefix(String contentType) {
+               return 
getSourceViewerConfiguration().getDefaultPrefixes(getSourceViewer(), 
contentType);
+       }
+       
+       public String getConfiguredDocumentPartitioning(){
+               return 
getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer());
+       }       
+       
+    public void doSave(IProgressMonitor monitor) {
+        super.doSave(monitor);
+        if (outline != null)
+               outline.update();
+    }
+
+    public Object getAdapter(Class key) {
+        if (key.equals(IContentOutlinePage.class)) {
+            IEditorInput input = getEditorInput();
+            if (input instanceof IFileEditorInput) {
+               outline = new VexiOutlinePage(this,((IFileEditorInput) input)
+                        .getFile());
+                return outline;
+            }
+        }
+        return super.getAdapter(key);
+    }
+
+
+}

Added: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditor.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditor.java  
                        (rev 0)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditor.java  
2015-10-26 22:19:54 UTC (rev 4817)
@@ -0,0 +1,16 @@
+package org.vexi.vexidev.editor;
+
+import org.vexi.vexidev.VexidevPlugin;
+
+public class ScriptEditor extends AbstractVexiEditor {
+
+    
+       public ScriptEditor() {
+               super();
+               VexidevPlugin.trace("Script Editor created");
+           setSourceViewerConfiguration(new 
ScriptEditorConfiguration(colorManager));
+               setDocumentProvider(new VexiDocumentProvider());
+               // initialize preferences
+               //VexidevPlugin.getDefault().getPluginPreferences();
+       }
+}


Property changes on: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditor.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditorConfiguration.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditorConfiguration.java
                             (rev 0)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditorConfiguration.java
     2015-10-26 22:19:54 UTC (rev 4817)
@@ -0,0 +1,91 @@
+package org.vexi.vexidev.editor;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextDoubleClickStrategy;
+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.Token;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.vexi.vexidev.IConstants;
+
+public class ScriptEditorConfiguration extends SourceViewerConfiguration {
+       private VexiDoubleClickStrategy doubleClickStrategy;
+       private VSScanner scanner;
+       private ColorManager colorManager;
+
+       static final public String[] contentTypes = new String[] {
+               IDocument.DEFAULT_CONTENT_TYPE,
+               TemplateFilePartitionScanner.XML_COMMENT,
+               TemplateFilePartitionScanner.XML_TAG,
+               TemplateFilePartitionScanner.VS_COMMENT,
+               TemplateFilePartitionScanner.VS_ML_STRING
+                       
+       };
+       
+       public ScriptEditorConfiguration(ColorManager colorManager) {
+               this.colorManager = colorManager;
+       }
+       public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+               return contentTypes;
+       }
+       public ITextDoubleClickStrategy getDoubleClickStrategy(
+               ISourceViewer sourceViewer,
+               String contentType) {
+               if (doubleClickStrategy == null)
+                       doubleClickStrategy = new VexiDoubleClickStrategy();
+               return doubleClickStrategy;
+       }
+
+       protected VSScanner getScriptScanner() {
+               if (scanner == null) {
+                       scanner = new VSScanner(colorManager);
+                       scanner.setDefaultReturnToken(
+                               new Token(
+                                       new TextAttribute(
+                                           
colorManager.getPreferenceColor(IConstants.PREF_COL_DEFAULT))));
+               }
+               return scanner;
+       }
+
+       public IPresentationReconciler getPresentationReconciler(ISourceViewer 
sourceViewer) {
+               PresentationReconciler reconciler = new 
PresentationReconciler();
+
+               DefaultDamagerRepairer dr;
+
+               NonRuleBasedDamagerRepairer ndr;
+
+               dr = new DefaultDamagerRepairer(getScriptScanner());
+               reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+               reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);     
                
+
+               
+               ndr =
+                       new NonRuleBasedDamagerRepairer(
+                               new TextAttribute(
+                                   
colorManager.getPreferenceColor(IConstants.PREF_COL_VS_COMMENT)));
+               reconciler.setDamager(ndr, 
TemplateFilePartitionScanner.VS_COMMENT);
+               reconciler.setRepairer(ndr, 
TemplateFilePartitionScanner.VS_COMMENT);
+               
+               
+               ndr = new NonRuleBasedDamagerRepairer(
+                               new TextAttribute(
+                                   
colorManager.getPreferenceColor(IConstants.PREF_COL_VS_STRING)));
+               reconciler.setDamager(ndr, 
TemplateFilePartitionScanner.VS_ML_STRING);
+               reconciler.setRepairer(ndr, 
TemplateFilePartitionScanner.VS_ML_STRING);
+
+               return reconciler;
+       }
+
+       static private final String[] COMMENT_PREFIXES = new String[]{"//"};
+       
+       @Override
+       public String[] getDefaultPrefixes(ISourceViewer sourceViewer, String 
contentType) {
+               if(IDocument.DEFAULT_CONTENT_TYPE.equals(contentType))
+                       return COMMENT_PREFIXES;
+               return null;
+       }
+       
+}
\ No newline at end of file


Property changes on: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/ScriptEditorConfiguration.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/TemplateFilePartitionScanner.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/TemplateFilePartitionScanner.java
  2015-10-06 21:51:22 UTC (rev 4816)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/TemplateFilePartitionScanner.java
  2015-10-26 22:19:54 UTC (rev 4817)
@@ -15,21 +15,25 @@
        
        
     public final static String VS_COMMENT = "__vs_comment";
+    public final static String VS_ML_STRING = "__vs_ml_string";
 
        
        public TemplateFilePartitionScanner() {
 
                IToken xmlComment = new Token(XML_COMMENT);
                IToken commentToken = new Token(VS_COMMENT);
+               IToken mlstringToken = new Token(VS_ML_STRING);
                
 
-               IPredicateRule[] rules = new IPredicateRule[3];
+               IPredicateRule[] rules = new IPredicateRule[]{
+                       new MultiLineRule("<!--", "-->", xmlComment),           
+                       TagRule.create(),
+                       new MultiLineRule("/*", "*/", commentToken),
+                       new MultiLineRule("'''", "'''", mlstringToken),
+                       new MultiLineRule("\"\"\"", "\"\"\"", mlstringToken)
+               };
 
-               rules[0] = new MultiLineRule("<!--", "-->", xmlComment);
-               rules[1] = TagRule.create();
-
-
-           rules[2] = new MultiLineRule("/*", "*/", commentToken);
+                
            //VexiScript Strings
            //rules[3] = new MultiLineRule("\"", "\"", stringToken);
                

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VSScanner.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VSScanner.java     
2015-10-06 21:51:22 UTC (rev 4816)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VSScanner.java     
2015-10-26 22:19:54 UTC (rev 4817)
@@ -55,6 +55,10 @@
                }
                rules.add(wordRule);
                rules.add(new WordRule(new NumberDetector(), numberToken));
+               // REMARK done these as separate partitions instead since they 
didn't seem
+               // to fully work here ...
+//             rules.add(new MultiLineRule("'''", "'''", mlstringToken));
+//             rules.add(new MultiLineRule("\"\"\"", "\"\"\"", mlstringToken));
                rules.add(new SingleLineRule("\"", "\"", stringToken));
                rules.add(new SingleLineRule("'", "'", stringToken));
                

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java
===================================================================
--- trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java    
2015-10-06 21:51:22 UTC (rev 4816)
+++ trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java    
2015-10-26 22:19:54 UTC (rev 4817)
@@ -1,207 +1,16 @@
-package org.vexi.vexidev.editor;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewerExtension2;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.text.source.DefaultCharacterPairMatcher;
-import org.eclipse.jface.text.source.MatchingCharacterPainter;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.vexi.vexidev.IConstants;
-import org.vexi.vexidev.VexidevPlugin;
-import org.vexi.vexidev.editor.model.ItemPointer;
-import org.vexi.vexidev.editor.model.Location;
-import org.vexi.vexidev.outline.VexiOutlinePage;
-
-
-public class VexiEditor extends TextEditor {
-
-    // REMARK - could this be made static? Disable disposing in which case
-    private  ColorManager colorManager = new ColorManager();
-    private VexiOutlinePage outline;
-
-       
-       public VexiEditor() {
-               super();
-               VexidevPlugin.trace("VEXI EDITOR created");
-           setSourceViewerConfiguration(new 
VexiEditorConfiguration(colorManager));
-               setDocumentProvider(new VexiDocumentProvider());
-               // initialize preferences
-               //VexidevPlugin.getDefault().getPluginPreferences();
-       }
-       public void dispose() {
-               colorManager.dispose();
-               super.dispose();
-       }
-       @Override
-       public void createPartControl(Composite parent) {
-               super.createPartControl(parent);
-               MatchingCharacterPainter mcp = new MatchingCharacterPainter(
-                       getSourceViewer(),
-                       new DefaultCharacterPairMatcher(new char[] {'(', ')', 
'{', '}', '[', ']'}));
-               mcp.setColor(colorManager.getColor(new RGB(125,125,125)));
-               ITextViewerExtension2 extension = (ITextViewerExtension2) 
getSourceViewer();
-        extension.addPainter(mcp);
-       }
-       
-       /*
-       protected void createActions() {
-               super.createActions();
-               IAction a = new FormatActionDelegate();
-               a.
-               createAction();
-       }
-       
-       
-       protected void editorContextMenuAboutToShow(IMenuManager menu) {
-               super.editorContextMenuAboutToShow(menu);
-               addAction(menu, "Format"); 
-       }*/
-       
-       
-       static private void showInEditor(
-               ITextEditor textEdit,
-               Location start,
-               Location end) {
-               try {
-                       IDocument doc =
-                               textEdit.getDocumentProvider().getDocument(
-                                       textEdit.getEditorInput());
-                       int s;
-                       s = start.toOffset(doc);
-                       int e = end == null ? s : end.toOffset(doc);
-                       TextSelection sel = new TextSelection(s, e - s);
-                       textEdit.getSelectionProvider().setSelection(sel);
-               } catch (BadLocationException e1) {
-                       VexidevPlugin.log(IStatus.ERROR, "Error setting 
selection", e1);
-               }
-       }
-       
-    /**
-     * Utility function that opens an editor on a given path.
-     * 
-     * @return part that is the editor
-     */
-       static public IEditorPart doOpenEditor(IPath path, boolean activate) {
-        if (path == null)
-            return null;
-        VexidevPlugin plugin = VexidevPlugin.getDefault();
-        IWorkspace w = ResourcesPlugin.getWorkspace();
-        IFile file = w.getRoot().getFileForLocation(path);
-        IWorkbenchPage wp = 
plugin.getWorkbench().getActiveWorkbenchWindow().getActivePage();
-        try {
-            if (file != null && file.exists()) {
-                // File is inside the workspace
-               VexiEditorInput input = new VexiEditorInput(file);
-                return IDE.openEditor(wp, input, IConstants.ID_EDITOR, 
activate);
-            } else {
-                return openExternalFile(path, wp, activate);
-            }
-        } catch (Exception e) {
-               VexidevPlugin.log(IStatus.ERROR, "Unexpected error opening path 
" + path.toString(), e);
-            return null;
-        }
-    }
-       
-       
-
-       
-    private static IEditorPart openExternalFile(IPath location, IWorkbenchPage 
wp, boolean activate) throws CoreException {
-      IWorkspace ws = ResourcesPlugin.getWorkspace();
-      IProject project = ws.getRoot().getProject("External Files");
-      if (!project.exists())
-          project.create(null);
-      if (!project.isOpen())
-          project.open(null);
-
-      //IWorkbenchWindow window = 
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-
-      IFile file = project.getFile(location.lastSegment());
-      file.createLink(location, IResource.NONE, null);
-      if (wp != null)
-          return IDE.openEditor(wp, file, activate);
-      return null;
-
-      //        IStorage storage = new FileStorage(path);
-      //        IEditorRegistry registry = 
PlatformUI.getWorkbench().getEditorRegistry();
-      //        IEditorDescriptor desc = 
registry.getDefaultEditor(path.lastSegment());
-      //        if (desc == null)
-      //               desc = 
registry.findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID);
-      //        IEditorInput input = new ExternalEditorInput(storage);
-      //        return wp.openEditor(input, desc.getId());
-  }
-    
-       static public void open(ItemPointer p) {
-               IEditorPart editor = null;
-               if (p.file instanceof IFile)
-                       editor = doOpenEditor(((IFile)p.file).getFullPath(), 
true);
-               else if (p.file instanceof IPath) {
-                       editor = doOpenEditor((IPath)p.file, true);
-               }
-               else if (p.file instanceof File) {
-                       Path path = new Path(((File)p.file).getAbsolutePath());
-                       editor = doOpenEditor(path, true);
-               }
-               if (editor instanceof ITextEditor && p.start.line >= 0) {
-                       showInEditor((ITextEditor)editor, p.start, p.end);
-               }
-       }
-       
-       public void gotoLine(int l){
-               getSourceViewer().setTopIndex(l);
-       }
-
-       
-       public int getTabWidth(){
-               return getSourceViewer().getTextWidget().getTabs();
-       }
-
-       public String[] getPrefix(String contentType) {
-               return 
getSourceViewerConfiguration().getDefaultPrefixes(getSourceViewer(), 
contentType);
-       }
-       
-       public String getConfiguredDocumentPartitioning(){
-               return 
getSourceViewerConfiguration().getConfiguredDocumentPartitioning(getSourceViewer());
-       }       
-       
-    public void doSave(IProgressMonitor monitor) {
-        super.doSave(monitor);
-        if (outline != null)
-               outline.update();
-    }
-
-    public Object getAdapter(Class key) {
-        if (key.equals(IContentOutlinePage.class)) {
-            IEditorInput input = getEditorInput();
-            if (input instanceof IFileEditorInput) {
-               outline = new VexiOutlinePage(this,((IFileEditorInput) input)
-                        .getFile());
-                return outline;
-            }
-        }
-        return super.getAdapter(key);
-    }
-
-
-}
+package org.vexi.vexidev.editor;
+
+import org.vexi.vexidev.VexidevPlugin;
+
+public class VexiEditor extends AbstractVexiEditor {
+
+    
+       public VexiEditor() {
+               super();
+               VexidevPlugin.trace("VEXI EDITOR created");
+           setSourceViewerConfiguration(new 
VexiEditorConfiguration(colorManager));
+               setDocumentProvider(new VexiDocumentProvider());
+               // initialize preferences
+               //VexidevPlugin.getDefault().getPluginPreferences();
+       }
+}


Property changes on: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditor.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditorConfiguration.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditorConfiguration.java
       2015-10-06 21:51:22 UTC (rev 4816)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/VexiEditorConfiguration.java
       2015-10-26 22:19:54 UTC (rev 4817)
@@ -22,7 +22,7 @@
                TemplateFilePartitionScanner.XML_COMMENT,
                TemplateFilePartitionScanner.XML_TAG,
                TemplateFilePartitionScanner.VS_COMMENT,
-               //TemplateFilePartitionScanner.VS_STRING
+               TemplateFilePartitionScanner.VS_ML_STRING
                        
        };
        
@@ -40,7 +40,7 @@
                return doubleClickStrategy;
        }
 
-       protected VSScanner getXMLScanner() {
+       protected VSScanner getScriptScanner() {
                if (scanner == null) {
                        scanner = new VSScanner(colorManager);
                        scanner.setDefaultReturnToken(
@@ -69,9 +69,6 @@
                reconciler.setDamager(dr, TemplateFilePartitionScanner.XML_TAG);
                reconciler.setRepairer(dr, 
TemplateFilePartitionScanner.XML_TAG);
 
-               dr = new DefaultDamagerRepairer(getXMLScanner());
-               reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
-               reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
 
                NonRuleBasedDamagerRepairer ndr =
                        new NonRuleBasedDamagerRepairer(
@@ -80,6 +77,11 @@
                reconciler.setDamager(ndr, 
TemplateFilePartitionScanner.XML_COMMENT);
                reconciler.setRepairer(ndr, 
TemplateFilePartitionScanner.XML_COMMENT);
 
+               dr = new DefaultDamagerRepairer(getScriptScanner());
+               reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+               reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);     
                
+
+               // REMARK found that we need to do the vexi string things here
                ndr =
                        new NonRuleBasedDamagerRepairer(
                                new TextAttribute(
@@ -87,13 +89,12 @@
                reconciler.setDamager(ndr, 
TemplateFilePartitionScanner.VS_COMMENT);
                reconciler.setRepairer(ndr, 
TemplateFilePartitionScanner.VS_COMMENT);
                
-               /*ndr =
-                       new NonRuleBasedDamagerRepairer(
+               
+               ndr = new NonRuleBasedDamagerRepairer(
                                new TextAttribute(
                                    
colorManager.getPreferenceColor(IConstants.PREF_COL_VS_STRING)));
-               reconciler.setDamager(ndr, 
TemplateFilePartitionScanner.VS_STRING);
-               reconciler.setRepairer(ndr, 
TemplateFilePartitionScanner.VS_STRING);*/
-               
+               reconciler.setDamager(ndr, 
TemplateFilePartitionScanner.VS_ML_STRING);
+               reconciler.setRepairer(ndr, 
TemplateFilePartitionScanner.VS_ML_STRING);
                return reconciler;
        }
 

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/IndentActionDelegate.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/IndentActionDelegate.java
  2015-10-06 21:51:22 UTC (rev 4816)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/IndentActionDelegate.java
  2015-10-26 22:19:54 UTC (rev 4817)
@@ -15,12 +15,12 @@
 import org.ibex.util.XML.Exn;
 import org.vexi.format.Indenter;
 import org.vexi.vexidev.VexidevPlugin;
-import org.vexi.vexidev.editor.VexiEditor;
+import org.vexi.vexidev.editor.AbstractVexiEditor;
 
 public class IndentActionDelegate implements IEditorActionDelegate {
        
        // Always points to the current editor
-       protected VexiEditor targetEditor;
+       protected AbstractVexiEditor targetEditor;
 
        protected IDocument doc;
 
@@ -32,8 +32,8 @@
        public IndentActionDelegate(IDocument doc) {this.doc = doc;}
 
        public void setActiveEditor(IAction action, IEditorPart targetEditor) {
-               if (targetEditor instanceof VexiEditor) {
-                       this.targetEditor = (VexiEditor) targetEditor;
+               if (targetEditor instanceof AbstractVexiEditor) {
+                       this.targetEditor = (AbstractVexiEditor) targetEditor;
                        this.doc = 
this.targetEditor.getDocumentProvider().getDocument(
                                        targetEditor.getEditorInput());
                        this.selection = (ITextSelection) this.targetEditor

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/ToggleCommentActionDelegate.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/ToggleCommentActionDelegate.java
   2015-10-06 21:51:22 UTC (rev 4816)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/editor/actions/ToggleCommentActionDelegate.java
   2015-10-26 22:19:54 UTC (rev 4817)
@@ -26,7 +26,7 @@
 import org.ibex.util.XML;
 import org.vexi.format.Indenter;
 import org.vexi.vexidev.VexidevPlugin;
-import org.vexi.vexidev.editor.VexiEditor;
+import org.vexi.vexidev.editor.AbstractVexiEditor;
 
 
 /**
@@ -36,7 +36,7 @@
 public class ToggleCommentActionDelegate implements IEditorActionDelegate {
        
        // Always points to the current editor
-       protected VexiEditor targetEditor;
+       protected AbstractVexiEditor targetEditor;
        private ITextOperationTarget operationTarget;
        protected IDocument doc;
 
@@ -48,8 +48,8 @@
        public ToggleCommentActionDelegate(IDocument doc) {this.doc = doc;}
 
        public void setActiveEditor(IAction action, IEditorPart targetEditor) {
-               if (targetEditor instanceof VexiEditor) {
-                       this.targetEditor = (VexiEditor) targetEditor;
+               if (targetEditor instanceof AbstractVexiEditor) {
+                       this.targetEditor = (AbstractVexiEditor) targetEditor;
                        this.doc = 
this.targetEditor.getDocumentProvider().getDocument(
                                        targetEditor.getEditorInput());
                        this.selection = (ITextSelection) this.targetEditor

Modified: 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/outline/VexiOutlinePage.java
===================================================================
--- 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/outline/VexiOutlinePage.java  
    2015-10-06 21:51:22 UTC (rev 4816)
+++ 
trunk/tools/org.vexi.vexidev/src/org/vexi/vexidev/outline/VexiOutlinePage.java  
    2015-10-26 22:19:54 UTC (rev 4817)
@@ -10,14 +10,14 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
 import org.vexi.vexidev.VexidevPlugin;
-import org.vexi.vexidev.editor.VexiEditor;
+import org.vexi.vexidev.editor.AbstractVexiEditor;
 
 public class VexiOutlinePage extends ContentOutlinePage {
 
        IFile file;
-       VexiEditor vexiEditor;
+       AbstractVexiEditor vexiEditor;
        
-    public VexiOutlinePage(VexiEditor vexiEditor, IFile file) {
+    public VexiOutlinePage(AbstractVexiEditor vexiEditor, IFile file) {
                this.file = file;
                this.vexiEditor = vexiEditor;
        }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to