コード例 #1
0
 /** @return the diagram. */
 protected Diagram getDiagram() {
   IDiagramTypeProvider diagramTypeProvider = getDiagramTypeProvider();
   if (diagramTypeProvider == null) {
     return null;
   }
   return diagramTypeProvider.getDiagram();
 }
コード例 #2
0
  protected KickstartFormMemoryModel ensureKickstartFormMemoryModel() {
    if (diagramTypeProvider.getDiagram() == null) {
      throw new IllegalStateException("No diagram is currently active");
    }

    KickstartFormMemoryModel model =
        ModelHandler.getKickstartFormMemoryModel(
            EcoreUtil.getURI(diagramTypeProvider.getDiagram()));
    if (model == null) {
      throw new IllegalStateException(
          "No diagram model is currently available for diagram: "
              + EcoreUtil.getURI(diagramTypeProvider.getDiagram()));
    }
    return model;
  }
コード例 #3
0
  protected static synchronized TransactionalEditingDomain createEditingDomain(
      CamelDesignEditor designEditor) {
    TransactionalEditingDomain editingDomain = designEditor.getEditingDomain();
    IDiagramTypeProvider diagramTypeProvider = designEditor.getDiagramTypeProvider();
    if (diagramTypeProvider == null) {
      return null;
    }
    Diagram diagram = diagramTypeProvider.getDiagram();
    if (diagram == null) {
      return null;
    }
    if (editingDomain == null) {
      IDiagramBehavior diagramBehavior = diagramTypeProvider.getDiagramBehavior();
      if (diagramBehavior != null) {
        editingDomain = diagramBehavior.getEditingDomain();
      }
    }
    if (editingDomain == null) {
      ResourceSet resourceSet = null;
      Resource eResource = diagram.eResource();
      if (eResource != null) {
        resourceSet = eResource.getResourceSet();
      }
      if (resourceSet == null) {
        resourceSet = new ResourceSetImpl();
      }

      editingDomain = TransactionUtil.getEditingDomain(resourceSet);
      if (editingDomain == null) {
        editingDomain = GraphitiUi.getEmfService().createResourceSetAndEditingDomain();
      }
    }

    // TODO: do we need to set transactionaldomain?
    //		if (designEditor.getEditingDomain() == null) {
    //			designEditor.setEditingDomain(editingDomain);
    //		}

    return editingDomain;
  }