[SCM] Lisaac eclipse plugin branch, master, updated. c67942e40626772229a3cf44d61c2a168c8ab233

Damien Bouvarel dams.bouvarel at wanadoo.fr
Sun May 3 11:18:43 UTC 2009


The following commit has been merged in the master branch:
commit c67942e40626772229a3cf44d61c2a168c8ab233
Author: Damien Bouvarel <dams.bouvarel at wanadoo.fr>
Date:   Sun May 3 13:09:46 2009 +0200

    Prototype Completion, eg  INT -> {INTEGER,INTEGER_32,...}

diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 01694cf..c8c3ae9 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: Lisaac Plug-in
+Bundle-Name: Damien Bouvarel
 Bundle-SymbolicName: org.eclipse.lisaac; singleton:=true
 Bundle-Version: 1.0.0
 Bundle-Activator: org.eclipse.lisaac.LisaacPlugin
-Bundle-Vendor: Damien Bouvarel
+Bundle-Vendor: %Bundle-Vendor.0
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -24,3 +24,20 @@ Import-Package: org.eclipse.ant.core,
  org.eclipse.debug.ui,
  org.eclipse.ui.texteditor.templates,
  org.eclipse.ui.views.contentoutline
+Export-Package: org.eclipse.lisaac,
+ org.eclipse.lisaac.actions,
+ org.eclipse.lisaac.builder,
+ org.eclipse.lisaac.editors,
+ org.eclipse.lisaac.launch,
+ org.eclipse.lisaac.model,
+ org.eclipse.lisaac.model.items,
+ org.eclipse.lisaac.model.lip,
+ org.eclipse.lisaac.model.types,
+ org.eclipse.lisaac.outline,
+ org.eclipse.lisaac.perspectives,
+ org.eclipse.lisaac.preferences,
+ org.eclipse.lisaac.properties,
+ org.eclipse.lisaac.templates,
+ org.eclipse.lisaac.views,
+ org.eclipse.lisaac.wizards
+Bundle-Localization: plugin
diff --git a/build.properties b/build.properties
index b476d07..e8721c8 100644
--- a/build.properties
+++ b/build.properties
@@ -1,9 +1,17 @@
-source.. = src/
-output.. = bin/
-bin.includes = plugin.xml,\
-               META-INF/,\
-               .,\
-               icons/,\
-               help/html/,\
-               *.xml,\
-               help/contexts.xml
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               icons/,\
+               *.xml,\
+               plugin.properties,\
+               help/
+src.includes = src/,\
+               help/,\
+               icons/,\
+               plugin.properties,\
+               plugin.xml,\
+               build.properties,\
+               META-INF/,\
+               README
diff --git a/plugin.properties b/plugin.properties
new file mode 100644
index 0000000..09e6d92
--- /dev/null
+++ b/plugin.properties
@@ -0,0 +1,32 @@
+#Properties file for eclipse
+Bundle-Name.0 = Lisaac Plug-in
+editor.name.0 = Lisaac Editor
+editor.name.1 = Lip Editor
+perspective.name.0 = Lisaac Perspective
+page.name.0 = Lisaac
+page.name.1 = Templates
+page.name.2 = Syntax Coloring
+page.name.3 = Editor
+page.name.4 = Lisaac File Property
+page.name.5 = Lisaac Compiler
+category.name.0 = Lisaac
+wizard.name.0 = Lisaac Project
+wizard.name.1 = Lisaac Prototype
+consoleFactory.label.0 = Lisaac Console
+launchConfigurationType.name.0 = Lisaac Application
+actionSet.description.0 = Lisaac Source Tools
+actionSet.label.0 = Source
+menu.label.0 = Source
+action.label.0 = Correct Indentation
+action.label.1 = Generate Constructor
+menu.label.1 = New Prototype
+action.label.2 = New Prototype
+action.tooltip.0 = Create new prototype
+action.label.3 = Toggle Comment
+command.name.0 = Indentation
+category.name.1 = Lisaac Command
+command.name.1 = Generate Constructor
+command.name.2 = New Prototype
+command.name.3 = Toggle comment
+shortcut.label.0 = Lisaac Application
+specification.label.0 = Lisaac Annotation
\ No newline at end of file
diff --git a/plugin.xml b/plugin.xml
index 60137f6..381b340 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -12,13 +12,16 @@
       <persistent
             value="true">
       </persistent>
+      <super
+            type="org.eclipse.core.resources.textmarker">
+      </super>
    </extension>
    <extension
          point="org.eclipse.ui.editors">
       <editor
