Esempio n. 1
0
  /** {@inheritDoc} */
  public void doSave(IProgressMonitor monitor) {
    monitor.beginTask(Messages.EditorsSaveEditors, IProgressMonitor.UNKNOWN);
    try {
      EditSupport editSupport = getEditorHelper().getEditSupport();
      final IPersistentObject perObj = editSupport.getWorkVersion();
      TimestampBP.refreshTimestamp((ITimestampPO) perObj);
      editSupport.saveWorkVersion();

      getEditorHelper().resetEditableState();
      getEditorHelper().setDirty(false);
    } catch (IncompatibleTypeException pmce) {
      handlePMCompNameException(pmce);
    } catch (PMException e) {
      PMExceptionHandler.handlePMExceptionForMasterSession(e);
      try {
        reOpenEditor(((NodeEditorInput) getEditorInput()).getNode());
      } catch (PMException e1) {
        PMExceptionHandler.handlePMExceptionForEditor(e, this);
      }
    } catch (ProjectDeletedException e) {
      PMExceptionHandler.handleProjectDeletedException();
    } finally {
      monitor.done();
    }
  }
  /**
   * @param nodes the nodes to delete
   * @param editor the editor to perform the deletion for
   */
  public static void deleteNodesFromEditor(List<? extends INodePO> nodes, AbstractJBEditor editor) {
    editor.getEditorHelper().getClipboard().clearContents();
    EditSupport supp = editor.getEditorHelper().getEditSupport();
    IWritableComponentNameCache localCache = supp.getCache();
    for (INodePO node : nodes) {
      deleteNode(node, editor.getEntityManager());
    }

    editor.getEditorHelper().setDirty(true);
    CalcTypes calc = new CalcTypes(localCache, (INodePO) supp.getWorkVersion());
    calc.calculateTypes();
    localCache.storeLocalProblems(calc);
  }