if (myEditor != null && myRelationshipPath != null) { EOModel model = myEditor.getModel(); if (model != null) { EOEntity rootEntity = myRelationshipPath.getRootEntity(); String flattenedRelationship = myRelationshipPath.toKeyPath(); String flattenedRelationshipName = flattenedRelationship.replace('.', '_'); EORelationship newRelationship = rootEntity.addBlankRelationship(flattenedRelationshipName, flattenedRelationship); myEditor.setSelection(new StructuredSelection(newRelationship)); }
if (myRelationshipPath != null) { EOEntity rootEntity = myRelationshipPath.getRootEntity(); String flattenedRelationship = myRelationshipPath.toKeyPath(); String flattenedRelationshipName = flattenedRelationship.replace('.', '_'); EORelationship newRelationship = rootEntity.addBlankRelationship(flattenedRelationshipName, flattenedRelationship); } else { MessageDialog.openError(myWindow.getShell(), Messages.getString("EORelationship.noRelationshipSelectedTitle"), Messages.getString("EORelationship.noRelationshipSelectedMessage"));
  public void run(IAction _action) {    try {      if (myEditor != null && myRelationshipPath != null) {        EOModel model = myEditor.getModel();        if (model != null) {          EOEntity rootEntity = myRelationshipPath.getRootEntity();          String flattenedRelationship = myRelationshipPath.toKeyPath();          String flattenedRelationshipName = flattenedRelationship.replace('.', '_');          EORelationship newRelationship = rootEntity.addBlankRelationship(flattenedRelationshipName, flattenedRelationship); //$NON-NLS-1$          myEditor.setSelection(new StructuredSelection(newRelationship));        }      }    }    catch (DuplicateRelationshipNameException e) {      // TODO Auto-generated catch block      e.printStackTrace();    }  }