Пример #1
0
    @Override
    protected EObject doRun(CDOTransaction transaction, CDOObject parent, ISelection selection) {
      ComposedAdapterFactory adapterFactory = CDOEditor.createAdapterFactory(true);

      try {
        BasicCommandStack commandStack = new BasicCommandStack();
        ResourceSet resourceSet = transaction.getResourceSet();

        EditingDomain editingDomain =
            new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);

        CreateChildAction delegate =
            new CreateChildAction(editingDomain, selection, childDescriptor);
        delegate.run();

        if (childDescriptor instanceof CommandParameter) {
          CommandParameter parameter = (CommandParameter) childDescriptor;
          Object value = parameter.getValue();
          if (value instanceof EObject) {
            return (EObject) value;
          }
        }

        return null;
      } finally {
        adapterFactory.dispose();
      }
    }
 /** {@inheritDoc} */
 @Override
 protected boolean isMine(final CommandParameter object) {
   if (object.getEReference() != null && (valids.size() + restricted.size() > 0)) {
     final EObject value = (EObject) object.getValue();
     return isMyTargetType(value);
   }
   return true;
 }