blob: 6d1e3a094ca92b0e9308c68f0e694096acd0dacb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/**
* Copyright (c) 2011 Mia-Software.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Nicolas Guyomar (Mia-Software) - Bug 349546 - EMF Facet facetSet editor
*/
package org.eclipse.papyrus.emf.facet.efacet.ui.internal.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.domain.IEditingDomainProvider;
import org.eclipse.papyrus.emf.facet.efacet.ui.internal.IFacetUIFactory;
import org.eclipse.papyrus.emf.facet.efacet.ui.internal.exported.wizard.IFacetChildrenWizard;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
/**
* This class handle the action "Add facet attribute"
*/
@Deprecated
//TODO @Deprecated must be removed after a refactoring planed by https://bugs.eclipse.org/bugs/show_bug.cgi?id=364601
public class AddFacetAttributeHandler extends AbstractHandler {
public Object execute(final ExecutionEvent event) throws ExecutionException {
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
// Retrieve the editor
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
// Retrieve the editing domain
EditingDomain editingDomain = ((IEditingDomainProvider) editor).getEditingDomain();
IFacetChildrenWizard dialog = IFacetUIFactory.INSTANCE.createAddFacetAttributeWizardDialog(selection, editingDomain);
dialog.canChangeFacet(false);
dialog.setLowerBound(0);
dialog.setUpperBound(0);
dialog.open();
return null;
}
}
|