Search in sources :

Example 1 with FeatureEditorDialog

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());
    }
}
Also used : DSemanticDecorator(org.eclipse.sirius.viewpoint.DSemanticDecorator) FeatureEditorDialog(org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog) EObject(org.eclipse.emf.ecore.EObject) Resource(org.eclipse.emf.ecore.resource.Resource) Profile(org.modelversioning.emfprofile.Profile)

Example 2 with FeatureEditorDialog

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());
    }
}
Also used : DSemanticDecorator(org.eclipse.sirius.viewpoint.DSemanticDecorator) FeatureEditorDialog(org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog) EObject(org.eclipse.emf.ecore.EObject) Stereotype(org.modelversioning.emfprofile.Stereotype)

Aggregations

EObject (org.eclipse.emf.ecore.EObject)2 FeatureEditorDialog (org.eclipse.emf.edit.ui.celleditor.FeatureEditorDialog)2 DSemanticDecorator (org.eclipse.sirius.viewpoint.DSemanticDecorator)2 Resource (org.eclipse.emf.ecore.resource.Resource)1 Profile (org.modelversioning.emfprofile.Profile)1 Stereotype (org.modelversioning.emfprofile.Stereotype)1