Package org.eclipse.gmf.runtime.notation

Examples of org.eclipse.gmf.runtime.notation.Diagram


        .getInstance().getDocumentProvider()
        .getDiagramDocument(anInput);
    if (document == null) {
      return StructuredSelection.EMPTY;
    }
    Diagram diagram = document.getDiagram();
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
      OntoUML.diagram.navigator.OntoUMLNavigatorItem item = new OntoUML.diagram.navigator.OntoUMLNavigatorItem(
          diagram, file, false);
      return new StructuredSelection(item);
    }
View Full Code Here


    final List decorators = viewId != null ? (List) allDecorators
        .get(viewId) : null;
    if (decorators == null || decorators.isEmpty() || diagram == null) {
      return;
    }
    final Diagram fdiagram = diagram;
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {

      public void run() {
        try {
          TransactionUtil.getEditingDomain(fdiagram).runExclusive(
View Full Code Here

  private Collection getDiagramLinksByType(Collection diagrams, int visualID) {
    Collection result = new ArrayList();
    String type = OntoUML.diagram.part.OntoUMLVisualIDRegistry
        .getType(visualID);
    for (Iterator it = diagrams.iterator(); it.hasNext();) {
      Diagram nextDiagram = (Diagram) it.next();
      result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
    }
    return result;
  }
View Full Code Here

                "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$
      }
      IDiagramDocument diagramDocument = (IDiagramDocument) document;
      final Resource newResource = diagramDocument.getEditingDomain()
          .getResourceSet().createResource(newResoruceURI);
      final Diagram diagramCopy = (Diagram) EcoreUtil
          .copy(diagramDocument.getDiagram());
      try {
        new AbstractTransactionalCommand(
            diagramDocument.getEditingDomain(),
            NLS
                .bind(
                    OntoUML.diagram.part.Messages.OntoUMLDocumentProvider_SaveAsOperation,
                    diagramCopy.getName()), affectedFiles) {
          protected CommandResult doExecuteWithResult(
              IProgressMonitor monitor, IAdaptable info)
              throws ExecutionException {
            newResource.getContents().add(diagramCopy);
            return CommandResult.newOKCommandResult();
View Full Code Here

                .getModelElement());
        if (diagramVID != OntoUML.diagram.edit.parts.ContainerEditPart.VISUAL_ID) {
          return CommandResult
              .newErrorCommandResult(OntoUML.diagram.part.Messages.OntoUMLNewDiagramFileWizard_IncorrectRootError);
        }
        Diagram diagram = ViewService
            .createDiagram(
                diagramRootElementSelectionPage
                    .getModelElement(),
                OntoUML.diagram.edit.parts.ContainerEditPart.MODEL_ID,
                OntoUML.diagram.part.OntoUMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
View Full Code Here

        } else if (selectedElement instanceof IAdaptable) {
          selectedElement = ((IAdaptable) selectedElement)
              .getAdapter(View.class);
        }
        if (selectedElement instanceof Diagram) {
          Diagram diagram = (Diagram) selectedElement;
          if (OntoUML.diagram.edit.parts.ContainerEditPart.MODEL_ID
              .equals(OntoUML.diagram.part.OntoUMLVisualIDRegistry
                  .getModelID(diagram))) {
            myDiagram = diagram;
          }
View Full Code Here

    IGraphicalEditPart editPart = (IGraphicalEditPart) host
        .getAdapter(IGraphicalEditPart.class);
    if (editPart == null) {
      return null;
    }
    Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
    Collection elements = new HashSet();
    for (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {
      EObject element = (EObject) it.next();
      if (isApplicableElement(element, types)) {
        elements.add(element);
      }
    }
View Full Code Here

          IProgressMonitor monitor, IAdaptable info)
          throws ExecutionException {
        OntoUML.Container model = createInitialModel();
        attachModelToResource(model, modelResource);

        Diagram diagram = ViewService
            .createDiagram(
                model,
                OntoUML.diagram.edit.parts.ContainerEditPart.MODEL_ID,
                OntoUML.diagram.part.OntoUMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
        if (diagram != null) {
          diagramResource.getContents().add(diagram);
          diagram.setName(diagramName);
          diagram.setElement(model);
        }

        try {
          modelResource
              .save(OntoUML.diagram.part.OntoUMLDiagramEditorUtil
View Full Code Here

        int diagramVID = options.getDiagramVisualID(modelFile, modelRoot);
        if (diagramVID != options.visualId) {
          return CommandResult
              .newErrorCommandResult(options.errorMessage);
        }
        Diagram diagram = ViewService.createDiagram(
            modelRoot,
            options.modelId,
            options.prefHint);
        diagramResource.getContents().add(diagram);
        return CommandResult.newOKCommandResult();
View Full Code Here

    protected Diagram getDiagramToOpen() {
      return diagramFacet.getDiagramLink();
    }

    protected Diagram intializeNewDiagram() throws ExecutionException {
      Diagram d = ViewService.createDiagram(getDiagramDomainElement(),
          getDiagramKind(), getPreferencesHint());
      if (d == null) {
        throw new ExecutionException(
            "Can't create diagram of '"+ getDiagramKind()
            + "' kind"
View Full Code Here

TOP

Related Classes of org.eclipse.gmf.runtime.notation.Diagram

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.