Search in sources :

Example 1 with CreateEditPoliciesOperation

use of org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation in project Palladio-Editors-Sirius by PalladioSimulator.

the class LinkingResourceEditPolicyProvider method provides.

@Override
public boolean provides(final IOperation operation) {
    if (operation instanceof CreateEditPoliciesOperation) {
        final CreateEditPoliciesOperation castedOperation = (CreateEditPoliciesOperation) operation;
        final EditPart editPart = castedOperation.getEditPart();
        final Object model = editPart.getModel();
        if (model instanceof View) {
            final View view = (View) model;
            // FIXME find right constraints for this filter
            if (view.getDiagram() != null && view.getDiagram().getElement() != null && view.getDiagram().getElement().eClass().getEPackage().getNsURI().equals(DiagramPackage.eINSTANCE.getNsURI())) {
                if (("SomeVisualID").equals(view.getType())) {
                    return true;
                }
            }
        }
    }
    return false;
}
Also used : CreateEditPoliciesOperation(org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation) EditPart(org.eclipse.gef.EditPart) View(org.eclipse.gmf.runtime.notation.View)

Aggregations

EditPart (org.eclipse.gef.EditPart)1 CreateEditPoliciesOperation (org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation)1 View (org.eclipse.gmf.runtime.notation.View)1