예제 #1
0
 public void partClosed(org.eclipse.ui.IWorkbenchPartReference partRef) {
   if (partRef.isDirty()) {
     return;
   }
   org.eclipse.ui.IWorkbenchPart workbenchPart = partRef.getPart(false);
   if (workbenchPart
       instanceof
       edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelEditor) {
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelEditor editor =
         (edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelEditor)
             workbenchPart;
     org.eclipse.emf.ecore.resource.Resource editorResource = editor.getResource();
     if (editorResource == null) {
       return;
     }
     String uri = editorResource.getURI().toString();
     org.eclipse.emf.ecore.resource.Resource thisEditorResource = this.editor.getResource();
     org.eclipse.emf.common.util.URI thisEditorResourceURI = thisEditorResource.getURI();
     if (uri.equals(thisEditorResourceURI.toString())) {
       saveCodeFoldingStateFile(uri);
       editor.getSite().getPage().removePartListener(this);
     }
   }
 }
예제 #2
0
 private void addCloseListener(
     final edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelEditor editor) {
   editor.getSite().getPage().addPartListener(new EditorOnCloseListener(editor));
   editor.addBackgroundParsingListener(new FoldingUpdateListener());
 }