Search in sources :

Example 1 with ProjectReferenceService

use of org.osate.ge.internal.services.ProjectReferenceService in project osate2 by osate.

the class AgeEditor method createPartControl.

@Override
public void createPartControl(final Composite parent) {
    // 
    // Create the FX canvas which is an SWT widget for embedding JavaFX content.
    // 
    fxCanvas = new FXCanvas(parent, SWT.NONE);
    fxCanvas.addDisposeListener(e -> {
        fxCanvas.getScene().setRoot(new Group());
        fxCanvas.setScene(null);
    });
    fxCanvas.addPaintListener(paintListener);
    // Suppress SWT key press handling when interaction is active
    fxCanvas.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(final org.eclipse.swt.events.KeyEvent e) {
            if (activeInteraction != null) {
                e.doit = false;
            }
        }
    });
    fxCanvas.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(FocusEvent e) {
            deactivateInteraction();
        }
    });
    // Create the context menu
    contextMenuManager = new MenuManager(MENU_ID, MENU_ID);
    contextMenuManager.setRemoveAllWhenShown(true);
    final Menu contextMenu = contextMenuManager.createContextMenu(fxCanvas);
    fxCanvas.setMenu(contextMenu);
    getEditorSite().registerContextMenu(MENU_ID, contextMenuManager, selectionProvider, true);
    // Create the action executor. It will append an action to activate the editor when undoing and redoing actions.
    actionExecutor = (label, mode, action) -> {
        final boolean reverseActionWasSpecified = actionService.execute(label, mode, action);
        // This will ensure that when the action is undone, the editor will be switched to the one in which the action was performed.
        if (isEditorActive() && reverseActionWasSpecified && !actionService.isActionExecuting() && mode == ExecutionMode.NORMAL) {
            actionService.execute("Activate Editor", ExecutionMode.APPEND_ELSE_HIDE, new ActivateAgeEditorAction(AgeEditor.this));
        }
        fireDirtyPropertyChangeEvent();
        return reverseActionWasSpecified;
    };
    // Initialize the palette model
    final AgeEditorPaletteModel.ImageProvider imageProvider = id -> {
        final RegisteredImage img = extRegistry.getImageMap().get(id);
        if (img == null) {
            return Optional.empty();
        }
        final URI imageUri = URI.createPlatformPluginURI("/" + img.plugin + "/" + img.path, true);
        if (CommonPlugin.asLocalURI(imageUri).isFile()) {
            return Optional.of(new Image(imageUri.toString()));
        } else {
            return Optional.empty();
        }
    };
    Object diagramBo = AgeDiagramUtil.getConfigurationContextBusinessObject(diagram, projectReferenceService);
    if (diagramBo == null) {
        diagramBo = project;
    }
    this.paletteModel = new AgeEditorPaletteModel(extRegistry.getPaletteContributors(), diagramBo, imageProvider);
    // If the palette item changes while an interaction is active, deactivate the interaction.
    this.paletteModel.activeItemProperty().addListener((javafx.beans.value.ChangeListener<SimplePaletteItem>) (observable, oldValue, newValue) -> deactivateInteraction());
    // Initialize the JavaFX nodes based on the diagram
    canvas = new InfiniteCanvas();
    // Set show grid based on preferences
    canvas.setShowGrid(preferenceStore.getBoolean(Preferences.SHOW_GRID));
    final Scene scene = new Scene(new DiagramEditorNode(paletteModel, canvas));
    fxCanvas.setScene(scene);
    gefDiagram = new GefAgeDiagram(diagram, coloringService);
    // Create a wrapper around the diagram's scene node.
    final Group wrapper = new DiagramNodeWrapper(gefDiagram.getSceneNode());
    // Add the wrapper to the canvas
    canvas.getContentGroup().getChildren().add(wrapper);
    gefDiagram.updateDiagramFromSceneGraph(false);
    // Treat the current state of the diagram as clean.
    cleanDiagramChangeNumber = diagram.getCurrentChangeNumber();
    adapterMap.put(LayoutInfoProvider.class, gefDiagram);
    // Create overlays
    overlays = new Overlays(gefDiagram);
    selectionProvider.addSelectionChangedListener(overlays);
    canvas.getScrolledOverlayGroup().getChildren().add(overlays);
    // Perform the initial incremental layout
    diagram.modify("Incremental Layout", m -> DiagramElementLayoutUtil.layoutIncrementally(diagram, m, gefDiagram));
    // Set action executor after initial load. This occurs after the incremental layout to prevent the loading and initial layout from being undoable
    diagram.setActionExecutor(actionExecutor);
    // Refresh the dirty state whenever an operation occurs
    final IOperationHistory history = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
    history.addOperationHistoryListener(operationHistoryListener);
    canvas.setOnScroll(e -> {
        if (e.isControlDown()) {
            // Adjust zoom
            if (e.getDeltaY() < 0.0) {
                zoomOut();
            } else {
                zoomIn();
            }
        } else {
            if (e.isShiftDown()) {
                // Scroll in X direction
                canvas.setHorizontalScrollOffset(canvas.getHorizontalScrollOffset() - e.getDeltaY());
            } else {
                // Scroll
                canvas.setHorizontalScrollOffset(canvas.getHorizontalScrollOffset() - e.getDeltaX());
                canvas.setVerticalScrollOffset(canvas.getVerticalScrollOffset() + e.getDeltaY());
            }
        }
    });
    // 
    // Listeners to handle tooltips
    // 
    canvas.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, e -> {
        if (e.getTarget() instanceof Node && activeInteraction == null && tooltipManager != null && gefDiagram != null) {
            final DiagramElement de = gefDiagram.getDiagramElement((Node) e.getTarget());
            if (de != null) {
                tooltipManager.mouseEnter(de);
            }
        }
    });
    canvas.addEventHandler(MouseEvent.MOUSE_EXITED_TARGET, e -> {
        if (e.getTarget() instanceof Node && activeInteraction == null && tooltipManager != null && gefDiagram != null) {
            final DiagramElement de = gefDiagram.getDiagramElement((Node) e.getTarget());
            if (de != null) {
                tooltipManager.mouseExit(de);
            }
        }
    });
    // 
    // General input handlers
    // 
    // Event handler. Delegates to input event handlers or the active interaction as appropriate
    final EventHandler<? super InputEvent> handleInput = e -> {
        if (activeInteraction == null) {
            // Delegate processing of the event to the input event handlers
            for (final InputEventHandler inputEventHandler : inputEventHandlers) {
                final InputEventHandler.HandledEvent r = inputEventHandler.handleEvent(e);
                if (r != null) {
                    activeInteraction = r.newInteraction;
                    if (activeInteraction != null) {
                        canvas.setCursor(activeInteraction.getCursor());
                        if (tooltipManager != null) {
                            tooltipManager.hideTooltip();
                        }
                    }
                    break;
                }
            }
        } else {
            if (activeInteraction.handleEvent(e) == InteractionState.COMPLETE) {
                deactivateInteraction();
            }
            canvas.setCursor(activeInteraction == null ? null : activeInteraction.getCursor());
        }
    };
    // Handle mouse button presses
    canvas.addEventFilter(MouseEvent.MOUSE_PRESSED, handleInput);
    canvas.addEventFilter(MouseEvent.MOUSE_DRAGGED, handleInput);
    canvas.addEventFilter(MouseEvent.MOUSE_RELEASED, handleInput);
    scene.addEventFilter(KeyEvent.KEY_PRESSED, handleInput);
    canvas.addEventFilter(MouseEvent.MOUSE_MOVED, e -> {
        if (activeInteraction == null) {
            Cursor cursor = Cursor.DEFAULT;
            for (final InputEventHandler inputEventHandler : inputEventHandlers) {
                final Cursor overrideCursor = inputEventHandler.getCursor(e);
                if (overrideCursor != null) {
                    cursor = overrideCursor;
                    break;
                }
            }
            canvas.setCursor(cursor);
        }
        handleInput.handle(e);
    });
    // Create input event handlers
    inputEventHandlers.add(new OpenPropertiesViewInputEventHandler(this));
    inputEventHandlers.add(new ResizeInputEventHandler(this));
    inputEventHandlers.add(new MarqueeSelectInputEventHandler(this));
    inputEventHandlers.add(new MoveConnectionPointTool(this));
    inputEventHandlers.add(new RenameInputEventHandler(this));
    inputEventHandlers.add(new SelectInputEventHandler(this));
    inputEventHandlers.add(new MoveInputEventHandler(this));
    inputEventHandlers.add(new PaletteCommandInputEventHandler(this));
}
Also used : DiagramModifier(org.osate.ge.internal.diagram.runtime.DiagramModifier) Tool(org.osate.ge.internal.ui.tools.Tool) CoreException(org.eclipse.core.runtime.CoreException) FocusEvent(org.eclipse.swt.events.FocusEvent) DiagramElementLayoutUtil(org.osate.ge.internal.diagram.runtime.layout.DiagramElementLayoutUtil) InteractionState(org.osate.ge.gef.ui.editor.Interaction.InteractionState) BusinessObjectContext(org.osate.ge.BusinessObjectContext) DefaultQueryService(org.osate.ge.services.impl.DefaultQueryService) Composite(org.eclipse.swt.widgets.Composite) PartInitException(org.eclipse.ui.PartInitException) Map(java.util.Map) CommonPlugin(org.eclipse.emf.common.CommonPlugin) IEclipsePreferences(org.eclipse.core.runtime.preferences.IEclipsePreferences) StatusManager(org.eclipse.ui.statushandlers.StatusManager) ProjectProvider(org.osate.ge.internal.services.ProjectProvider) Transform(javafx.scene.transform.Transform) ISelectionProvider(org.eclipse.jface.viewers.ISelectionProvider) GefAgeDiagram(org.osate.ge.gef.ui.diagram.GefAgeDiagram) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) KeyAdapter(org.eclipse.swt.events.KeyAdapter) ChangeListener(org.osate.ge.internal.services.ModelChangeNotifier.ChangeListener) IEditorInput(org.eclipse.ui.IEditorInput) PlatformUI(org.eclipse.ui.PlatformUI) MenuManager(org.eclipse.jface.action.MenuManager) Status(org.eclipse.core.runtime.Status) Rectangle(javafx.scene.shape.Rectangle) AgeGefUiPlugin(org.osate.ge.gef.ui.AgeGefUiPlugin) KeyEvent(javafx.scene.input.KeyEvent) UiService(org.osate.ge.internal.services.UiService) Group(javafx.scene.Group) IContentOutlinePage(org.eclipse.ui.views.contentoutline.IContentOutlinePage) IResourceChangeEvent(org.eclipse.core.resources.IResourceChangeEvent) IOperationHistoryListener(org.eclipse.core.commands.operations.IOperationHistoryListener) ReferenceService(org.osate.ge.internal.services.ReferenceService) InstanceScope(org.eclipse.core.runtime.preferences.InstanceScope) Overlays(org.osate.ge.gef.ui.editor.overlays.Overlays) SWT(org.eclipse.swt.SWT) IResourceChangeListener(org.eclipse.core.resources.IResourceChangeListener) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) EditorPart(org.eclipse.ui.part.EditorPart) AgeDiagramProvider(org.osate.ge.internal.AgeDiagramProvider) DiagramNode(org.osate.ge.internal.diagram.runtime.DiagramNode) Bounds(javafx.geometry.Bounds) PaintListener(org.eclipse.swt.events.PaintListener) DiagramElement(org.osate.ge.internal.diagram.runtime.DiagramElement) ResourcesPlugin(org.eclipse.core.resources.ResourcesPlugin) URI(org.eclipse.emf.common.util.URI) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) ExtensionRegistryService(org.osate.ge.internal.services.ExtensionRegistryService) ListenerList(org.eclipse.core.runtime.ListenerList) IEditorSite(org.eclipse.ui.IEditorSite) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) IPropertySheetPage(org.eclipse.ui.views.properties.IPropertySheetPage) ArrayList(java.util.ArrayList) IFileEditorInput(org.eclipse.ui.IFileEditorInput) ModelChangeNotifier(org.osate.ge.internal.services.ModelChangeNotifier) AgeContentOutlinePage(org.osate.ge.internal.ui.editor.AgeContentOutlinePage) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) InternalDiagramEditor(org.osate.ge.internal.ui.editor.InternalDiagramEditor) ITabbedPropertySheetPageContributor(org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor) IProject(org.eclipse.core.resources.IProject) IResourceDelta(org.eclipse.core.resources.IResourceDelta) ReferenceResolutionService(org.osate.ge.services.ReferenceResolutionService) IFile(org.eclipse.core.resources.IFile) BusinessObjectTreeUpdater(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectTreeUpdater) FXCanvas(javafx.embed.swt.FXCanvas) Color(javafx.scene.paint.Color) IPreferenceChangeListener(org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener) FileEditorInput(org.eclipse.ui.part.FileEditorInput) SelectAllAction(org.osate.ge.internal.ui.editor.actions.SelectAllAction) Node(javafx.scene.Node) ContentOutline(org.eclipse.ui.views.contentoutline.ContentOutline) TabbedPropertySheetPage(org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage) ProjectReferenceServiceProxy(org.osate.ge.internal.services.impl.ProjectReferenceServiceProxy) Cursor(javafx.scene.Cursor) QueryService(org.osate.ge.services.QueryService) IPartListener(org.eclipse.ui.IPartListener) IContextService(org.eclipse.ui.contexts.IContextService) InputEvent(javafx.scene.input.InputEvent) DiagramModificationAdapter(org.osate.ge.internal.diagram.runtime.DiagramModificationAdapter) LayoutInfoProvider(org.osate.ge.internal.diagram.runtime.layout.LayoutInfoProvider) Preferences(org.osate.ge.gef.ui.preferences.Preferences) Image(javafx.scene.image.Image) EventHandler(javafx.event.EventHandler) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) Affine(javafx.scene.transform.Affine) IAction(org.eclipse.jface.action.IAction) ErrorDialog(org.eclipse.jface.dialogs.ErrorDialog) DefaultColoringService(org.osate.ge.internal.services.impl.DefaultColoringService) AgeGefRuntimeException(org.osate.ge.gef.AgeGefRuntimeException) ModificationsCompletedEvent(org.osate.ge.internal.diagram.runtime.ModificationsCompletedEvent) ActionService(org.osate.ge.internal.services.ActionService) IncrementalProjectBuilder(org.eclipse.core.resources.IncrementalProjectBuilder) IStatus(org.eclipse.core.runtime.IStatus) IPath(org.eclipse.core.runtime.IPath) InfiniteCanvas(org.eclipse.gef.fx.nodes.InfiniteCanvas) ISelectionListener(org.eclipse.ui.ISelectionListener) DiagramModificationListener(org.osate.ge.internal.diagram.runtime.DiagramModificationListener) SimplePaletteItem(org.osate.ge.gef.palette.SimplePaletteItem) BusinessObjectNodeFactory(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNodeFactory) DefaultReferenceResolutionService(org.osate.ge.services.impl.DefaultReferenceResolutionService) Bundle(org.osgi.framework.Bundle) ActionExecutor(org.osate.ge.internal.services.ActionExecutor) UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup) RegisteredImage(org.osate.ge.internal.services.ExtensionRegistryService.RegisteredImage) Collection(java.util.Collection) Display(org.eclipse.swt.widgets.Display) DiagramSerialization(org.osate.ge.internal.diagram.runtime.DiagramSerialization) Collectors(java.util.stream.Collectors) CanonicalBusinessObjectReference(org.osate.ge.CanonicalBusinessObjectReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Objects(java.util.Objects) DefaultActionService(org.osate.ge.internal.services.impl.DefaultActionService) List(java.util.List) DeactivatedEvent(org.osate.ge.internal.ui.tools.DeactivatedEvent) AadlModificationService(org.osate.ge.internal.services.AadlModificationService) Optional(java.util.Optional) ISelection(org.eclipse.jface.viewers.ISelection) DiagramEditorNode(org.osate.ge.gef.DiagramEditorNode) DefaultDiagramElementGraphicalConfigurationProvider(org.osate.ge.internal.diagram.runtime.updating.DefaultDiagramElementGraphicalConfigurationProvider) SystemInstanceLoadingService(org.osate.ge.internal.services.SystemInstanceLoadingService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) CopyAction(org.osate.ge.internal.ui.editor.actions.CopyAction) EclipseContextFactory(org.eclipse.e4.core.contexts.EclipseContextFactory) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) Scene(javafx.scene.Scene) IOperationHistory(org.eclipse.core.commands.operations.IOperationHistory) ProjectReferenceService(org.osate.ge.internal.services.ProjectReferenceService) MouseEvent(javafx.scene.input.MouseEvent) HashMap(java.util.HashMap) DoubleProperty(javafx.beans.property.DoubleProperty) DiagramContextChecker(org.osate.ge.internal.ui.editor.DiagramContextChecker) ColoringService(org.osate.ge.internal.services.ColoringService) ImmutableList(com.google.common.collect.ImmutableList) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) DiagramUpdater(org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater) ActivatedEvent(org.osate.ge.internal.ui.tools.ActivatedEvent) IWorkbenchSite(org.eclipse.ui.IWorkbenchSite) ActivateAgeEditorAction(org.osate.ge.internal.ui.editor.ActivateAgeEditorAction) DefaultBusinessObjectTreeUpdater(org.osate.ge.internal.diagram.runtime.updating.DefaultBusinessObjectTreeUpdater) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) AgeDiagramUtil(org.osate.ge.internal.diagram.runtime.AgeDiagramUtil) NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ExecutionMode(org.osate.ge.internal.services.ActionExecutor.ExecutionMode) AgeHandlerUtil(org.osate.ge.internal.ui.handlers.AgeHandlerUtil) IResource(org.eclipse.core.resources.IResource) Menu(org.eclipse.swt.widgets.Menu) FocusAdapter(org.eclipse.swt.events.FocusAdapter) PasteAction(org.osate.ge.internal.ui.editor.actions.PasteAction) Collections(java.util.Collections) FrameworkUtil(org.osgi.framework.FrameworkUtil) Group(javafx.scene.Group) UndoRedoActionGroup(org.eclipse.ui.operations.UndoRedoActionGroup) FocusAdapter(org.eclipse.swt.events.FocusAdapter) ActivateAgeEditorAction(org.osate.ge.internal.ui.editor.ActivateAgeEditorAction) RegisteredImage(org.osate.ge.internal.services.ExtensionRegistryService.RegisteredImage) KeyAdapter(org.eclipse.swt.events.KeyAdapter) DiagramEditorNode(org.osate.ge.gef.DiagramEditorNode) DiagramNode(org.osate.ge.internal.diagram.runtime.DiagramNode) Node(javafx.scene.Node) DiagramEditorNode(org.osate.ge.gef.DiagramEditorNode) Image(javafx.scene.image.Image) RegisteredImage(org.osate.ge.internal.services.ExtensionRegistryService.RegisteredImage) SimplePaletteItem(org.osate.ge.gef.palette.SimplePaletteItem) Cursor(javafx.scene.Cursor) FocusEvent(org.eclipse.swt.events.FocusEvent) URI(org.eclipse.emf.common.util.URI) DiagramElement(org.osate.ge.internal.diagram.runtime.DiagramElement) InfiniteCanvas(org.eclipse.gef.fx.nodes.InfiniteCanvas) IOperationHistory(org.eclipse.core.commands.operations.IOperationHistory) Menu(org.eclipse.swt.widgets.Menu) FXCanvas(javafx.embed.swt.FXCanvas) Scene(javafx.scene.Scene) Overlays(org.osate.ge.gef.ui.editor.overlays.Overlays) GefAgeDiagram(org.osate.ge.gef.ui.diagram.GefAgeDiagram) MenuManager(org.eclipse.jface.action.MenuManager)

