\r
@Override\r
public void partClosed(IWorkbenchPartReference partRef) {\r
+ if(partRef.getPart(false) instanceof SysdynDiagramEditor) {\r
+ if(((SysdynDiagramEditor)partRef.getPart(false)).equals(editor)) {\r
+ initializeFields(null);\r
+ }\r
+ }\r
}\r
\r
@Override\r
this.editor = editor;\r
} else if(PlatformUI.getWorkbench().getActiveWorkbenchWindow()\r
.getActivePage().getActiveEditor() instanceof SysdynDiagramEditor) {\r
- editor = (SysdynDiagramEditor)PlatformUI.getWorkbench()\r
+ this.editor = (SysdynDiagramEditor)PlatformUI.getWorkbench()\r
.getActiveWorkbenchWindow().getActivePage().getActiveEditor();\r
+ } else {\r
+ this.editor = null;\r
}\r
}\r
\r
updateMapping();\r
if(mapping != null)\r
setFields((Configuration)mapping.get(editor.getResourceInput().getResource()));\r
+ else \r
+ emptyFields();\r
}\r
\r
+ private void emptyFields() {\r
+ name.setText("");\r
+ name.setEnabled(false);\r
+ startTime.setText("");\r
+ startTime.setEnabled(false);\r
+ stopTime.setText("");\r
+ stopTime.setEnabled(false);\r
+ }\r
private void setFields(Configuration conf) {\r
\r
if(editor != null && mapping != null) { \r
originalName = conf.name;\r
name.setText(originalName);\r
+ name.setEnabled(true);\r
originalStart = conf.startTime.toString();\r
startTime.setText(originalStart);\r
+ startTime.setEnabled(true);\r
originalStop = conf.stopTime.toString();\r
stopTime.setText(originalStop);\r
+ stopTime.setEnabled(true);\r
setPartName(conf.name);\r
}\r
\r
\r
};\r
mapping.addMappingListener(mappingListener);\r
+ } else {\r
+ mapping = null;\r
}\r
}\r
}\r
import org.eclipse.jface.dialogs.MessageDialog;\r
import org.eclipse.jface.viewers.ISelection;\r
import org.eclipse.swt.widgets.Shell;\r
+import org.eclipse.ui.IEditorReference;\r
+import org.eclipse.ui.PlatformUI;\r
import org.eclipse.ui.handlers.HandlerUtil;\r
import org.simantics.db.Builtins;\r
import org.simantics.db.Resource;\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.exception.CancelTransactionException;\r
import org.simantics.db.exception.DatabaseException;\r
+import org.simantics.sysdyn.ui.editor.SysdynDiagramEditor;\r
import org.simantics.ui.SimanticsUI;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
import org.simantics.utils.ui.ExceptionUtils;\r
} catch (DatabaseException e) {\r
ExceptionUtils.logAndShowError(e);\r
}\r
+\r
+ for (Resource r : resources) {\r
+ IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();\r
+ for(IEditorReference er : editorReferences) {\r
+ if(er.getEditor(false) instanceof SysdynDiagramEditor) {\r
+ SysdynDiagramEditor editor = (SysdynDiagramEditor)er.getEditor(false);\r
+ if(editor.getResourceInput().getResource().equals(r)) {\r
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeEditor(editor, false);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
}\r
\r
}
\ No newline at end of file