コード例 #1
0
  @Override
  public void run() {
    if (results != null) {
      for (LabResult result : results) {
        final LabResult lockingResult = result;
        AcquireLockBlockingUi.aquireAndRun(
            lockingResult,
            new ILockHandler() {
              @Override
              public void lockFailed() {
                // do nothing
              }

              @Override
              public void lockAcquired() {
                EditLabResultDialog dialog =
                    new EditLabResultDialog(viewer.getControl().getShell(), lockingResult);
                if (dialog.open() == Window.OK) {
                  ElexisEventDispatcher.reload(LabResult.class);
                }
              }
            });
      }
    } else if (orders != null) {
      for (LabOrder order : orders) {
        ILabResult result = order.getLabResult();
        if (result == null) {
          result = order.createResult();
          result.setTransmissionTime(new TimeTool());
        }
        final LabResult lockingResult = (LabResult) result;
        final LabOrder lockingOrder = order;
        AcquireLockBlockingUi.aquireAndRun(
            lockingResult,
            new ILockHandler() {
              @Override
              public void lockFailed() {
                // do nothing
              }

              @Override
              public void lockAcquired() {
                EditLabResultDialog dialog =
                    new EditLabResultDialog(viewer.getControl().getShell(), lockingResult);
                if (dialog.open() == Window.OK) {
                  lockingOrder.setState(State.DONE);
                  ElexisEventDispatcher.reload(LabResult.class);
                }
              }
            });
      }
    }
  }
コード例 #2
0
 @Override
 public boolean isEnabled() {
   if (results != null) {
     for (LabResult result : results) {
       if (result.getItem() != null) {
         if (result.getItem().getTyp() == LabItemTyp.DOCUMENT
             || result.getItem().getTyp() == LabItemTyp.FORMULA) {
           return false;
         }
       }
     }
   } else if (orders != null) {
     for (LabOrder order : orders) {
       if (order.getLabItem() != null) {
         if (order.getLabItem().getTyp() == LabItemTyp.DOCUMENT
             || order.getLabItem().getTyp() == LabItemTyp.FORMULA) {
           return false;
         }
       }
     }
   }
   return super.isEnabled();
 }