import org.eclipse.swt.SWT;\r
import org.eclipse.swt.custom.StyledText;\r
import org.eclipse.swt.custom.VerifyKeyListener;\r
-import org.eclipse.swt.events.FocusEvent;\r
-import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.ModifyEvent;\r
import org.eclipse.swt.events.ModifyListener;\r
import org.eclipse.swt.events.MouseEvent;\r
}\r
\r
});\r
- \r
- /*\r
- * Shortcut tab widget should not maintain any selections for visual reasons\r
- */\r
- shortcutTabWidget.addFocusListener(new FocusListener() {\r
-\r
- @Override\r
- public void focusGained(FocusEvent e) { \r
- }\r
-\r
- @Override\r
- public void focusLost(FocusEvent e) {\r
- ((Table)e.widget).deselectAll();\r
- }\r
-\r
- });\r
\r
/* Modifying an expression sets a timed validation. The timer is\r
* reset after each modification \r
GridLayoutFactory.fillDefaults().applyTo(tabFolder);\r
variables = new TabItem(tabFolder, SWT.NULL);\r
variables.setText("Variables");\r
- variableTable = new Table (tabFolder, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);\r
-\r
+ variableTable = new Table (tabFolder, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.NO_FOCUS | SWT.HIDE_SELECTION);\r
+ \r
variables.setControl(variableTable);\r
\r
functions = new TabItem(tabFolder, SWT.NULL);\r
functions.setText("Functions"); \r
\r
- functionTable = new Table (tabFolder, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);\r
+ functionTable = new Table (tabFolder, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.NO_FOCUS | SWT.HIDE_SELECTION);\r
TableItem item = new TableItem(functionTable, SWT.NONE);\r
\r
//Finding functions\r
@Override\r
public void setInput(ISessionContext context, Object input) {\r
if(input instanceof IStructuredSelection) {\r
- final Resource variable = ISelectionUtils.filterSingleSelection((IStructuredSelection)input, Resource.class);\r
+ final Resource variable = ISelectionUtils.filterSingleSelection(input, Resource.class);\r
if(variable != null) {\r
\r
SimanticsUI.getSession().asyncRequest(new Read<HashSet<String>>() {\r
}\r
}\r
\r
+ // Add the time variable\r
+ item = new TableItem(variableTable, SWT.NONE);\r
+ item.setText("time");\r
+ item.setData("time");\r
+ \r
synchronized(dependencyListeners) {\r
for(Runnable listener : dependencyListeners)\r
listener.run();\r
* variables inside modules.\r
* \r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
public class AllVariablesOfModel implements IAllVariablesOfModel{\r
\r
- private Resource model;\r
+ private final Resource model;\r
\r
public AllVariablesOfModel(Resource model) {\r
this.model = model;\r
} \r
\r
\r
- public String getVariablesLabel(ReadGraph graph, String variableId)\r
+ @Override\r
+ public String getVariablesLabel(ReadGraph graph, String variableId)\r
throws DatabaseException {\r
return variableId.substring(1).replace('/', '.');\r
}\r
ReadConfiguration(graph, conf, "", result);\r
\r
// Add time to the variable list\r
- result.add(new ChartVariable("time"));\r
+ result.add(new ChartVariable("time", "time"));\r
\r
// Finally sort the results\r
Collections.sort(result, AlphanumComparator.CASE_INSENSITIVE_COMPARATOR);\r
if(parsingSucceeded && variableTable != null && !variableTable.isDisposed()) {\r
TableItem[] connectedVariables = variableTable.getItems();\r
for(TableItem ti : connectedVariables) {\r
- if(!variables.contains(ti.getText())) {\r
+ if (ti.getText().equals("time")) {\r
+ ti.setForeground(new Color(ti.getDisplay(), 127,127,127));\r
+ } else if (!variables.contains(ti.getText())) {\r
ti.setForeground(new Color(ti.getDisplay(), 255,125,0));\r
} else {\r
ti.setForeground(new Color(ti.getDisplay(), 0, 0, 0));\r
/**\r
* Class for containing errors caught in expression validation\r
* @author Teemu Lempinen\r
+ * @author Tuomas Miettinen\r
*\r
*/\r
public class SyntaxError {\r
try {\r
start = document.getLineOffset(beginLine - 1) + beginColumn - 1;\r
} catch (BadLocationException e) {\r
- e.printStackTrace();\r
+ //e.printStackTrace();\r
}\r
}\r
return start;\r
try {\r
offset = document.getLineOffset(endLine - 1) + endColumn - start;\r
} catch (BadLocationException e) {\r
- e.printStackTrace();\r
+ //e.printStackTrace();\r
}\r
}\r
return offset;\r