[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Programmatically drag and drop

Hi everybody,

I need some help with the various Request subclasses of GMF-runtime.
In my EMF model the class "Component" has a reference "contains" to itself, 
so that a Component can contain several other "Components". I already have a 
GMF-generated editor for my model.

So for example, let C_A be a Component which contains Components C_A1 and 
C_A2. And let C_B be an other Component.
What I want to do is programmatically move C_A1 and C_A2 to C_B, so that C_B 
contains C_A1 and C_A2 and C_A is "empty".

I already tried SetRequest&DestroyRequest and MoveRequest, but it is not 
working like I exepected it. So basically all I want to do is simulate a d&d 
programmtically.


My underlying gmf model loks like this:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"; 
name="ConnectorComponent"
    nsURI="www.iese.fraunhofer.de/ConnectorComponent" nsPrefix="cmpnt">
  <eClassifiers xsi:type="ecore:EClass" name="AbstractComponent" 
abstract="true" eSuperTypes="#//ArchitecturalElements">
    <eStructuralFeatures xsi:type="ecore:EReference" name="contains" 
upperBound="-1"
        eType="#//AbstractComponent" containment="true"/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" 
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="AbstractConnector" 
abstract="true" eSuperTypes="#//ArchitecturalElements">
    <eStructuralFeatures xsi:type="ecore:EReference" name="source" 
lowerBound="1"
        eType="#//AbstractComponent"/>
    <eStructuralFeatures xsi:type="ecore:EReference" name="target" 
lowerBound="1"
        eType="#//AbstractComponent"/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" 
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="ArchitecturalDescription">
    <eStructuralFeatures xsi:type="ecore:EReference" name="has" 
upperBound="-1" eType="#//ArchitecturalElements"
        containment="true"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="ArchitecturalElements" 
abstract="true"/>
  <eClassifiers xsi:type="ecore:EClass" name="Connector" 
eSuperTypes="#//AbstractConnector"/>
  <eClassifiers xsi:type="ecore:EClass" name="Component" 
eSuperTypes="#//AbstractComponent"/>
</ecore:EPackage>

Input: