Search in sources :

Example 1 with GraphicalEditorService

use of org.osate.ge.services.GraphicalEditorService in project AGREE by loonwerks.

the class VariablesView method showInGraphicalView.

private void showInGraphicalView(final InstanceObject io) {
    assert (io != null);
    // Open the graphical editor
    final GraphicalEditorService editorService = Objects.requireNonNull(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(GraphicalEditorService.class), "unable to retrieve Graphical Editor Service");
    final SimulationEngine engine = simulationUiService.getCurrentState().getSimulationEngine();
    if (engine != null && engine.getSystemInstance() != null) {
        final GraphicalEditor editor = editorService.openBusinessObject(engine.getSystemInstance());
        editor.selectDiagramElementsForBusinessObject(io);
    }
    ;
}
Also used : SimulationEngine(edu.uah.rsesc.aadlsimulator.SimulationEngine) GraphicalEditorService(org.osate.ge.services.GraphicalEditorService) GraphicalEditor(org.osate.ge.GraphicalEditor)

Example 2 with GraphicalEditorService

use of org.osate.ge.services.GraphicalEditorService in project AGREE by loonwerks.

the class OpenGraphicalViewHandler method execute.

public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
        // Open the graphical editor
        final SimulationUIService simulationUiService = (SimulationUIService) Objects.requireNonNull(PlatformUI.getWorkbench().getService(SimulationUIService.class), "unable to get simulation UI service");
        final GraphicalEditorService editorService = Objects.requireNonNull((GraphicalEditorService) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(GraphicalEditorService.class), "unable to retrieve Graphical Editor Service");
        final SimulationEngine engine = simulationUiService.getCurrentState().getSimulationEngine();
        if (engine != null && engine.getSystemInstance() != null) {
            editorService.openBusinessObject(engine.getSystemInstance());
        }
        ;
    } catch (final Exception ex) {
        final Status status = new Status(IStatus.ERROR, FrameworkUtil.getBundle(getClass()).getSymbolicName(), "Error", ex);
        StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
    }
    return null;
}
Also used : SimulationUIService(edu.uah.rsesc.aadlsimulator.ui.services.SimulationUIService) SimulationEngine(edu.uah.rsesc.aadlsimulator.SimulationEngine) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) GraphicalEditorService(org.osate.ge.services.GraphicalEditorService) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

SimulationEngine (edu.uah.rsesc.aadlsimulator.SimulationEngine)2 GraphicalEditorService (org.osate.ge.services.GraphicalEditorService)2 SimulationUIService (edu.uah.rsesc.aadlsimulator.ui.services.SimulationUIService)1 ExecutionException (org.eclipse.core.commands.ExecutionException)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 GraphicalEditor (org.osate.ge.GraphicalEditor)1