blob: 977826012e773b8ce3c51aac6cf4c9b8a3c1abf2 [file] [log] [blame]
//------------------------------------------------------------------------------
// Copyright (c) 2005, 2007 IBM Corporation and others.
// 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:
// IBM Corporation - initial implementation
//------------------------------------------------------------------------------
/*
* Copyright (c) 2005, 2006 IBM Corporation and others.
* 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:
* IBM Corporation - initial implementation
*
*/
package org.eclipse.epf.diagramming.edit.policies;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
import org.eclipse.gmf.runtime.notation.View;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.epf.diagramming.edit.parts.ActivityPartition2EditPart;
import org.eclipse.epf.diagramming.part.UMLVisualIDRegistry;
import org.eclipse.uml2.uml.ActivityPartition;
/**
* @generated
*/
public class ActivityPartitionPartitionCampartmentCanonicalEditPolicy extends
CanonicalEditPolicy {
/**
* @modified
*/
protected List getSemanticChildrenList() {
List result = new LinkedList();
EObject modelObject = ((View) getHost().getModel()).getElement();
View viewObject = (View) getHost().getModel();
EObject nextValue;
int nodeVID;
// modified to check ActivityPartition or not. to avoid classcast exception.
if (modelObject instanceof ActivityPartition) {
for (Iterator values = ((ActivityPartition) modelObject)
.getSubpartitions().iterator(); values.hasNext();) {
nextValue = (EObject) values.next();
nodeVID = UMLVisualIDRegistry.getNodeVisualID(viewObject,
nextValue);
if (ActivityPartition2EditPart.VISUAL_ID == nodeVID) {
result.add(nextValue);
}
}
}
return result;
}
/**
* @generated
*/
protected boolean shouldDeleteView(View view) {
return view.isSetElement() && view.getElement() != null
&& view.getElement().eIsProxy();
}
/**
* @generated
*/
protected String getDefaultFactoryHint() {
return null;
}
}