blob: 465c9682f2e14631f4a177ac510e0d3c565b1f1b [file] [log] [blame]
/**
*
* Copyright (c) 2011, 2016 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (69115 Heidelberg, Germany)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Florian Pirchner (Lunifera GmbH) - initial implementation
*/
package org.eclipse.osbp.tools.graphical.entity.lib;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.osbp.dsl.semantic.entity.LEntity;
import org.eclipse.sirius.business.api.helper.SiriusUtil;
import org.eclipse.sirius.business.api.session.Session;
import org.eclipse.sirius.business.api.session.SessionManager;
import org.eclipse.sirius.tools.api.ui.IExternalJavaAction;
public class LEntityDeletion implements IExternalJavaAction {
public LEntityDeletion() {
}
@Override
public void execute(Collection<? extends EObject> selections,
Map<String, Object> parameters) {
LEntity entity = (LEntity) new ArrayList<EObject>(selections).get(0);
Session session = SessionManager.INSTANCE.getSession(entity);
SiriusUtil.delete(entity, session);
// Collection<Setting> crossRefs = EcoreUtil.UsageCrossReferencer.find(entity, entity.eResource().getResourceSet());
// for(Setting e : crossRefs){
// System.out.println(e);
// }
//
// LTypedPackage packag = (LTypedPackage) entity.eContainer();
// packag.getTypes().remove(entity);
}
@Override
public boolean canExecute(Collection<? extends EObject> selections) {
return true;
}
}