Example #1
0
 public void actionPerformed(ActionEvent e) {
   Object source = e.getSource();
   if (source instanceof UMLComboBox2) {
     UMLComboBox2 box = (UMLComboBox2) source;
     Object diagram = box.getTarget();
     Object homeModel = box.getSelectedItem();
     if (diagram instanceof Relocatable) {
       Relocatable d = (Relocatable) diagram;
       if (d.isRelocationAllowed(homeModel)) {
         d.relocate(homeModel);
       }
     }
   }
 }
Example #2
0
 @Override
 protected void buildModelList() {
   Object target = getTarget();
   List list = new ArrayList();
   if (target instanceof Relocatable) {
     Relocatable diagram = (Relocatable) target;
     for (Object obj :
         diagram.getRelocationCandidates(getModelManagementFactory().getRootModel())) {
       if (diagram.isRelocationAllowed(obj)) {
         list.add(obj);
       }
     }
   }
   /* This should not be needed if the above is correct,
    * but let's be sure: */
   list.add(getSelectedModelElement());
   Collections.sort(list, new PathComparator());
   setElements(list);
 }