Esempio n. 1
0
  /**
   * Handles a PO that has been modified.
   *
   * @param po The modified object.
   * @return <code>false</code> if an error occurs during handling. Otherwise, <code>true</code>.
   */
  private boolean handleStructureModified(IPersistentObject po) {
    if (po instanceof ITestSuitePO) {
      final ITestSuitePO testsuitePO = (ITestSuitePO) po;
      final INodePO workVersion = (INodePO) getEditorHelper().getEditSupport().getWorkVersion();
      final List<IRefTestSuitePO> refTestSuites =
          NodePM.getInternalRefTestSuites(testsuitePO.getGuid(), testsuitePO.getParentProjectId());
      if (!refTestSuites.isEmpty() && containsWorkVersionReuses(workVersion, testsuitePO)) {
        if (Plugin.getActiveEditor() != this && isDirty()) {
          ErrorHandlingUtil.createMessageDialog(
              MessageIDs.I_SAVE_AND_REOPEN_EDITOR,
              new Object[] {getTitle(), testsuitePO.getName()},
              null);
          return false;
        }
        try {
          reOpenEditor(getEditorHelper().getEditSupport().getOriginal());
        } catch (PMException e) {
          ErrorHandlingUtil.createMessageDialog(
              MessageIDs.E_REFRESH_FAILED, null, new String[] {Messages.ErrorMessageEDITOR_CLOSE});
          getSite().getPage().closeEditor(this, false);
        }
        return false;
      }
    }

    return true;
  }
 /** {@inheritDoc} */
 public void run(IMarker marker) {
   INodePO node = NodePM.getNode(GeneralStorage.getInstance().getProject().getId(), m_nodeGUID);
   if (node != null) {
     while (!(NodeBP.isEditable(node)
         && (node instanceof ITestSuitePO
             || node instanceof ITestJobPO
             || node instanceof ISpecTestCasePO))) {
       node = node.getParentNode();
     }
     AbstractOpenHandler.openEditor(node);
   }
 }