\r
@UpdateMethod\r
boolean readHasExpression(ReadGraph g, Resource resource) {\r
- try {\r
- System.out.println("readHasExpression " +\r
- g.getRelatedValue(resource, \r
- g.getBuiltins().HasName));\r
- } catch (DatabaseException e1) {\r
- // TODO Auto-generated catch block\r
- e1.printStackTrace();\r
- }\r
SysdynResource sr = SysdynResource.getInstance(g);\r
try {\r
hasEquation = \r
\r
import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.text.BadLocationException;\r
+import org.eclipse.jface.text.IDocument;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.events.FocusAdapter;\r
import org.eclipse.swt.events.FocusEvent;\r
\r
@Override\r
public void focusLost(FocusEvent e) {\r
- lastSelection = expression.getSelection(); \r
+ lastSelection = expression.getSelection();\r
}\r
});\r
\r
\r
@Override\r
public void replaceSelection(String var) {\r
- if(this.expression != null) {\r
- String oldExpression = expression.getExpression();\r
- if(lastSelection == null)\r
- lastSelection = new Point(0,0);\r
+ if(expression != null) {\r
+ IDocument doc = expression.getDocument();\r
+ try {\r
+ Point selection = expression.getSelection();\r
+ doc.replace(selection.x, selection.y, var);\r
+ } catch (BadLocationException e) {\r
+ // TODO Auto-generated catch block\r
+ e.printStackTrace();\r
+ }\r
+ \r
+ /*String oldExpression = expression.getExpression();\r
+ System.out.println("lastSelection = " + lastSelection);\r
+ \r
String newExpression = oldExpression.substring(0, lastSelection.x) + var + oldExpression.substring(lastSelection.y);\r
expression.setExpression(newExpression);\r
expression.setSelection(lastSelection.x + var.length());\r
+ */\r
}\r
}\r
\r