-            name="Lisaac Editor"
+            name="%editor.name.0"
             extensions="li"
-            icon="icons/prototype.gif"
+            icon="$nl$/icons/prototype.gif"
             contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
             class="org.eclipse.lisaac.editors.LisaacEditor"
             id="org.eclipse.lisaac.editors.LisaacEditor">
@@ -28,9 +31,9 @@
             contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
             default="false"
             extensions="lip"
-            icon="icons/releng_gears.gif"
+            icon="$nl$/icons/releng_gears.gif"
             id="org.eclipse.lisaac.editors.LipEditor"
-            name="Lip Editor">
+            name="%editor.name.1">
       </editor>
    </extension>
    <extension
@@ -46,8 +49,8 @@
    <extension
          point="org.eclipse.ui.perspectives">
       <perspective
-            name="Lisaac Perspective"
-            icon="icons/releng_gears.gif"
+            name="%perspective.name.0"
+            icon="$nl$/icons/releng_gears.gif"
             class="org.eclipse.lisaac.perspectives.LisaacPerspective"
             id="org.eclipse.lisaac.perspectives.LisaacPerspective">
       </perspective>
@@ -55,7 +58,7 @@
    <extension
          point="org.eclipse.ui.preferencePages">
       <page
-            name="Lisaac"
+            name="%page.name.0"
             class="org.eclipse.lisaac.preferences.LisaacPreferencePage"
             id="org.eclipse.lisaac.preferences.LisaacPreferencePage">
       </page>
@@ -63,19 +66,19 @@
             category="org.eclipse.lisaac.editorpreferences"
             class="org.eclipse.lisaac.preferences.LisaacTemplatePage"
             id="org.eclipse.lisaac.templatepreferences"
-            name="Templates">
+            name="%page.name.1">
       </page>
       <page
             category="org.eclipse.lisaac.editorpreferences"
             class="org.eclipse.lisaac.preferences.LisaacColoringPage"
             id="org.eclipse.lisaac.editorcolorpreferences"
-            name="Syntax Coloring">
+            name="%page.name.2">
       </page>
       <page
             category="org.eclipse.lisaac.preferences.LisaacPreferencePage"
             class="org.eclipse.lisaac.preferences.LisaacEditorPage"
             id="org.eclipse.lisaac.editorpreferences"
-            name="Editor">
+            name="%page.name.3">
          <keywordReference
                id="org.eclipse.ui.editors.general">
          </keywordReference>
@@ -92,14 +95,14 @@
       <page
             class="org.eclipse.lisaac.properties.LisaacPropertyPage"
             id="org.eclipse.lisaac.properties.lisaacPropertyPage"
-            name="Lisaac File Property"
+            name="%page.name.4"
             nameFilter="*.li"
             objectClass="org.eclipse.core.resources.IFile">
       </page>
       <page
             class="org.eclipse.lisaac.properties.LisaacProjectPropertyPage"
             id="org.eclipse.lisaac.properties.projectPropertyPage"
-            name="Lisaac Compiler"
+            name="%page.name.5"
             objectClass="org.eclipse.core.resources.IProject">
       </page>
    </extension>
@@ -109,7 +112,7 @@
          point="org.eclipse.ui.newWizards">
       <category
             id="Lisaac"
-            name="Lisaac">
+            name="%category.name.0">
       </category>
       <wizard
             canFinishEarly="false"
@@ -117,9 +120,9 @@
             class="org.eclipse.lisaac.wizards.NewProjectWizard"
             finalPerspective="org.eclipse.lisaac.perspectives.LisaacPerspective"
             hasPages="true"
-            icon="icons/sample.gif"
+            icon="$nl$/icons/sample.gif"
             id="org.eclipse.lisaac.wizard"
-            name="Lisaac Project"
+            name="%wizard.name.0"
             preferredPerspectives="org.eclipse.lisaac.perspectives.LisaacPerspective"
             project="true">
       </wizard>
@@ -129,9 +132,9 @@
             class="org.eclipse.lisaac.wizards.NewPrototypeWizard"
             finalPerspective="org.eclipse.lisaac.perspectives.LisaacPerspective"
             hasPages="true"
-            icon="icons/prototype.gif"
+            icon="$nl$/icons/prototype.gif"
             id="org.eclipse.lisaac.prototype"
-            name="Lisaac Prototype"
+            name="%wizard.name.1"
             preferredPerspectives="org.eclipse.lisaac.perspectives.LisaacPerspective"
             project="false">
       </wizard>
