/*******************************************************************************
* Copyright (c) 2006-2012
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
*
* 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:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Berlin, Germany
* - initial API and implementation
******************************************************************************/
/*
* Copyright (c) 2006, 2007 Borland Software Corporation
*
* 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:
* Dmitry Stadnik (Borland) - initial API and implementation
*/
package org.reuseware.application.taipan.gmf.editor.edit.policies;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
import org.reuseware.application.taipan.TaiPanPackage;
import org.reuseware.application.taipan.gmf.editor.edit.parts.SmallItemsEditPart;
import org.reuseware.application.taipan.gmf.editor.part.TaiPanDiagramUpdater;
import org.reuseware.application.taipan.gmf.editor.part.TaiPanNodeDescriptor;
import org.reuseware.application.taipan.gmf.editor.part.TaiPanVisualIDRegistry;
/**
* @generated
*/
public class ShipSmallCargoCanonicalEditPolicy extends CanonicalEditPolicy {
/**
* @generated
*/
Set myFeaturesToSynchronize;
/**
* @generated
*/
protected List getSemanticChildrenList() {
View viewObject = (View) getHost().getModel();
List result = new LinkedList();
for (Iterator it = TaiPanDiagramUpdater
.getShipSmallCargo_7001SemanticChildren(viewObject).iterator(); it
.hasNext();) {
result.add(((TaiPanNodeDescriptor) it.next()).getModelElement());
}
return result;
}
/**
* @generated
*/
protected boolean isOrphaned(Collection semanticChildren, final View view) {
int visualID = TaiPanVisualIDRegistry.getVisualID(view);
switch (visualID) {
case SmallItemsEditPart.VISUAL_ID:
if (!semanticChildren.contains(view.getElement())) {
return true;
}
}
return false;
}
/**
* @generated
*/
protected String getDefaultFactoryHint() {
return null;
}
/**
* @generated
*/
protected Set getFeaturesToSynchronize() {
if (myFeaturesToSynchronize == null) {
myFeaturesToSynchronize = new HashSet();
myFeaturesToSynchronize
.add(TaiPanPackage.eINSTANCE.getShip_Cargo());
}
return myFeaturesToSynchronize;
}
}