Example 2 with ProjectReferenceService

use of org.osate.ge.internal.services.ProjectReferenceService in project osate2 by osate.

the class GefDiagramExportService method loadDiagram.

private GefAgeDiagram loadDiagram(final IFile diagramFile) {
    final URI uri = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
    final IProject project = ProjectUtil.getProjectOrNull(uri);
    final org.osate.ge.diagram.Diagram mmDiagram = DiagramSerialization.readMetaModelDiagram(uri);
    final IEclipseContext eclipseContext = EclipseContextFactory.getServiceContext(FrameworkUtil.getBundle(GefDiagramExportService.class).getBundleContext());
    final ExtensionRegistryService extensionRegistry = Objects.requireNonNull(eclipseContext.get(ExtensionRegistryService.class), "Unable to retrieve extension registry");
    final ReferenceService referenceService = Objects.requireNonNull(eclipseContext.get(ReferenceService.class), "unable to retrieve reference service");
    final ActionService actionService = Objects.requireNonNull(eclipseContext.get(ActionService.class), "unable to retrieve action service");
    final AgeDiagram diagram = DiagramSerialization.createAgeDiagram(project, mmDiagram, extensionRegistry);
    // Update the diagram
    final QueryService queryService = new DefaultQueryService(referenceService);
    final ProjectProvider projectProvider = diagramFile::getProject;
    final ProjectReferenceService projectReferenceService = new ProjectReferenceServiceProxy(referenceService, projectProvider);
    final BusinessObjectNodeFactory nodeFactory = new BusinessObjectNodeFactory(projectReferenceService);
    final DefaultBusinessObjectTreeUpdater boTreeUpdater = new DefaultBusinessObjectTreeUpdater(projectProvider, extensionRegistry, projectReferenceService, queryService, nodeFactory);
    final DefaultDiagramElementGraphicalConfigurationProvider deInfoProvider = new DefaultDiagramElementGraphicalConfigurationProvider(queryService, () -> diagram, extensionRegistry);
    final DiagramUpdater diagramUpdater = new DiagramUpdater(boTreeUpdater, deInfoProvider, actionService, projectReferenceService, projectReferenceService);
    diagramUpdater.updateDiagram(diagram);
    // Create the GEF Diagram
    final GefAgeDiagram gefDiagram = new GefAgeDiagram(diagram, new DefaultColoringService(new org.osate.ge.internal.services.impl.DefaultColoringService.StyleRefresher() {

        @Override
        public void refreshDiagramColoring() {
        // No-op. Handling coloring service refresh requests is not required.
        }

        @Override
        public void refreshColoring(final Collection<DiagramElement> diagramElements) {
        // No-op. Handling coloring service refresh requests is not required.
        }
    }));
    // Add to scene. This is required for text rendering
    new Scene(gefDiagram.getSceneNode());
    // Update the diagram to reflect the scene graph and perform incremental layout
    gefDiagram.updateDiagramFromSceneGraph(false);
    diagram.modify("Incremental Layout", m -> DiagramElementLayoutUtil.layoutIncrementally(diagram, m, gefDiagram));
    return gefDiagram;
}
Also used : ReferenceService(org.osate.ge.internal.services.ReferenceService) ProjectReferenceService(org.osate.ge.internal.services.ProjectReferenceService) ProjectReferenceService(org.osate.ge.internal.services.ProjectReferenceService) DefaultColoringService(org.osate.ge.internal.services.impl.DefaultColoringService) ExtensionRegistryService(org.osate.ge.internal.services.ExtensionRegistryService) URI(org.eclipse.emf.common.util.URI) GefAgeDiagram(org.osate.ge.gef.ui.diagram.GefAgeDiagram) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) ProjectReferenceServiceProxy(org.osate.ge.internal.services.impl.ProjectReferenceServiceProxy) DefaultQueryService(org.osate.ge.services.impl.DefaultQueryService) BusinessObjectNodeFactory(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNodeFactory) ActionService(org.osate.ge.internal.services.ActionService) ProjectProvider(org.osate.ge.internal.services.ProjectProvider) DefaultDiagramElementGraphicalConfigurationProvider(org.osate.ge.internal.diagram.runtime.updating.DefaultDiagramElementGraphicalConfigurationProvider) DiagramUpdater(org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater) Scene(javafx.scene.Scene) IProject(org.eclipse.core.resources.IProject) GefAgeDiagram(org.osate.ge.gef.ui.diagram.GefAgeDiagram) DefaultQueryService(org.osate.ge.services.impl.DefaultQueryService) QueryService(org.osate.ge.services.QueryService) DefaultBusinessObjectTreeUpdater(org.osate.ge.internal.diagram.runtime.updating.DefaultBusinessObjectTreeUpdater) IEclipseContext(org.eclipse.e4.core.contexts.IEclipseContext) Collection(java.util.Collection)