@@ -166,7 +169,7 @@
          point="org.eclipse.ui.console.consoleFactories">
       <consoleFactory
             class="org.eclipse.lisaac.views.ConsoleFactory"
-            label="Lisaac Console">
+            label="%consoleFactory.label.0">
       </consoleFactory>
    </extension>
    <extension
@@ -175,7 +178,7 @@
             delegate="org.eclipse.lisaac.launch.LaunchConfiguration"
             id="org.eclipse.lisaac.launchConfiguration"
             modes="run"
-            name="Lisaac Application"
+            name="%launchConfigurationType.name.0"
             public="true">
       </launchConfigurationType>
    </extension>
@@ -190,13 +193,13 @@
    <extension
          point="org.eclipse.ui.actionSets">
       <actionSet
-            description="Lisaac Source Tools"
+            description="%actionSet.description.0"
             id="org.eclipse.lisaac.source"
-            label="Source"
+            label="%actionSet.label.0"
             visible="true">
          <menu
                id="org.eclipse.lisaac.sourcemenu"
-               label="Source">
+               label="%menu.label.0">
             <groupMarker
                   name="indent">
             </groupMarker>
@@ -205,35 +208,35 @@
                class="org.eclipse.lisaac.actions.IndentAction"
                definitionId="org.eclipse.lisaac.cmd1"
                id="org.eclipse.lisaac.indentaction"
-               label="Correct Indentation"
+               label="%action.label.0"
                menubarPath="org.eclipse.lisaac.sourcemenu/indent">
          </action>
          <action
                class="org.eclipse.lisaac.actions.GenerateConstructor"
                definitionId="org.eclipse.lisaac.cmd2"
                id="org.eclipse.lisaac.generateconstructor"
-               label="Generate Constructor"
+               label="%action.label.1"
                menubarPath="org.eclipse.lisaac.sourcemenu/indent">
          </action>
          <menu
                id="org.eclipse.lisaac.toolbar"
-               label="New Prototype">
+               label="%menu.label.1">
          </menu>
          <action
                class="org.eclipse.lisaac.actions.CreatePrototype"
                definitionId="org.eclipse.lisaac.cmd3"
-               icon="icons/prototype.gif"
+               icon="$nl$/icons/prototype.gif"
                id="org.eclipse.lisaac.toolbar_action1"
-               label="New Prototype"
+               label="%action.label.2"
                style="push"
                toolbarPath="org.eclipse.lisaac.toolbar"
-               tooltip="Create new prototype">
+               tooltip="%action.tooltip.0">
          </action>
          <action
                class="org.eclipse.lisaac.actions.ToggleComment"
                definitionId="org.eclipse.lisaac.cmd4"
                id="org.eclipse.lisaac.comment1"
-               label="Toggle Comment"
+               label="%action.label.3"
                menubarPath="org.eclipse.lisaac.sourcemenu/indent">
          </action>
       </actionSet>
@@ -243,26 +246,26 @@
       <command
             categoryId="org.eclipse.lisaac.commands"
             id="org.eclipse.lisaac.cmd1"
-            name="Indentation">
+            name="%command.name.0">
       </command>
       <category
             id="org.eclipse.lisaac.commands"
-            name="Lisaac Command">
+            name="%category.name.1">
       </category>
       <command
             categoryId="org.eclipse.lisaac.commands"
             id="org.eclipse.lisaac.cmd2"
-            name="Generate Constructor">
+            name="%command.name.1">
       </command>
       <command
             categoryId="org.eclipse.lisaac.commands"
             id="org.eclipse.lisaac.cmd3"
-            name="New Prototype">
+            name="%command.name.2">
       </command>
       <command
             categoryId="org.eclipse.lisaac.commands"
             id="org.eclipse.lisaac.cmd4"
-            name="Toggle comment">
+            name="%command.name.3">
       </command>
    </extension>
    <extension
@@ -308,7 +311,7 @@
             autoinsert="true"
             contextTypeId="org.eclipse.lisaac.contexttype"
             description="While loop"
-            icon="icons/template.gif"
+            icon="$nl$/icons/template.gif"
             id="org.eclipse.lisaac.template_whiledo"
             name="while_do">
          <pattern>
@@ -321,7 +324,7 @@
             autoinsert="true"
             contextTypeId="org.eclipse.lisaac.contexttype"
             description="Until Loop"
-            icon="icons/template.gif"
+            icon="$nl$/icons/template.gif"
             id="org.eclipse.lisaac.template_untildo"
             name="until_do">
          <pattern>
