use of org.obeonetwork.dsl.interaction.CombinedFragment in project InformationSystem by ObeoNetwork.
the class DeleteServices method getCombinedFragmentsForParticipant.
private List<CombinedFragment> getCombinedFragmentsForParticipant(Participant participant) {
Interaction interaction = (Interaction) participant.eContainer();
List<CombinedFragment> result = new ArrayList<CombinedFragment>();
for (CombinedFragment combinedFragment : interaction.getCombinedFragments()) {
if (combinedFragment.getCoveredParticipants().size() == 1 && combinedFragment.getCoveredParticipants().contains(participant)) {
result.add(combinedFragment);
}
}
return result;
}
use of org.obeonetwork.dsl.interaction.CombinedFragment in project InformationSystem by ObeoNetwork.
the class DeleteServices method deleteOperand.
public void deleteOperand(Operand operand) {
EObject result = operand.eContainer();
if (result instanceof CombinedFragment) {
CombinedFragment combinedFragment = (CombinedFragment) result;
End startingEnd = operand.getStartingEnd();
End finishingEnd = null;
EList<Operand> siblings = combinedFragment.getOwnedOperands();
if (siblings.size() == 1) {
deleteCombinedFragment(combinedFragment);
return;
}
int index = siblings.indexOf(operand);
if (index == siblings.size() - 1) {
// The last operand ends with the CF
finishingEnd = combinedFragment.getFinishingEnd();
} else {
// Other operands ends when their successor starts
finishingEnd = siblings.get(index + 1).getStartingEnd();
}
delete((Interaction) combinedFragment.eContainer(), startingEnd, finishingEnd, false, combinedFragment.getCoveredParticipants());
}
return;
}
use of org.obeonetwork.dsl.interaction.CombinedFragment in project InformationSystem by ObeoNetwork.
the class InteractionServices method computeCombinedFragmentDepth.
/**
* Compute the depth of a combined fragment. If the EObject if not a
* combined fragment, this method return 0.
*
* @param eobject
* the EObject to find the depth if it is a combined fragment
* @param nbOfColors Total number of colors
* @return the depth if it is a combined fragment.
*/
public int computeCombinedFragmentDepth(EObject eobject, int nbOfColors) {
int combinedFragmentDepth = 0;
if (eobject instanceof CombinedFragment) {
CombinedFragment currentCombinedFragment = (CombinedFragment) eobject;
EList<Participant> coveredParticipants = currentCombinedFragment.getCoveredParticipants();
End start = currentCombinedFragment.getStartingEnd();
EObject eContainer = start.eContainer();
EList<EObject> eContents = eContainer.eContents();
int startIndex = eContents.lastIndexOf(start);
List<EObject> contents = eContents.subList(0, startIndex);
for (EObject obj : contents) {
if (obj instanceof End) {
End end = (End) obj;
if (end.isCombinedFragmentEnd()) {
CombinedFragment combinedFragment = end.getCombinedFragment();
if (covers(end, coveredParticipants)) {
if (combinedFragment.getStartingEnd().equals(end)) {
combinedFragmentDepth++;
} else if (combinedFragment.getFinishingEnd().equals(end)) {
combinedFragmentDepth--;
}
}
}
}
}
}
return getColorDepth(combinedFragmentDepth, nbOfColors);
}
use of org.obeonetwork.dsl.interaction.CombinedFragment in project InformationSystem by ObeoNetwork.
the class InteractionServices method computePredecessorForCombinedFragment.
public CombinedFragment computePredecessorForCombinedFragment(CombinedFragment combinedFragment) {
// Get the preceding end
List<End> precedingEnds = getPrecedingEnds(combinedFragment.getStartingEnd());
// The predecessor is the last CombinedFragment found amongst the preceding combined fragments
CombinedFragment predecessor = null;
for (End end : precedingEnds) {
if (end.isCombinedFragmentEnd() && end.isStartingEnd()) {
predecessor = end.getCombinedFragment();
}
}
return predecessor;
}
use of org.obeonetwork.dsl.interaction.CombinedFragment in project InformationSystem by ObeoNetwork.
the class CombinedFragmentCombinedFragmentPropertiesEditionComponent method initPart.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
* org.eclipse.emf.ecore.resource.ResourceSet)
*/
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
setInitializing(true);
if (editingPart != null && key == partKey) {
editingPart.setContext(elt, allResource);
final CombinedFragment combinedFragment = (CombinedFragment) elt;
final CombinedFragmentPropertiesEditionPart combinedFragmentPart = (CombinedFragmentPropertiesEditionPart) editingPart;
// init values
if (isAccessible(InteractionViewsRepository.CombinedFragment.Properties.name))
combinedFragmentPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, combinedFragment.getName()));
if (isAccessible(InteractionViewsRepository.CombinedFragment.Properties.operator))
combinedFragmentPart.setOperator(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, combinedFragment.getOperator()));
if (isAccessible(InteractionViewsRepository.CombinedFragment.Properties.description))
combinedFragmentPart.setDescription(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, combinedFragment.getDescription()));
// init filters
// init values for referenced views
// init filters for referenced views
}
setInitializing(false);
}
Aggregations