コード例 #1
0
 /**
  * Inform that the command has been undone and delete or update the created notification
  *
  * @see
  *     org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#didUndo(org.eclipse.emf.transaction.Transaction)
  * @param tx a transaction that has been undone.
  */
 @Override
 protected void didUndo(Transaction tx) {
   for (ChooseChildrenNotificationConfigurator notifConfigurator :
       createdNotificationConfigurator) {
     notifConfigurator.closeNotification();
   }
   super.didUndo(tx);
 }
コード例 #2
0
 @Override
 protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   if (!getEditPartFromEditPartAdapter()) {
     if (!allChildren.isEmpty()) {
       getEditPartFromViewAdapter(allChildren.get(0));
     }
   }
   if (mainEditPart != null) {
     createdNotificationConfigurator = new ArrayList<ChooseChildrenNotificationConfigurator>();
     NotificationConfigurator configurator =
         PendingGroupNotificationsManager.getInstanceForDiagram(diagramPart)
             .getChooseChildrenPendingNotification(mainEditPart);
     ChooseChildrenNotificationConfigurator notificationConfigurator = null;
     if (configurator == null) {
       // If there is no a pending notification for this main edit part then it create one
       if (!allChildren.isEmpty() && isChildrenToChoose()) {
         notificationConfigurator =
             new ChooseChildrenNotificationConfigurator(
                 mainEditPart, allChildren, automaticChildren, host, manager);
         notificationConfigurator.runConfigurator();
       }
     } else {
       // Else update the old one if needed TODO TODO
       // 1 - Compare if there is any modification TODO
       if (configurator instanceof ChooseChildrenNotificationConfigurator) {
         notificationConfigurator = (ChooseChildrenNotificationConfigurator) configurator;
         if (notificationConfigurator.isThereAnyModification(
             mainEditPart, allChildren, automaticChildren, host)) {
           // 2 - There are some update the old notification TODO
           notificationConfigurator.closeNotification();
           if (!allChildren.isEmpty() && isChildrenToChoose()) {
             notificationConfigurator =
                 new ChooseChildrenNotificationConfigurator(
                     mainEditPart, allChildren, automaticChildren, host, manager);
             notificationConfigurator.runConfigurator();
           }
         }
       }
     }
     if (notificationConfigurator != null) {
       createdNotificationConfigurator.add(notificationConfigurator);
     }
     return CommandResult.newOKCommandResult();
   }
   return CommandResult.newErrorCommandResult(
       "The editPart of the adaptable element has not been found"); //$NON-NLS-1$
 }