@@ -334,7 +337,7 @@
             autoinsert="true"
             contextTypeId="org.eclipse.lisaac.contexttype"
             description="If statement"
-            icon="icons/template.gif"
+            icon="$nl$/icons/template.gif"
             id="org.eclipse.lisaac.template_if"
             name="if">
          <pattern>
@@ -347,7 +350,7 @@
             autoinsert="true"
             contextTypeId="org.eclipse.lisaac.contexttype"
             description="If Else statement"
-            icon="icons/template.gif"
+            icon="$nl$/icons/template.gif"
             id="org.eclipse.lisaac.template_ifelse"
             name="if__else">
          <pattern>
@@ -361,7 +364,7 @@
             autoinsert="true"
             contextTypeId="org.eclipse.lisaac.contexttype"
             description="If false statement"
-            icon="icons/template.gif"
+            icon="$nl$/icons/template.gif"
             id="org.eclipse.lisaac.template_iffalse"
             name="if_false">
          <pattern>
@@ -374,7 +377,7 @@
             autoinsert="true"
             contextTypeId="org.eclipse.lisaac.contexttype"
             description="For loop"
-            icon="icons/template.gif"
+            icon="$nl$/icons/template.gif"
             id="org.eclipse.lisaac.template_for"
             name="to__do">
          <pattern>
@@ -387,9 +390,9 @@
          point="org.eclipse.debug.ui.launchShortcuts">
       <shortcut
             class="org.eclipse.lisaac.launch.LisaacApplicationShortcut"
-            icon="icons/prototype.gif"
+            icon="$nl$/icons/prototype.gif"
             id="org.eclipse.lisaac.launch.shortcut"
-            label="Lisaac Application"
+            label="%shortcut.label.0"
             modes="run">
          <perspective
                id="org.eclipse.lisaac.perspectives.LisaacPerspective">
@@ -406,5 +409,32 @@
          </contextualLaunch>
       </shortcut>
    </extension>
+   <extension
+         point="org.eclipse.ui.ide.markerResolution">
+      <markerResolutionGenerator
+            class="org.eclipse.lisaac.editors.LisaacQuickFixer"
+            markerType="org.eclipse.lisaac.lisaacProblem">
+      </markerResolutionGenerator>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors.annotationTypes">
+      <type
+            markerSeverity="2"
+            markerType="org.eclipse.lisaac.lisaacProblem"
+            name="org.eclipse.lisaac.annotationtype"
+            super="org.eclipse.ui.workbench.texteditor.error">
+      </type>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors.markerAnnotationSpecification">
+      <specification
+            annotationType="org.eclipse.lisaac.annotationtype"
+            colorPreferenceValue="180,207,205"
+            includeOnPreferencePage="true"
+            label="%specification.label.0"
+            presentationLayer="3"
+            symbolicIcon="error">
+      </specification>
+   </extension>
 
 </plugin>
