use of org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog in project Palladio-Editors-Sirius by PalladioSimulator.
the class ApplyUnapplyProfileAction method execute.
@SuppressWarnings("unchecked")
@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
final EObject target = ((DSemanticDecorator) selections.iterator().next()).getTarget();
final Resource targetResource = target.eResource();
final FeatureEditorDialog profileSelectionDialog = new FeatureEditorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), LABEL_PROVIDER, target, target.eClass().getEAllStructuralFeatures().get(0).getEType(), ProfileAPI.getAppliedProfiles(targetResource), SELECT_APPLIED_PROFILES_MESSAGE, ProfileAPI.getApplicableProfiles(), false, true, true);
if (profileSelectionDialog.open() == Dialog.OK) {
ProfileAPI.updateProfileApplications(targetResource, (EList<Profile>) profileSelectionDialog.getResult());
}
}
use of org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog in project Palladio-Editors-Sirius by PalladioSimulator.
the class ApplyUnapplyStereotypeAction method execute.
@SuppressWarnings("unchecked")
@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
final EObject target = ((DSemanticDecorator) selections.iterator().next()).getTarget();
final boolean targetHasProfileApplication = ProfileAPI.hasProfileApplication(target.eResource());
final FeatureEditorDialog stereotypeSelectionDialog = new FeatureEditorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), LABEL_PROVIDER, target, target.eClass().getEAllStructuralFeatures().get(0).getEType(), targetHasProfileApplication ? StereotypeAPI.getAppliedStereotypes(target) : Collections.EMPTY_LIST, SELECT_APPLIED_STEREOTYPES_MESSAGE, targetHasProfileApplication ? StereotypeAPI.getApplicableStereotypes(target) : Collections.EMPTY_LIST, true, false, false);
if (stereotypeSelectionDialog.open() == Dialog.OK) {
StereotypeAPI.updateStereotypeApplications(target, (EList<Stereotype>) stereotypeSelectionDialog.getResult());
}
}
Aggregations