- combo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- final int id = combo.getSelectionIndex();
- Simantics.getSession().asyncRequest(new WriteRequest() {
- @Override
- public void perform(WriteGraph graph)
- throws DatabaseException {
- StructuralResource2 STR = StructuralResource2.getInstance(graph);
- String currentType = graph.getPossibleRelatedValue(script, STR.ComponentTypeScript_type);
- String newType = EXECUTION_PHASES[id];
- if(!newType.equals(currentType))
- graph.claimLiteral(script, STR.ComponentTypeScript_type, newType, Bindings.STRING);
- }
- });
+ combo.addSelectionListener(org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter(e -> {
+ int id = combo.getSelectionIndex();
+ if (id == scriptTypeIndex)
+ return;
+ if (docProvider.isReadOnly(getEditorInput())) {
+ // Return configured selection
+ combo.select(scriptTypeIndex);
+ return;