diff --git a/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java b/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java
index b619dc0..65b3b5a 100644
--- a/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java
+++ b/src/org/eclipse/lisaac/editors/LisaacCompletionProcessor.java
@@ -58,22 +58,25 @@ public class LisaacCompletionProcessor implements IContentAssistProcessor {
 			ArrayList<ICompletionProposal> proposals) {
 		int bracketLevel=0;
 		//
-		// Rewind to '('  ';' '['
+		// Rewind to '(' '{' ';' '[' ':'
 		//
 		try {
 			int pos = baseOffset-1;
 			while (pos > 0) {
 				char c = document.getChar(pos);
-				if (c == ';') {
+				if (c == ';' || c == ':') {
 					break;
 				}
-				if (c == '(' || c == '[') {
+				if (c == '-' && pos-1 > 0 && document.getChar(pos-1) == '<') {
+					break;
+				}
+				if (c == '(' || c == '{' || c == '[') {
 					if (bracketLevel == 0) {
 						break;
 					}
 					bracketLevel--;
 				}
-				if (c == ')' || c == ']') {
+				if (c == ')' || c == '}' || c == ']') {
 					bracketLevel++;
 				}
 				pos--;
diff --git a/src/org/eclipse/lisaac/model/LisaacCompletionParser.java b/src/org/eclipse/lisaac/model/LisaacCompletionParser.java
index 215e53b..a3cee33 100644
--- a/src/org/eclipse/lisaac/model/LisaacCompletionParser.java
+++ b/src/org/eclipse/lisaac/model/LisaacCompletionParser.java
@@ -15,6 +15,7 @@ import org.eclipse.lisaac.LisaacPlugin;
 import org.eclipse.lisaac.builder.ILisaacErrorHandler;
 import org.eclipse.lisaac.editors.LisaacEditor;
 import org.eclipse.lisaac.model.items.ICode;
+import org.eclipse.lisaac.model.items.ITMPrototype;
 import org.eclipse.lisaac.model.items.ITMRead;
 import org.eclipse.lisaac.model.items.Prototype;
 import org.eclipse.lisaac.model.items.Slot;
@@ -60,8 +61,14 @@ public class LisaacCompletionParser extends LisaacParser {
 				if ("SELF".compareTo(type.toString()) != 0) {
 					currentPrototype = findPrototype(type.toString());
 				}
-				currentPrototype.getSlotProposals(proposals, baseOffset, 0);
-				proposals.add(new CompletionProposal(""+type,baseOffset,0,0));
+				if (currentPrototype != null) {
+					currentPrototype.getSlotProposals(proposals, baseOffset, 0);
+					proposals.add(new CompletionProposal(""+type,baseOffset,0,0));
+				} else {
+					// partial prototype name
+					String prefix = type.toString();
+					model.getPathManager().getPathMatch(prefix, proposals, baseOffset);
+				}
 			} else {
 				// partial slot name (first keyword)
 				if (code instanceof ITMRead) {
@@ -126,7 +133,7 @@ public class LisaacCompletionParser extends LisaacParser {
 			type = code.getType(currentSlot, currentPrototype);
 			if (type != null) {
 				//if (! type.equals(TypeSimple.getTypeSelf())) {
-				if ("SELF".compareTo(type.toString()) != 0) {
+				if (type.toString() != null && "SELF".compareTo(type.toString()) != 0) {
 					Prototype save = currentPrototype;
 					currentPrototype = findPrototype(type.toString());
 					if (currentPrototype == null) {
diff --git a/src/org/eclipse/lisaac/model/LisaacPath.java b/src/org/eclipse/lisaac/model/LisaacPath.java
index 3bd79de..116b305 100644
--- a/src/org/eclipse/lisaac/model/LisaacPath.java
+++ b/src/org/eclipse/lisaac/model/LisaacPath.java
@@ -1,85 +1,108 @@
-package org.eclipse.lisaac.model;
-
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.lisaac.LisaacPlugin;
-import org.eclipse.lisaac.launch.LisaacCompiler;
-import org.eclipse.swt.widgets.Display;
-
-
-public class LisaacPath {
-
-	private HashMap<String,String> prototypesPath;
-
-	private LisaacCompiler compiler;
-
-	public LisaacPath(final IProject project, String lipFile) {
-		prototypesPath = new HashMap<String,String>();
-
-		compiler = new LisaacCompiler("", lipFile);
-		compiler.addOption("--p");
-		try {
-			final Process process = compiler.launch(project, new NullProgressMonitor());
-			if (process != null) {
-
-				Runnable getPathFile = new Runnable() {
-					public void run() {
-						try {
-							// wait for end of process
-							process.waitFor();
-							
-							BufferedReader bufferIn = new BufferedReader(
-									new InputStreamReader( 
-											new FileInputStream(project.getLocation()+"/src/current_path.txt")));
-							
-							String line;
-							while ((line = bufferIn.readLine()) != null) {
-								createPath(line);
-							}
-							bufferIn.close();
-						} catch (FileNotFoundException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						} catch (InterruptedException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						} catch (IOException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}
-				};	
-				// execute action in a new thread UI safe
-				Display.getDefault().asyncExec(getPathFile);
-				//Thread runCommand = new Thread(getStandardOutput);
-				//runCommand.start();
-			}
-		} catch (CoreException e) {
-			//LisaacPlugin.log(status) // TODO log error
-			e.printStackTrace();
-		}
-	}
-
-	public String getFullPath(String prototypeName) {
-		if (prototypesPath.containsKey(prototypeName)) {
-			return prototypesPath.get(prototypeName);
-		}
-		return null;
-	}
-
-	private void createPath(String fullPath) {
-		int index = fullPath.lastIndexOf("/");
-		String prototypeName = fullPath.substring(index+1);
-		index = prototypeName.lastIndexOf(".");
-		prototypeName = prototypeName.substring(0, index).toUpperCase();
-		prototypesPath.put(prototypeName, fullPath);
-	}
-}
+package org.eclipse.lisaac.model;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.text.contentassist.CompletionProposal;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.lisaac.LisaacPlugin;
+import org.eclipse.lisaac.launch.LisaacCompiler;
+import org.eclipse.lisaac.model.items.Slot;
+import org.eclipse.lisaac.outline.OutlineImages;
+import org.eclipse.swt.widgets.Display;
+
+
+public class LisaacPath {
+
+	private HashMap<String,String> prototypesPath;
+
+	private LisaacCompiler compiler;
+
+	public LisaacPath(final IProject project, String lipFile) {
+		prototypesPath = new HashMap<String,String>();
+
+		compiler = new LisaacCompiler("", lipFile);
+		compiler.addOption("--p");
+		try {
+			final Process process = compiler.launch(project, new NullProgressMonitor());
+			if (process != null) {
+
+				Runnable getPathFile = new Runnable() {
+					public void run() {
+						try {
+							// wait for end of process
+							process.waitFor();
+							
+							BufferedReader bufferIn = new BufferedReader(
+									new InputStreamReader( 
+											new FileInputStream(project.getLocation()+"/src/current_path.txt")));
+							
+							String line;
+							while ((line = bufferIn.readLine()) != null) {
+								createPath(line);
+							}
+							bufferIn.close();
+						} catch (FileNotFoundException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						} catch (InterruptedException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						} catch (IOException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						}
+					}
+				};	
+				// execute action in a new thread UI safe
+				Display.getDefault().asyncExec(getPathFile);
+				//Thread runCommand = new Thread(getStandardOutput);
+				//runCommand.start();
+			}
+		} catch (CoreException e) {
+			//LisaacPlugin.log(status) // TODO log error
+			e.printStackTrace();
+		}
+	}
+
+	public String getFullPath(String prototypeName) {
+		if (prototypesPath.containsKey(prototypeName)) {
+			return prototypesPath.get(prototypeName);
+		}
+		return null;
+	}
+
+	private void createPath(String fullPath) {
+		int index = fullPath.lastIndexOf("/");
+		String prototypeName = fullPath.substring(index+1);
+		index = prototypeName.lastIndexOf(".");
+		prototypeName = prototypeName.substring(0, index).toUpperCase();
+		prototypesPath.put(prototypeName, fullPath);
+	}
+
+	public void getPathMatch(String prefix,
+			ArrayList<ICompletionProposal> proposals, int baseOffset) {
+		
+		Collection<String> values = prototypesPath.keySet();
+		Iterator<String> it = values.iterator() ;
+		while (it.hasNext()) {
+			String name = it.next();
+			if (name.startsWith(prefix)) {
+				int lenPrefix = prefix.length();
+				int lenName = name.length();
+				proposals.add(new CompletionProposal(name, baseOffset-lenPrefix, lenPrefix, lenName,
+						OutlineImages.PROTOTYPE, name, null, null));
+			}
+		}
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/Position.java b/src/org/eclipse/lisaac/model/Position.java
index 8ea2432..1706b12 100644
--- a/src/org/eclipse/lisaac/model/Position.java
+++ b/src/org/eclipse/lisaac/model/Position.java
@@ -1,52 +1,52 @@
-package org.eclipse.lisaac.model;
-
-public class Position {
-	public int line;
-	public int column;
-	public int offset;
-	public int length;
-	
-	public Position(int line, int column, int offset) {
-		super();
-		this.line = line;
-		this.column = column;
-		this.offset = offset;
-		length = 0;
-	}
-	public Position(int line, int column, int offset, int len) {
-		super();
-		this.line = line;
-		this.column = column;
-		this.offset = offset;
-		length = len;
-	}
-
-	public int getLine() {
-		return line;
-	}
-	public int getColumn() {
-		return column;
-	}
-	
-	public boolean hasRange() {
-		return length != 0;
-	}
-	
-	public int getCharStart() {
-		return column;
-	}
-	public int getCharEnd() {
-		return column+length;
-	}
-	
-	public int getStartOffset() {
-		return offset;
-	}
-	
-	public int length() {
-		return length;
-	}
-	public void setLength(int l) {
-		length = l;
-	}
-}
+package org.eclipse.lisaac.model;
+
+public class Position {
+	public int line;
+	public int column;
+	public int offset;
+	public int length;
+	
+	public Position(int line, int column, int offset) {
+		super();
+		this.line = line;
+		this.column = column;
+		this.offset = offset;
+		length = 0;
+	}
+	public Position(int line, int column, int offset, int len) {
+		super();
+		this.line = line;
+		this.column = column;
+		this.offset = offset;
+		length = len;
+	}
+
+	public int getLine() {
+		return line;
+	}
+	public int getColumn() {
+		return column;
+	}
+	
+	public boolean hasRange() {
+		return length != 0;
+	}
+	
+	public int getCharStart() {
+		return offset-length;
+	}
+	public int getCharEnd() {
+		return offset;
+	}
+	
+	public int getStartOffset() {
+		return offset;
+	}
+	
+	public int length() {
+		return length;
+	}
+	public void setLength(int l) {
+		length = l;
+	}
+}
diff --git a/src/org/eclipse/lisaac/model/SectionContext.java b/src/org/eclipse/lisaac/model/SectionContext.java
index 66e6af7..b0d85d2 100644
--- a/src/org/eclipse/lisaac/model/SectionContext.java
+++ b/src/org/eclipse/lisaac/model/SectionContext.java
@@ -120,7 +120,8 @@ public class SectionContext implements ILisaacContext {
 							return false;
 						}
 						if (parser.getLastString().compareTo(prototype.getName()) != 0) {
-							parser.getReporter().syntaxError("Incorrect name (filename != name).", parser.getPosition());
+							int len = parser.getLastString().length();
+							parser.getReporter().syntaxError("Incorrect name (filename != name).", parser.getPosition(len));
 						}
 
 						boolean version013 = LisaacPlugin.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.P_LISAAC_013_COMPATIBILITY);
diff --git a/src/org/eclipse/lisaac/model/items/ITMArgs.java b/src/org/eclipse/lisaac/model/items/ITMArgs.java
index cc52714..3a16599 100644
--- a/src/org/eclipse/lisaac/model/items/ITMArgs.java
+++ b/src/org/eclipse/lisaac/model/items/ITMArgs.java
@@ -60,9 +60,9 @@ public class ITMArgs implements IArgument {
 		buffer.append("(");
 		for (int i=0; i<name.length; i++) {
 			IType subType = type.getSubType(i);
-			buffer.append("<b>"+name[i]+"</b>");
+			buffer.append(name[i]);
 			buffer.append(" : ");
-			buffer.append("<g>"+subType+"</g>");
+			buffer.append(subType);
 			
 			if (i != name.length-1) {
 				buffer.append(", ");
@@ -74,7 +74,18 @@ public class ITMArgs implements IArgument {
 	public String getHoverInformation() {
 		StringBuffer buffer = new StringBuffer();
 		buffer.append("<I>Arguments</I> : ");
-		printIn(buffer);
+		buffer.append("(");
+		for (int i=0; i<name.length; i++) {
+			IType subType = type.getSubType(i);
+			buffer.append("<b>"+name[i]+"</b>");
+			buffer.append(" : ");
+			buffer.append("<g>"+subType+"</g>");
+			
+			if (i != name.length-1) {
+				buffer.append(", ");
+			}
+		}
+		buffer.append(")");
 		
 		return buffer.toString();
 	}
diff --git a/src/org/eclipse/lisaac/model/items/Prototype.java b/src/org/eclipse/lisaac/model/items/Prototype.java
index 13a2463..018803e 100644
--- a/src/org/eclipse/lisaac/model/items/Prototype.java
+++ b/src/org/eclipse/lisaac/model/items/Prototype.java
@@ -261,18 +261,18 @@ public class Prototype {
 			// find beginning of SEND_MSG grammar rule
 			//
 
-			// Rewind to '('  ';' '[' '.'
+			// Rewind to '('  '{' ';' '[' '.'
 			c = source.charAt(offset);
 			if (c == ';' || c == '.') {
 				break;
 			}
-			if (c == '(' || c == '[') {
+			if (c == '(' || c == '{' || c == '[') {
 				if (bracketLevel == 0) {
 					break;
 				}
 				bracketLevel--;
 			}
-			if (c == ')' || c == ']') {
+			if (c == ')' || c == '}' || c == ']') {
 				bracketLevel++;
 			}
 
@@ -329,19 +329,19 @@ public class Prototype {
 				offset--;
 				bracketLevel = 0;
 
-				// rewind until ';' '(' '['
+				// rewind until ';' '(' '{' '['
 				while (offset > 0) {
 					c = source.charAt(offset);
 					if (c == ';') {
 						break;
 					}
-					if (c == '(' || c == '[') {
+					if (c == '(' || c == '{' || c == '[') {
 						if (bracketLevel == 0) {
 							break;
 						}
 						bracketLevel--;
 					}
-					if (c == ')' || c == ']') {
+					if (c == ')' || c == '}' || c == ']') {
 						bracketLevel++;
 					}
 					offset--;
diff --git a/src/org/eclipse/lisaac/model/items/Slot.java b/src/org/eclipse/lisaac/model/items/Slot.java
index fe38a6a..45784ef 100644
--- a/src/org/eclipse/lisaac/model/items/Slot.java
+++ b/src/org/eclipse/lisaac/model/items/Slot.java
@@ -29,7 +29,7 @@ public class Slot  {
 	protected ArrayList<ICode> subLists;
 
 	protected String comment;
-	
+
 
 	public Slot(Position position, String name, Section sectionId) {
 		this.name = name;
@@ -75,7 +75,7 @@ public class Slot  {
 	public void setComment(String comment) {
 		this.comment = comment;
 	}
-	
+
 	public void setAffect(char affect) {
 		this.affect = affect;
 	}
@@ -166,7 +166,7 @@ public class Slot  {
 	public boolean hasVariableDefinition(String word, int offset) {
 		return getVariableDefinition(word, offset) != null;
 	}
-	
+
 	public IVariable getVariableDefinition(String word, int offset) {
 		ITMList list;
 
@@ -209,7 +209,64 @@ public class Slot  {
 		return sectionId.getPrototype();
 	}
 
+	private String getOperatorName() {
+		String s = name.substring(2);
+		StringBuffer result = new StringBuffer("'");
+		int index;
+		do {
+			index = s.indexOf("_");
+			s = s.substring(index+1);
+			if (index != -1) {
+				if (s.startsWith("add")) {
+					result.append('+');
+				} else if (s.startsWith("sub")) {
+					result.append('-');
+				} else if (s.startsWith("logicnot")) {
+					result.append('~');
+				} else if (s.startsWith("not")) {
+					result.append('!');
+				} else if (s.startsWith("div")) {
+					result.append('/');
+				} else if (s.startsWith("mul")) {
+					result.append('*');
+				} else if (s.startsWith("xor")) {
+					result.append('^');
+				} else if (s.startsWith("mod")) {
+					result.append('%');
+				} else if (s.startsWith("greater")) {
+					result.append('>');
+				} else if (s.startsWith("less")) {
+					result.append('<');
+				} else if (s.startsWith("equal")) {
+					result.append('=');
+				} else if (s.startsWith("notdiv")) {
+					result.append('\\');
+				} else if (s.startsWith("or")) {
+					result.append('|');
+				} else if (s.startsWith("and")) {
+					result.append('&');
+				} else if (s.startsWith("dollar")) {
+					result.append('$');
+				} else if (s.startsWith("diese")) {
+					result.append('#');
+				} else if (s.startsWith("at")) {
+					result.append('@');
+				} else if (s.startsWith("ask")) {
+					result.append('?');
+				}
+			}
+		} while(index != -1);
+		
+		result.append('\'');
+		return result.toString();
+	}
+
 	public String getSignature(boolean isCall) {
+
+		if (name.startsWith("__")) {
+			return getOperatorName();
+		}
+
 		if (keywordList == null || keywordList.length < 1) {
 			return name;
 		}
diff --git a/src/org/eclipse/lisaac/model/types/TypeSimple.java b/src/org/eclipse/lisaac/model/types/TypeSimple.java
index 0ba03ee..b61d62b 100644
--- a/src/org/eclipse/lisaac/model/types/TypeSimple.java
+++ b/src/org/eclipse/lisaac/model/types/TypeSimple.java
@@ -60,8 +60,8 @@ public class TypeSimple implements ITypeMono {
 		return typeBoolean;
 	}
 	
-	public String toString() {
-		if (this.equals(typeVoid)) {
+	public String toString() {        // FIXME VOID pb
+		if (this.equals(typeVoid) || name.compareTo("VOID") == 0) {
 			return null; // do not print void type
 		}
 		return name;
diff --git a/src/org/eclipse/lisaac/outline/OutlineSlot.java b/src/org/eclipse/lisaac/outline/OutlineSlot.java
index b91c8e1..b46355e 100644
--- a/src/org/eclipse/lisaac/outline/OutlineSlot.java
+++ b/src/org/eclipse/lisaac/outline/OutlineSlot.java
@@ -27,7 +27,7 @@ public class OutlineSlot extends OutlineItem {
 	public String getText() {
 		String result=null;
 		if (slot != null) {
-			result = slot.getName();
+			result = slot.getSignature(false);
 			IType t = slot.getResultType();
 			if (t != null && t.toString() != null) {
 				result += " : " + t;// TODO resut type in italics

-- 
Lisaac eclipse plugin



More information about the Lisaac-commits mailing list