Example 3 with ProjectReferenceService

use of org.osate.ge.internal.services.ProjectReferenceService in project osate2 by osate.

the class ConfigureDiagramHandler method execute.

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
    if (!(activeEditor instanceof InternalDiagramEditor)) {
        throw new RuntimeException("Unexpected editor: " + activeEditor);
    }
    // Get diagram and selected elements
    final InternalDiagramEditor diagramEditor = (InternalDiagramEditor) activeEditor;
    final List<DiagramElement> selectedDiagramElements = AgeHandlerUtil.getSelectedDiagramElements();
    final AgeDiagram diagram = diagramEditor.getDiagram();
    if (diagram == null) {
        throw new RuntimeException("Unable to get diagram");
    }
    // Get services
    final BusinessObjectTreeUpdater boTreeUpdater = diagramEditor.getBoTreeUpdater();
    final DiagramUpdater diagramUpdater = diagramEditor.getDiagramUpdater();
    final ProjectProvider projectProvider = Objects.requireNonNull(Adapters.adapt(diagramEditor, ProjectProvider.class), "Unable to retrieve project provider");
    final LayoutInfoProvider layoutInfoProvider = Objects.requireNonNull(Adapters.adapt(diagramEditor, LayoutInfoProvider.class), "Unable to retrieve layout information provider");
    final ExtensionRegistryService extService = Objects.requireNonNull(Adapters.adapt(diagramEditor, ExtensionRegistryService.class), "Unable to retrieve extension service");
    final ProjectReferenceService referenceService = Objects.requireNonNull(Adapters.adapt(diagramEditor, ProjectReferenceService.class), "Unable to retrieve reference service");
    BusinessObjectNode boTree = DiagramToBusinessObjectTreeConverter.createBusinessObjectNode(diagram);
    // Update the tree so that it's business objects are refreshed
    boTree = boTreeUpdater.updateTree(diagram.getConfiguration(), boTree);
    final DefaultDiagramConfigurationDialogModel model = new DefaultDiagramConfigurationDialogModel(referenceService, extService, projectProvider, diagram.getConfiguration().getDiagramType());
    // Create a BO path for the initial selection. The initial selection will be the first diagram element which will be included in the BO tree.
    Object[] initialSelectionBoPath = null;
    for (final DiagramElement selectedDiagramElement : selectedDiagramElements) {
        if (model.shouldShowBusinessObject(selectedDiagramElement.getBusinessObject())) {
            // Only build a selection path if the BO will be shown
            DiagramNode tmp = selectedDiagramElement;
            final LinkedList<Object> boList = new LinkedList<>();
            while (tmp instanceof DiagramElement) {
                boList.addFirst(tmp.getBusinessObject());
                tmp = tmp.getParent();
            }
            initialSelectionBoPath = boList.toArray();
            break;
        }
    }
    // Show the dialog
    final DiagramConfigurationDialog.Result result = DiagramConfigurationDialog.show(null, model, diagram.getConfiguration(), boTree, initialSelectionBoPath);
    if (result != null) {
        // Update the diagram
        diagramEditor.getActionExecutor().execute("Set Diagram Configuration", ExecutionMode.NORMAL, () -> {
            diagram.modify("Set Diagram Configuration", m -> {
                m.setDiagramConfiguration(result.getDiagramConfiguration());
                diagramUpdater.updateDiagram(diagram, result.getBusinessObjectTree());
            });
            // Clear ghosts triggered by this update to prevent them from being unghosted during the next update.
            diagramUpdater.clearGhosts();
            diagram.modify("Layout", m -> DiagramElementLayoutUtil.layoutIncrementally(diagram, m, layoutInfoProvider));
            return null;
        });
    }
    return null;
}
Also used : BusinessObjectTreeUpdater(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectTreeUpdater) DiagramNode(org.osate.ge.internal.diagram.runtime.DiagramNode) ProjectReferenceService(org.osate.ge.internal.services.ProjectReferenceService) ExtensionRegistryService(org.osate.ge.internal.services.ExtensionRegistryService) DefaultDiagramConfigurationDialogModel(org.osate.ge.internal.ui.dialogs.DefaultDiagramConfigurationDialogModel) DiagramUpdater(org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater) IEditorPart(org.eclipse.ui.IEditorPart) LinkedList(java.util.LinkedList) InternalDiagramEditor(org.osate.ge.internal.ui.editor.InternalDiagramEditor) DiagramElement(org.osate.ge.internal.diagram.runtime.DiagramElement) BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) DiagramConfigurationDialog(org.osate.ge.internal.ui.dialogs.DiagramConfigurationDialog) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) LayoutInfoProvider(org.osate.ge.internal.diagram.runtime.layout.LayoutInfoProvider) ProjectProvider(org.osate.ge.internal.services.ProjectProvider)

