use of fr.gouv.mindef.safran.database.scaffold.ScaffoldType in project InformationSystem by ObeoNetwork.
the class AddAdditionalObjectsWizard method performFinish.
/* (non-Javadoc)
* @see org.eclipse.jface.wizard.Wizard#performFinish()
*/
public boolean performFinish() {
final Collection<EObject> newAdditionalObjects1 = additionalResourcesPage.getAdditionalObjects1();
final Collection<EObject> newAdditionalObjects2 = additionalResourcesPage.getAdditionalObjects2();
final boolean hasBeenModified1 = hasBeenModified(scaffoldInfo.getLeftToRightAdditionalObjects(), newAdditionalObjects1);
final boolean hasBeenModified2 = hasBeenModified(scaffoldInfo.getRightToLeftAdditionalObjects(), newAdditionalObjects2);
if (hasBeenModified1 || hasBeenModified2) {
Session session = SessionManager.INSTANCE.getSession(scaffoldInfo);
TransactionalEditingDomain editingDomain = session.getTransactionalEditingDomain();
RecordingCommand updatingCmd = new RecordingCommand(editingDomain, "Updating additional objects") {
@Override
protected void doExecute() {
if (hasBeenModified1) {
ScaffoldType leftToRightScaffoldType = scaffoldInfo.getLeftToRightTransformationType();
scaffoldInfo.clearAdditionalObjectsForTransformation(leftToRightScaffoldType);
for (EObject newObject : newAdditionalObjects1) {
scaffoldInfo.addAdditionalObjectsForTransformation(newObject, leftToRightScaffoldType);
}
}
if (hasBeenModified2) {
ScaffoldType rightToleftScaffoldType = scaffoldInfo.getRightToLeftTransformationType();
scaffoldInfo.clearAdditionalObjectsForTransformation(rightToleftScaffoldType);
for (EObject newObject : newAdditionalObjects2) {
scaffoldInfo.addAdditionalObjectsForTransformation(newObject, rightToleftScaffoldType);
}
}
}
};
editingDomain.getCommandStack().execute(updatingCmd);
}
return true;
}
use of fr.gouv.mindef.safran.database.scaffold.ScaffoldType in project InformationSystem by ObeoNetwork.
the class SpecifyAdditionalObjects2WaysPage method createControl.
/**
* Create contents of the wizard.
* @param parent
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NULL);
setControl(container);
container.setLayout(new GridLayout(1, false));
Session session = SessionManager.INSTANCE.getSession(scaffoldInfo);
ScaffoldType scaffoldType1 = scaffoldInfo.getLeftToRightTransformationType();
EObject target1 = scaffoldInfo.getRightObject();
Collection<EObject> additionalObjects1 = new ArrayList<EObject>(scaffoldInfo.getLeftToRightAdditionalObjects());
ScaffoldType scaffoldType2 = scaffoldInfo.getRightToLeftTransformationType();
EObject target2 = scaffoldInfo.getLeftObject();
Collection<EObject> additionalObjects2 = new ArrayList<EObject>(scaffoldInfo.getRightToLeftAdditionalObjects());
Label lbl1 = new Label(container, SWT.NONE);
lbl1.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
lbl1.setText(scaffoldType1.getName() + " :");
additionalObjectsComposite1 = new AdditionalObjectsComposite(container, session, scaffoldType1, target1, additionalObjects1);
additionalObjectsComposite1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
new Label(container, SWT.NONE);
Label lbl2 = new Label(container, SWT.NONE);
lbl2.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
lbl2.setText(scaffoldType2.getName() + " :");
additionalObjectsComposite2 = new AdditionalObjectsComposite(container, session, scaffoldType2, target2, additionalObjects2);
additionalObjectsComposite2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
}
use of fr.gouv.mindef.safran.database.scaffold.ScaffoldType in project InformationSystem by ObeoNetwork.
the class TestInputIsScaffoldModel method test.
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof StructuredSelection) {
StructuredSelection selection = (StructuredSelection) receiver;
if (selection.size() == 1) {
Object element = selection.getFirstElement();
if (args != null && args.length >= 1) {
String kind = (String) args[0];
ScaffoldType scaffoldType;
if (ANY.equals(kind)) {
scaffoldType = null;
} else {
scaffoldType = getCorrespondingScaffoldType(kind);
}
if (element instanceof Resource) {
Resource resource = (Resource) element;
return handleScaffoldModel(resource, scaffoldType);
} else {
URI uri = getModelURI(element);
return handleScaffoldModel(uri, scaffoldType);
}
}
}
}
return false;
}
use of fr.gouv.mindef.safran.database.scaffold.ScaffoldType in project InformationSystem by ObeoNetwork.
the class TestMultipleInputIsValid method test.
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
if (receiver instanceof StructuredSelection) {
StructuredSelection selection = (StructuredSelection) receiver;
if (selection.size() == 2) {
if (args != null && args.length >= 1) {
String kind = (String) args[0];
Iterator<?> iterator = selection.iterator();
Object element1 = iterator.next();
Object element2 = iterator.next();
ScaffoldType scaffoldType = getCorrespondingScaffoldType(kind);
return isSelectionValidFor(element1, element2, scaffoldType);
}
}
}
return false;
}
Aggregations