PlanElement pe = theTask.getPlanElement();
PlanElement pe = getTaskPlanElement(theTask, allocationsSub[i]);
  public synchronized void buttonExecute() {    // unallocate tasks allocated to sink and reallocate    int orgAllocCounter = 0;    for (int i = 0; i < tasksSub.length; i++) {      Enumeration eTasks = tasksSub[i].elements();      if (!(eTasks.hasMoreElements()))        continue;      CommandInfo c = allCommands[i];      if (c.type_id == CommandInfo.TYPE_ALLOCATE) {        // allocate        Organization capableOrg = null;        do {          Task theTask = (Task) eTasks.nextElement();          PlanElement pe = theTask.getPlanElement();          if ((pe instanceof Allocation) &&              (((Allocation)pe).getAsset() == sink_asset)) {            // find capable org            if (capableOrg == null) {              capableOrg =                 findCapableOrganization((AllocateCommandInfo)c);              if (capableOrg == null) {                // no capable org found!                break;              }            }            // unallocate from sink            publishRemove(pe);            // allocate to org            doAllocation(capableOrg, theTask);            orgAllocCounter++;          }        } while (eTasks.hasMoreElements());      } else if (c.type_id == CommandInfo.TYPE_EXPAND) {        // expand as usual        TaskInfo[] toTasks = ((ExpandCommandInfo)c).expandTasks;        do {          Task theTask = (Task) eTasks.nextElement();          if (theTask.getPlanElement() == null) {            for (int j = 0; j < toTasks.length; j++) {              doExpansion(toTasks[j], theTask);            }          }        } while (eTasks.hasMoreElements());      } else {        // no other commands!      }    }    for (int i = 0; i < allocationsSub.length; i++) {      updateAllocationResult(allocationsSub[i]);    }    // update GUI    decrementSinkAllocCounter(orgAllocCounter);  }