Example 4 with ProjectReferenceService

use of org.osate.ge.internal.services.ProjectReferenceService in project osate2 by osate.

the class ShowFlowContributionItem method createControl.

@Override
protected Control createControl(final Composite parent) {
    showFlowBtn = new Button(parent, SWT.PUSH);
    showFlowBtn.setImage(showIcon.createImage());
    showFlowBtn.setToolTipText("Show");
    updateButton();
    showFlowBtn.addSelectionListener(new SelectionAdapter() {

        private ProjectReferenceService referenceService;

        @Override
        public void widgetSelected(final SelectionEvent e) {
            if (editor != null && selectedFlow != null) {
                referenceService = Objects.requireNonNull(Adapters.adapt(editor, ProjectReferenceService.class), "Unable to retrieve reference service");
                final DiagramUpdater diagramUpdater = editor.getDiagramUpdater();
                final BusinessObjectTreeUpdater boTreeUpdater = editor.getBoTreeUpdater();
                final BusinessObjectNode boTree = getBoTree(boTreeUpdater);
                final BusinessObjectNode containerNode = boTree.getAllDescendants().filter(q -> q.getBusinessObject() == selectedFlow.getContainer().getBusinessObject()).findAny().map(BusinessObjectNode.class::cast).orElseThrow(() -> new RuntimeException("Cannot find container for highlightable flow: " + selectedFlow.getFlowSegment().getName()));
                final Object component = getContainerComponent(selectedFlow.getContainer().getBusinessObject());
                ensureFlowSegmentsExist(component, selectedFlow.getFlowSegment(), containerNode);
                final AgeDiagram diagram = editor.getDiagram();
                final LayoutInfoProvider layoutInfoProvider = Objects.requireNonNull(Adapters.adapt(editor, LayoutInfoProvider.class), "Unable to retrieve layout info provider");
                editor.getActionExecutor().execute("Show Flow Elements", ExecutionMode.NORMAL, () -> {
                    // Update the diagram
                    diagramUpdater.updateDiagram(diagram, boTree);
                    // Update layout
                    diagram.modify("Layout Incrementally", m -> DiagramElementLayoutUtil.layoutIncrementally(diagram, m, layoutInfoProvider));
                    return null;
                });
            }
        }

        private List<FlowSegmentReference> findFlowSegments(final FlowSegmentReference flowElementRef) {
            if (flowElementRef.flowSegmentElement instanceof FlowSpecification) {
                // Check if flow specification has flow implementation(s)
                return AadlClassifierUtil.getComponentImplementation(flowElementRef.container.getBusinessObject()).map(ci -> ci.getAllFlowImplementations().stream().filter(cfi -> flowElementRef.flowSegmentElement == cfi.getSpecification()).flatMap(cfi -> cfi.getOwnedFlowSegments().stream()).map(flowSegment -> createFlowSegmentReference(flowSegment, (BusinessObjectNode) flowElementRef.container))).orElse(Stream.empty()).collect(Collectors.toList());
            } else if (flowElementRef.flowSegmentElement instanceof EndToEndFlow) {
                final EndToEndFlow endToEndFlow = (EndToEndFlow) flowElementRef.flowSegmentElement;
                final BusinessObjectNode containerNode = (BusinessObjectNode) flowElementRef.container;
                return AadlClassifierUtil.getComponentImplementation(containerNode.getBusinessObject()).map(ci -> ci.getAllEndToEndFlows().stream().filter(ownedEndToEndFlow -> ownedEndToEndFlow == endToEndFlow).flatMap(ete -> ete.getAllFlowSegments().stream().flatMap(flowSegment -> {
                    final EndToEndFlowElement endToEndFlowElement = flowSegment.getFlowElement();
                    if (endToEndFlowElement instanceof EndToEndFlow) {
                        // Find segments of a segment that is an end to end flow
                        return ((EndToEndFlow) endToEndFlowElement).getAllFlowSegments().stream();
                    }
                    return Stream.of(flowSegment);
                })).map(endToEndFlowSegment -> createFlowSegmentReference(endToEndFlowSegment, containerNode))).orElse(Stream.empty()).collect(Collectors.toList());
            } else if (flowElementRef.flowSegmentElement instanceof EndToEndFlowInstance) {
                return AadlInstanceObjectUtil.getComponentInstance(flowElementRef.container.getBusinessObject()).map(ci -> ci.getEndToEndFlows().stream().filter(ete -> ete == flowElementRef.flowSegmentElement).flatMap(ete -> {
                    return ete.getFlowElements().stream().flatMap(fei -> {
                        if (fei instanceof ConnectionInstance) {
                            return ((ConnectionInstance) fei).getConnectionReferences().stream().map(cr -> createFlowSegmentReference(cr, (BusinessObjectNode) flowElementRef.container));
                        } else {
                            return Stream.of(createFlowSegmentReference(fei, (BusinessObjectNode) flowElementRef.container));
                        }
                    });
                })).orElse(Stream.empty()).collect(Collectors.toList());
            } else {
                return Collections.emptyList();
            }
        }

        private void ensureFlowSegmentsExist(final Object component, final NamedElement flow, final BusinessObjectNode containerNode) {
            if (component instanceof ComponentImplementation) {
                final ComponentImplementation ci = (ComponentImplementation) component;
                if (flow instanceof FlowSpecification) {
                    ci.getAllFlowImplementations().stream().filter(fi -> flow.getName().equalsIgnoreCase(fi.getSpecification().getName())).findAny().ifPresent(flowImpl -> {
                        final FlowSegmentReference flowSegmentRef = createFlowSegmentReference(flowImpl.getSpecification(), containerNode);
                        enableFlowSegments(findFlowSegments(flowSegmentRef));
                    });
                } else {
                    final String eteName = flow.getName();
                    final Optional<EndToEndFlow> eteFlow = ci.getAllEndToEndFlows().stream().filter(etef -> eteName.equalsIgnoreCase(etef.getName())).findAny();
                    eteFlow.ifPresent(endToEndFlow -> {
                        final FlowSegmentReference flowSegmentRef = createFlowSegmentReference(endToEndFlow, containerNode);
                        enableFlowSegments(findFlowSegments(flowSegmentRef));
                    });
                }
            } else if (component instanceof ComponentInstance) {
                // ETE Flows only
                final EndToEndFlowInstance eteFlowInstance = (EndToEndFlowInstance) flow;
                final FlowSegmentReference flowSegmentRef = createFlowSegmentReference(eteFlowInstance, containerNode);
                enableFlowSegments(findFlowSegments(flowSegmentRef));
            }
        }

        private void enableFlowSegments(final List<FlowSegmentReference> highlightableFlowElements) {
            highlightableFlowElements.stream().filter(Predicates.notNull()).forEach(highlightableFlowElement -> {
                final NamedElement flowSegmentElement = highlightableFlowElement.flowSegmentElement;
                final BusinessObjectContext flowSegmentContainer = highlightableFlowElement.container;
                // Find segments for flow and remove cycles
                final List<FlowSegmentReference> flowSegmentReferences = findFlowSegments(highlightableFlowElement).stream().filter(flowSegmentReference -> flowSegmentReference.flowSegmentElement != flowSegmentElement && flowSegmentReference.container != flowSegmentContainer).collect(Collectors.toList());
                enableFlowSegments(flowSegmentReferences);
            });
        }

        private Object getContainerComponent(final Object container) {
            if (container instanceof Subcomponent) {
                final Subcomponent sc = (Subcomponent) container;
                return sc.getComponentImplementation();
            }
            return container;
        }

        private BusinessObjectNode getBoTree(final BusinessObjectTreeUpdater treeUpdater) {
            BusinessObjectNode boTree = DiagramToBusinessObjectTreeConverter.createBusinessObjectNode(editor.getDiagram());
            return treeUpdater.updateTree(editor.getDiagram().getConfiguration(), boTree);
        }

        private FlowSegmentReference createFlowSegmentReference(final Object bo, final BusinessObjectNode container) {
            if (bo instanceof FlowSegment) {
                final FlowSegment flowSegment = (FlowSegment) bo;
                final FlowElement flowElement = flowSegment.getFlowElement();
                if (flowSegment.getContext() == null) {
                    return createFlowSegmentReference(flowElement, container);
                } else {
                    final BusinessObjectNode contextNode = ensureEnabledChild(flowSegment.getContext(), container);
                    return createFlowSegmentReference(flowElement, contextNode);
                }
            } else if (bo instanceof EndToEndFlowSegment) {
                final EndToEndFlowSegment flowSegment = (EndToEndFlowSegment) bo;
                if (flowSegment.getFlowElement() instanceof FlowElement) {
                    final FlowElement flowElement = (FlowElement) flowSegment.getFlowElement();
                    if (flowSegment.getContext() == null) {
                        return createFlowSegmentReference(flowElement, container);
                    } else {
                        final BusinessObjectNode contextNode = ensureEnabledChild(flowSegment.getContext(), container);
                        return createFlowSegmentReference(flowElement, contextNode);
                    }
                }
                return createFlowSegmentReference(flowSegment.getFlowElement(), container);
            } else if (bo instanceof InstanceObject) {
                final InstanceObject io = (InstanceObject) bo;
                if (bo instanceof EndToEndFlowInstance) {
                    return new FlowSegmentReference(io, container);
                } else {
                    final Map<Object, BusinessObjectContext> descendantBoToQueryable = container.getAllDescendants().collect(Collectors.toMap(BusinessObjectContext::getBusinessObject, Function.identity()));
                    if (bo instanceof FlowSpecificationInstance) {
                        final FlowSpecificationInstance fsi = (FlowSpecificationInstance) bo;
                        enableFlowSpecificationInstanceNodes(descendantBoToQueryable, fsi);
                    }
                    if (bo instanceof ConnectionReference) {
                        final ConnectionReference cr = (ConnectionReference) bo;
                        enableConnectionReferenceNodes(descendantBoToQueryable, cr);
                    }
                    return new FlowSegmentReference(io, container);
                }
            } else if (bo instanceof NamedElement) {
                final RelativeBusinessObjectReference ref = getRelativeBusinessObjectReference(bo);
                if (ref != null) {
                    ensureEnabledChild(bo, container);
                }
                if (bo instanceof FlowSpecification) {
                    final FlowSpecification fs = (FlowSpecification) bo;
                    if (fs.getAllInEnd() != null) {
                        enableFlowEnd(fs.getAllInEnd(), container);
                    }
                    if (fs.getAllOutEnd() != null) {
                        enableFlowEnd(fs.getAllOutEnd(), container);
                    }
                } else if (bo instanceof Connection) {
                    final Connection connection = (Connection) bo;
                    final ConnectionEnd dstEnd = connection.getAllDestination();
                    final Context dstContext = connection.getAllDestinationContext();
                    final RelativeBusinessObjectReference dstEndRef = getRelativeBusinessObjectReference(dstEnd);
                    // Destination context
                    BusinessObjectNode ctxContainer = getContextContainer(dstContext, container);
                    if (ctxContainer.getChild(dstEndRef) == null) {
                        createNode(ctxContainer, dstEndRef, dstEnd);
                    }
                    final ConnectionEnd srcEnd = connection.getAllSource();
                    final Context srcContext = connection.getAllSourceContext();
                    // Source context
                    ctxContainer = getContextContainer(srcContext, container);
                    final RelativeBusinessObjectReference srcEndRef = getRelativeBusinessObjectReference(srcEnd);
                    if (ctxContainer.getChild(srcEndRef) == null) {
                        createNode(ctxContainer, srcEndRef, srcEnd);
                    }
                }
                return new FlowSegmentReference((NamedElement) bo, container);
            } else {
                throw new RuntimeException("Unexpected business object: " + bo);
            }
        }

        private BusinessObjectNode getContextContainer(final Context context, final BusinessObjectNode contextContainer) {
            if (context != null) {
                // Ensure context container is created
                final RelativeBusinessObjectReference contextRef = getRelativeBusinessObjectReference(context);
                if (contextContainer.getChild(contextRef) == null) {
                    // Show context
                    createNode(contextContainer, contextRef, context);
                }
                return contextContainer.getChild(contextRef);
            }
            return contextContainer;
        }

        private void enableFlowEnd(final FlowEnd flowEnd, BusinessObjectNode containerNode) {
            final Feature feature = (Feature) flowEnd.getFeature();
            if (flowEnd.getContext() != null) {
                containerNode = ensureEnabledChild(flowEnd.getContext(), containerNode);
            }
            ensureEnabledChild(feature, containerNode);
        }

        private void enableFlowSpecificationInstanceNodes(final Map<Object, BusinessObjectContext> descendantBoToQueryable, final FlowSpecificationInstance fsi) {
            enableAncestorNodes(descendantBoToQueryable, fsi);
            if (fsi.getDestination() != null) {
                enableAncestorNodes(descendantBoToQueryable, fsi.getDestination());
            }
            if (fsi.getSource() != null) {
                enableAncestorNodes(descendantBoToQueryable, fsi.getSource());
            }
        }

        private void enableConnectionReferenceNodes(final Map<Object, BusinessObjectContext> descendantBoToQueryable, final ConnectionReference cr) {
            Element tmpElement = cr;
            // Ancestors to ensure are enabled on the diagram
            final Queue<Element> ancestors = Collections.asLifoQueue(new LinkedList<Element>());
            if (!descendantBoToQueryable.containsKey(tmpElement)) {
                ancestors.add(tmpElement);
                tmpElement = tmpElement.getOwner();
                // First owner of connection reference is connection instance
                if (tmpElement instanceof ConnectionInstance) {
                    tmpElement = tmpElement.getOwner();
                }
            }
            // Connection reference
            populateAncestorsQueue(descendantBoToQueryable, ancestors, tmpElement);
            enableAncestorNodes(descendantBoToQueryable, ancestors, ancestors.poll());
            // Enable source and destination nodes
            enableAncestorNodes(descendantBoToQueryable, cr.getSource());
            enableAncestorNodes(descendantBoToQueryable, cr.getDestination());
        }

        // Gets the first element ancestor that is enabled
        private void populateAncestorsQueue(final Map<Object, BusinessObjectContext> descendantBoToQueryable, final Queue<Element> ancestors, Element ancestor) {
            while (!descendantBoToQueryable.containsKey(ancestor)) {
                ancestors.add(ancestor);
                ancestor = ancestor.getOwner();
            }
            ancestors.add(ancestor);
        }

        // Find ancestors and create if necessary
        private void enableAncestorNodes(final Map<Object, BusinessObjectContext> descendantBoToQueryable, final Element ancestor) {
            final Queue<Element> ancestors = Collections.asLifoQueue(new LinkedList<Element>());
            populateAncestorsQueue(descendantBoToQueryable, ancestors, ancestor);
            enableAncestorNodes(descendantBoToQueryable, ancestors, ancestors.poll());
        }

        // Create ancestor nodes
        private void enableAncestorNodes(final Map<Object, BusinessObjectContext> descendantBoToQueryable, final Queue<Element> ancestors, final Element ancestor) {
            BusinessObjectNode ancestorNode = (BusinessObjectNode) descendantBoToQueryable.get(ancestor);
            for (final Element ancestorToEnable : ancestors) {
                final RelativeBusinessObjectReference ancestorRef = getRelativeBusinessObjectReference(ancestorToEnable);
                if (ancestorNode.getChild(ancestorRef) == null) {
                    ancestorNode = createNode(ancestorNode, ancestorRef, ancestorToEnable);
                }
            }
        }

        private BusinessObjectNode ensureEnabledChild(final Object childBo, final BusinessObjectNode parent) {
            final RelativeBusinessObjectReference childRef = getRelativeBusinessObjectReference(childBo);
            final BusinessObjectNode childNode = parent.getChild(childRef);
            if (childRef != null && childNode == null) {
                return createNode(parent, childRef, childBo);
            }
            return Objects.requireNonNull(childNode, "Child node does not exist");
        }

        private BusinessObjectNode createNode(final BusinessObjectNode parent, final RelativeBusinessObjectReference childRef, final Object childBo) {
            return new BusinessObjectNode(parent, UUID.randomUUID(), childRef, childBo, Completeness.UNKNOWN, false);
        }

        private RelativeBusinessObjectReference getRelativeBusinessObjectReference(final Object bo) {
            final RelativeBusinessObjectReference result = referenceService.getRelativeReference(bo);
            return result;
        }
    });
    return showFlowBtn;
}
Also used : Element(org.osate.aadl2.Element) DiagramElementLayoutUtil(org.osate.ge.internal.diagram.runtime.layout.DiagramElementLayoutUtil) EndToEndFlowInstance(org.osate.aadl2.instance.EndToEndFlowInstance) BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) BusinessObjectContext(org.osate.ge.BusinessObjectContext) FlowSegmentState(org.osate.ge.aadl2.ui.internal.editor.FlowContributionItem.FlowSegmentState) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference) IEditorPart(org.eclipse.ui.IEditorPart) ConnectionEnd(org.osate.aadl2.ConnectionEnd) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) FlowSpecification(org.osate.aadl2.FlowSpecification) Button(org.eclipse.swt.widgets.Button) AadlInstanceObjectUtil(org.osate.ge.aadl2.internal.util.AadlInstanceObjectUtil) Connection(org.osate.aadl2.Connection) UUID(java.util.UUID) FlowSegmentReference(org.osate.ge.aadl2.internal.util.AadlFlowSpecificationUtil.FlowSegmentReference) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) Stream(java.util.stream.Stream) EndToEndFlowElement(org.osate.aadl2.EndToEndFlowElement) SWT(org.eclipse.swt.SWT) EndToEndFlowSegment(org.osate.aadl2.EndToEndFlowSegment) Optional(java.util.Optional) Queue(java.util.Queue) EndToEndFlow(org.osate.aadl2.EndToEndFlow) InstanceObject(org.osate.aadl2.instance.InstanceObject) FlowSegment(org.osate.aadl2.FlowSegment) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) DiagramToBusinessObjectTreeConverter(org.osate.ge.internal.diagram.runtime.updating.DiagramToBusinessObjectTreeConverter) Feature(org.osate.aadl2.Feature) ProjectReferenceService(org.osate.ge.internal.services.ProjectReferenceService) ComponentImplementation(org.osate.aadl2.ComponentImplementation) Function(java.util.function.Function) InternalDiagramEditor(org.osate.ge.internal.ui.editor.InternalDiagramEditor) HighlightableFlowInfo(org.osate.ge.aadl2.ui.internal.editor.FlowContributionItem.HighlightableFlowInfo) Predicates(com.google.common.base.Predicates) FlowEnd(org.osate.aadl2.FlowEnd) LinkedList(java.util.LinkedList) Subcomponent(org.osate.aadl2.Subcomponent) Activator(org.osate.ge.internal.Activator) Completeness(org.osate.ge.internal.diagram.runtime.updating.Completeness) BusinessObjectTreeUpdater(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectTreeUpdater) ControlContribution(org.eclipse.jface.action.ControlContribution) Context(org.osate.aadl2.Context) DiagramUpdater(org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater) AadlClassifierUtil(org.osate.ge.aadl2.internal.util.AadlClassifierUtil) ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) ImageDescriptor(org.eclipse.jface.resource.ImageDescriptor) Adapters(org.eclipse.core.runtime.Adapters) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) ConnectionReference(org.osate.aadl2.instance.ConnectionReference) FlowElement(org.osate.aadl2.FlowElement) ExecutionMode(org.osate.ge.internal.services.ActionExecutor.ExecutionMode) SelectionEvent(org.eclipse.swt.events.SelectionEvent) NamedElement(org.osate.aadl2.NamedElement) FlowSpecificationInstance(org.osate.aadl2.instance.FlowSpecificationInstance) LayoutInfoProvider(org.osate.ge.internal.diagram.runtime.layout.LayoutInfoProvider) Collections(java.util.Collections) Control(org.eclipse.swt.widgets.Control) ConnectionInstance(org.osate.aadl2.instance.ConnectionInstance) ComponentImplementation(org.osate.aadl2.ComponentImplementation) BusinessObjectTreeUpdater(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectTreeUpdater) ProjectReferenceService(org.osate.ge.internal.services.ProjectReferenceService) Element(org.osate.aadl2.Element) EndToEndFlowElement(org.osate.aadl2.EndToEndFlowElement) FlowElement(org.osate.aadl2.FlowElement) NamedElement(org.osate.aadl2.NamedElement) RelativeBusinessObjectReference(org.osate.ge.RelativeBusinessObjectReference) FlowSpecificationInstance(org.osate.aadl2.instance.FlowSpecificationInstance) Feature(org.osate.aadl2.Feature) BusinessObjectNode(org.osate.ge.internal.diagram.runtime.updating.BusinessObjectNode) InstanceObject(org.osate.aadl2.instance.InstanceObject) FlowSpecification(org.osate.aadl2.FlowSpecification) Button(org.eclipse.swt.widgets.Button) AgeDiagram(org.osate.ge.internal.diagram.runtime.AgeDiagram) Subcomponent(org.osate.aadl2.Subcomponent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) List(java.util.List) LinkedList(java.util.LinkedList) Queue(java.util.Queue) EndToEndFlow(org.osate.aadl2.EndToEndFlow) BusinessObjectContext(org.osate.ge.BusinessObjectContext) Context(org.osate.aadl2.Context) Optional(java.util.Optional) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) EndToEndFlowSegment(org.osate.aadl2.EndToEndFlowSegment) Connection(org.osate.aadl2.Connection) DiagramUpdater(org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater) FlowSegmentReference(org.osate.ge.aadl2.internal.util.AadlFlowSpecificationUtil.FlowSegmentReference) EndToEndFlowElement(org.osate.aadl2.EndToEndFlowElement) LinkedList(java.util.LinkedList) EndToEndFlowElement(org.osate.aadl2.EndToEndFlowElement) FlowElement(org.osate.aadl2.FlowElement) ConnectionReference(org.osate.aadl2.instance.ConnectionReference) InstanceObject(org.osate.aadl2.instance.InstanceObject) ConnectionEnd(org.osate.aadl2.ConnectionEnd) EndToEndFlowInstance(org.osate.aadl2.instance.EndToEndFlowInstance) EndToEndFlowSegment(org.osate.aadl2.EndToEndFlowSegment) FlowSegment(org.osate.aadl2.FlowSegment) NamedElement(org.osate.aadl2.NamedElement) BusinessObjectContext(org.osate.ge.BusinessObjectContext) Map(java.util.Map) LayoutInfoProvider(org.osate.ge.internal.diagram.runtime.layout.LayoutInfoProvider) FlowEnd(org.osate.aadl2.FlowEnd)

Aggregations

AgeDiagram (org.osate.ge.internal.diagram.runtime.AgeDiagram)3 DiagramUpdater (org.osate.ge.internal.diagram.runtime.updating.DiagramUpdater)3 ExtensionRegistryService (org.osate.ge.internal.services.ExtensionRegistryService)3 ProjectProvider (org.osate.ge.internal.services.ProjectProvider)3 ProjectReferenceService (org.osate.ge.internal.services.ProjectReferenceService)3 Collection (java.util.Collection)2 Collections (java.util.Collections)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Collectors (java.util.stream.Collectors)2 Scene (javafx.scene.Scene)2 IProject (org.eclipse.core.resources.IProject)2 IEclipseContext (org.eclipse.e4.core.contexts.IEclipseContext)2 URI (org.eclipse.emf.common.util.URI)2 GefAgeDiagram (org.osate.ge.gef.ui.diagram.GefAgeDiagram)2 DiagramElement (org.osate.ge.internal.diagram.runtime.DiagramElement)2 DiagramNode (org.osate.ge.internal.diagram.runtime.DiagramNode)2