Package org.eclipse.gmf.runtime.notation

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


      if (operation instanceof ILayoutNodeOperation) {
            Iterator nodes = ((ILayoutNodeOperation) operation)
                .getLayoutNodes().listIterator();
            if (nodes.hasNext()) {
                View node = ((ILayoutNode) nodes.next()).getNode();
                Diagram container = node.getDiagram();
                if (container == null
                    || !(container.getType().equals("DispelPackages"))) //$NON-NLS-1$
                    return false;
            }
        } else {
            return false;
        }
View Full Code Here


      throws CoreException {
    IDiagramDocument diagramDocument = (IDiagramDocument) document;
    TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
    if (element instanceof FileEditorInput) {
      IStorage storage = ((FileEditorInput) element).getStorage();
      Diagram diagram = DiagramIOUtil.load(domain, storage, true,
          getProgressMonitor());
      document.setContent(diagram);
    } else if (element instanceof URIEditorInput) {
      URI uri = ((URIEditorInput) element).getURI();
      Resource resource = null;
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(
                    eu.admire.visual.pmml.radviz._40.diagram.part.Messages.PMMLDocumentProvider_SaveAsOperation,
                    diagramCopy.getName()), affectedFiles) {
          protected CommandResult doExecuteWithResult(
              IProgressMonitor monitor, IAdaptable info)
              throws ExecutionException {
            newResource.getContents().add(diagramCopy);
            return CommandResult.newOKCommandResult();
View Full Code Here

      if (operation instanceof ILayoutNodeOperation) {
            Iterator nodes = ((ILayoutNodeOperation) operation)
                .getLayoutNodes().listIterator();
            if (nodes.hasNext()) {
                View node = ((ILayoutNode) nodes.next()).getNode();
                Diagram container = node.getDiagram();
                if (container == null
                    || !(container.getType().equals("DispelPackages"))) //$NON-NLS-1$
                    return false;
            }
        } else {
            return false;
        }
View Full Code Here

        } else if (selectedElement instanceof IAdaptable) {
          selectedElement = ((IAdaptable) selectedElement)
              .getAdapter(View.class);
        }
        if (selectedElement instanceof Diagram) {
          Diagram diagram = (Diagram) selectedElement;
          if (DispelFunctionEditPart.MODEL_ID
              .equals(DispelVisualIDRegistry.getModelID(diagram))) {
            myDiagram = diagram;
          }
        }
View Full Code Here

    /* Get selection */
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

    // Get selection from the window
    final ISelection selection = window.getSelectionService().getSelection();
        Diagram diagramView = null;
       
        // get the editing domain
        if (selection instanceof IStructuredSelection) {

            IStructuredSelection structuredSelection = (IStructuredSelection) selection;

            // Walk selection
            for (Iterator i = structuredSelection.iterator(); i.hasNext();) {

                // Try to adapt the selection to a view
                Object selectedObject = i.next();
                if (selectedObject instanceof IAdaptable) {

                    // Try to get a View (new notation)
                    Object object = ((IAdaptable) selectedObject)
                        .getAdapter(View.class);
                   
                    diagramView = ((View)object).getDiagram();
                }
            }
        }
       
        if (diagramView != null) {
            final Diagram diag = diagramView;
            
            TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(diagramView);
            AbstractEMFOperation operation = new AbstractEMFOperation(
                ted, KEY_NEURAL_NETWORK_LAYOUT, null) {

View Full Code Here

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

        Diagram diagram = ViewService.createDiagram(model,
            DispelFunctionEditPart.MODEL_ID,
            DispelDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
        if (diagram != null) {
          diagramResource.getContents().add(diagram);
          diagram.setName(diagramName);
          diagram.setElement(model);
        }

        try {
          modelResource
              .save(eu.admire.workbench.pd.methods.diagram.part.DispelDiagramEditorUtil
View Full Code Here

    /* Get selection */
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

    // Get selection from the window
    final ISelection selection = window.getSelectionService().getSelection();
        Diagram diagramView = null;
       
        // get the editing domain
        if (selection instanceof IStructuredSelection) {

            IStructuredSelection structuredSelection = (IStructuredSelection) selection;

            // Walk selection
            for (Iterator i = structuredSelection.iterator(); i.hasNext();) {

                // Try to adapt the selection to a view
                Object selectedObject = i.next();
                if (selectedObject instanceof IAdaptable) {

                    // Try to get a View (new notation)
                    Object object = ((IAdaptable) selectedObject)
                        .getAdapter(View.class);
                   
                    diagramView = ((View)object).getDiagram();
                }
            }
        }
       
        if (diagramView != null) {
            final Diagram diag = diagramView;
            
            TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(diagramView);
            AbstractEMFOperation operation = new AbstractEMFOperation(
                ted, KEY_TREE_MODEL_LAYOUT, null) {

View Full Code Here

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

  private ISelection getNavigatorSelection() {
    IDiagramDocument document = getDiagramDocument();
    if (document == null) {
      return StructuredSelection.EMPTY;
    }
    Diagram diagram = document.getDiagram();
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
      eu.admire.visual.pmml.treemodel._40.diagram.navigator.PMMLNavigatorItem item = new eu.admire.visual.pmml.treemodel._40.diagram.navigator.PMMLNavigatorItem(
          diagram, file, false);
      return new StructuredSelection(item);
    }
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.