Search in sources :

Example 1 with ChangeViewpointSelectionCommand

use of org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand in project Palladio-Editors-Sirius by PalladioSimulator.

the class SiriusCustomUtil method selectViewpoints.

public static void selectViewpoints(Session session, HashSet<Viewpoint> viewpoints, boolean createRepresentation, IProgressMonitor monitor) {
    final ViewpointSelectionCallback selectionCallback = new ViewpointSelectionCallback();
    final TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
    Collection<Viewpoint> selectedViewpoints = session.getSelectedViewpoints(false);
    for (Viewpoint v : viewpoints) {
        if (selectedViewpoints.contains(v))
            viewpoints.remove(v);
    }
    @SuppressWarnings("restriction") final Command command = new ChangeViewpointSelectionCommand(session, selectionCallback, viewpoints, new HashSet<Viewpoint>(), createRepresentation, SubMonitor.convert(monitor));
    domain.getCommandStack().execute(command);
}
Also used : TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) CreateRepresentationCommand(org.eclipse.sirius.business.api.dialect.command.CreateRepresentationCommand) ChangeViewpointSelectionCommand(org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand) Command(org.eclipse.emf.common.command.Command) Viewpoint(org.eclipse.sirius.viewpoint.description.Viewpoint) ChangeViewpointSelectionCommand(org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand) ViewpointSelectionCallback(org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelectionCallback)

Aggregations

Command (org.eclipse.emf.common.command.Command)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 CreateRepresentationCommand (org.eclipse.sirius.business.api.dialect.command.CreateRepresentationCommand)1 ViewpointSelectionCallback (org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelectionCallback)1 ChangeViewpointSelectionCommand (org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand)1 Viewpoint (org.eclipse.sirius.viewpoint.description.Viewpoint)1