コード例 #1
0
  @Override
  public void widgetSelected(SelectionEvent e) {

    String formType = "/Model_Type/";
    String args = "?";
    int i = 1;

    if (modelType.getName() != null) args = args + "name=" + modelType.getName();
    if (modelType.getSupertype() != null)
      args = args + "&supertype=" + modelType.getSupertype().getName();

    if (modelType instanceof ModelRel) {
      formType = "/Relationship_Type/";

      ModelRel modelRelType = (ModelRel) modelType;

      if (!modelRelType.getModelEndpoints().isEmpty()) args = args + "&arguments=";

      for (ModelEndpoint modelEndpoint : modelRelType.getModelEndpoints()) {
        if (i != 1) args = args + ", ";
        args = args + modelEndpoint.getName() + ";" + modelEndpoint.getTarget().getName();
        i++;
      }
    }

    IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
    String url = WIKI_WWW + formType + modelType.getName() + args;
    try {
      IWebBrowser browser = support.createBrowser("MMINT Wiki");
      browser.openURL(new URL(url));
    } catch (Exception ex) {
      MMINTException.print(IStatus.ERROR, "Error opening wiki page " + url, ex);
    }
  }
コード例 #2
0
ファイル: KleisliModelImpl.java プロジェクト: ppourali/MMINT
  /**
   * Gets the uri of a Kleisli model type extension.
   *
   * @param modelRelType The Kleisli model relationship.
   * @param modelType The model type to be extended.
   * @param modelTypeEndpointName The name of the Kleisli model type endpoint whose target is to be
   *     extended.
   * @return The uri of the Kleisli model type extension.
   * @generated NOT
   */
  public static String getModelTypeExtendedUri(
      KleisliModelRel modelRelType, Model modelType, String modelTypeEndpointName) {

    return modelRelType.getExtendedUri()
        + MMINT.URI_SEPARATOR
        + modelTypeEndpointName
        + MMINT.ENDPOINT_SEPARATOR
        + modelType.getName()
        + "."
        + EcorePackage.eNAME;
  }
コード例 #3
0
ファイル: KleisliModelImpl.java プロジェクト: ppourali/MMINT
  /** @generated NOT */
  public KleisliModel kleisliCreateInstance(KleisliModelEndpoint containerModelEndpoint)
      throws MMINTException {

    if (MultiModelConstraintChecker.isInstancesLevel(this)) {
      throw new MMINTException("Can't execute TYPES level operation on INSTANCES level element");
    }

    Model origModel = containerModelEndpoint.getTarget();
    KleisliModel kModel = KleisliFactory.eINSTANCE.createKleisliModel();
    kModel.setUri(getModelExtendedUri(containerModelEndpoint));
    kModel.setName(origModel.getName());
    kModel.setLevel(MIDLevel.INSTANCES);
    kModel.setDynamic(true);
    kModel.setSupertype(null);
    kModel.setMetatypeUri(origModel.getMetatypeUri());
    kModel.setOrigin(ModelOrigin.CREATED);
    kModel.setFileExtension(origModel.getFileExtension());
    containerModelEndpoint.setExtendedTarget(kModel);

    return kModel;
  }
コード例 #4
0
ファイル: KleisliModelImpl.java プロジェクト: ppourali/MMINT
  /** @generated NOT */
  public KleisliModel kleisliCreateType(KleisliModelEndpoint containerModelTypeEndpoint)
      throws MMINTException {

    // TODO MMINT[KLEISLI] should try to emulate normal api structure
    if (MultiModelConstraintChecker.isInstancesLevel(this)) {
      throw new MMINTException("Can't execute TYPES level operation on INSTANCES level element");
    }

    Model origModelType = containerModelTypeEndpoint.getTarget();
    String kModelTypeUri =
        getModelTypeExtendedUri(
            (KleisliModelRel) containerModelTypeEndpoint.eContainer(),
            origModelType,
            containerModelTypeEndpoint.getName());
    if (!MultiModelUtils.isFileOrDirectoryInState(kModelTypeUri)) {
      try {
        EPackage origRootModelTypeObj = origModelType.getEMFTypeRoot();
        String origModelTypeUri = origRootModelTypeObj.getNsURI();
        origRootModelTypeObj.setNsURI(
            origModelTypeUri + KleisliReasoningEngine.KLEISLI_MODELTYPE_URI_SUFFIX);
        MultiModelUtils.createModelFileInState(origRootModelTypeObj, kModelTypeUri);
        origRootModelTypeObj.setNsURI(
            origModelTypeUri); // restore original for packages coming from the registry
      } catch (Exception e) {
        throw new MMINTException("Error creating extended metamodel file");
      }
    }

    KleisliModel kModelType = KleisliFactory.eINSTANCE.createKleisliModel();
    kModelType.setUri(kModelTypeUri);
    kModelType.setName(origModelType.getName());
    kModelType.setLevel(MIDLevel.TYPES);
    kModelType.setSupertype(origModelType.getSupertype());
    kModelType.setDynamic(true);
    kModelType.setAbstract(origModelType.isAbstract());
    ExtendibleElementConstraint origConstraint = origModelType.getConstraint();
    if (origConstraint != null) {
      ExtendibleElementConstraint kConstraint =
          MIDFactory.eINSTANCE.createExtendibleElementConstraint();
      kConstraint.setLanguage(origConstraint.getLanguage());
      kConstraint.setImplementation(origConstraint.getImplementation());
      kModelType.setConstraint(kConstraint);
    }
    kModelType.setOrigin(ModelOrigin.CREATED);
    kModelType.setFileExtension(origModelType.getFileExtension());
    containerModelTypeEndpoint.setExtendedTarget(kModelType);

    return kModelType;
  }