use of org.eclipse.emf.transaction.TransactionalEditingDomain 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);
}
use of org.eclipse.emf.transaction.TransactionalEditingDomain in project Palladio-Editors-Sirius by PalladioSimulator.
the class SiriusCustomUtil method createRepresentation.
public static DRepresentation createRepresentation(Session session, String representationName, RepresentationDescription description, EObject semantic, IProgressMonitor monitor) {
TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
final CreateRepresentationCommand createRepresentationCommand = new CreateRepresentationCommand(session, description, semantic, representationName, SubMonitor.convert(monitor));
domain.getCommandStack().execute(createRepresentationCommand);
return createRepresentationCommand.getCreatedRepresentation();
}
use of org.eclipse.emf.transaction.TransactionalEditingDomain in project Palladio-Editors-Sirius by PalladioSimulator.
the class EventTypesEditorSection method createViewerCellEditors.
/* (non-Javadoc)
* @see org.palladiosimulator.editors.commons.tabs.generic.EditorSection#createViewerCellEditors(org.eclipse.swt.widgets.Table)
*/
@Override
protected CellEditor[] createViewerCellEditors(Table table) {
CellEditor[] editors = new CellEditor[columnNames.length];
editors[EVENTTYPENAME_COLUMN_INDEX] = new TextCellEditor(table);
// create 'DeleteCellValueListener' and as SelectionListener to the 'TableVewer'
EventTypeDeleteCellValueListener cellValueListener = new EventTypeDeleteCellValueListener(viewer);
viewer.addSelectionChangedListener(cellValueListener);
editors[PARAMETER_NAME_COLUMN_INDEX] = new TextCellEditor(table);
editors[PARAMETER_TYPE_COLUMN_INDEX] = new TypeDialogCellEditor(table, cellValueListener) {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.DialogCellEditor#openDialogBox(org.eclipse.swt.widgets.Control)
*/
@Override
protected Object openDialogBox(Control cellEditorWindow) {
TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(getSelectedEventType());
ArrayList<Object> filterList = new ArrayList<Object>();
filterList.add(DataType.class);
filterList.add(Repository.class);
ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
CallDataTypeDialog dialog = new CallDataTypeDialog(cellEditorWindow.getShell(), filterList, additionalReferences, editingDomain.getResourceSet());
dialog.setProvidedService(DataType.class);
dialog.open();
if (!(dialog.getResult() instanceof DataType))
return null;
return dialog.getResult();
}
};
return editors;
}
use of org.eclipse.emf.transaction.TransactionalEditingDomain in project Palladio-Editors-Sirius by PalladioSimulator.
the class ResourceSelectorPage method getResult.
protected EObject getResult(Session session) {
EObject result = null;
URI uri = URI.createURI(path, true);
TransactionalEditingDomain domain = session.getTransactionalEditingDomain();
ResourceSet resourceSet = domain.getResourceSet();
try {
Resource resource = resourceSet.getResource(uri, true);
result = (EObject) resource.getContents().get(0);
} catch (WrappedException ex) {
// do nothing
}
return result;
}
use of org.eclipse.emf.transaction.TransactionalEditingDomain in project tdi-studio-se by Talend.
the class BusinessGraphicalNodeEditPolicy method getConnectionWithReorientedViewCompleteCommand.
/**
* @generated
*/
protected Command getConnectionWithReorientedViewCompleteCommand(CreateConnectionRequest request) {
ICommandProxy c = (ICommandProxy) super.getConnectionCompleteCommand(request);
CompositeCommand cc = (CompositeCommand) c.getICommand();
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
BusinessReorientConnectionViewCommand rcvCommand = new BusinessReorientConnectionViewCommand(editingDomain, null);
rcvCommand.setEdgeAdaptor(getViewAdapter());
cc.compose(rcvCommand);
return c;
}
Aggregations