コード例 #1
0
ファイル: ModuleDropTarget.java プロジェクト: HUSACCT/HUSACCT
  private void changeSoftwareUnitLocation(DropTargetDropEvent arg) {
    try {

      String result = ((String) arg.getTransferable().getTransferData(currentFlavor));
      Object[] namesAndTypes = DragAndDropHelper.interpretObjects(result);
      ArrayList<String> names = (ArrayList<String>) namesAndTypes[0];
      ArrayList<String> types = (ArrayList<String>) namesAndTypes[1];
      SoftwareUnitController controller =
          new SoftwareUnitController(getSelectedNode(arg).getModuleId());
      controller.changeSoftwareUnit(getSelectedNode(arg).getModuleId(), names);
    } catch (Exception e) {

    }
  }
コード例 #2
0
ファイル: ModuleDropTarget.java プロジェクト: HUSACCT/HUSACCT
  private void addSoftwareUnits(DropTargetDropEvent arg) {
    try {

      AnalyzedModuleTree palo =
          (AnalyzedModuleTree) arg.getTransferable().getTransferData(currentFlavor);
      ArrayList<AnalyzedModuleComponent> tobesaved = new ArrayList<AnalyzedModuleComponent>();
      for (TreePath pathe : palo.getSelectionPaths()) {

        AnalyzedModuleComponent top = (AnalyzedModuleComponent) pathe.getLastPathComponent();
        String type = top.getType().toLowerCase();
        boolean res =
            ((!type.equals("root")
                && !type.equals("application")
                && !type.equals("externalpackage")));
        if (res) {

          AnalyzedModuleComponent referencedUnit =
              StateService.instance().getAnalyzedSoftWareUnit(top.getUniqueName());
          if (!referencedUnit.isMapped()) {
            tobesaved.add(referencedUnit);
          }
        }
      }

      SoftwareUnitController controller =
          new SoftwareUnitController(getSelectedNode(arg).getModuleId());
      controller.save(tobesaved);

    } catch (UnsupportedFlavorException e) {

      e.printStackTrace();
    } catch (IOException e) {

      e.printStackTrace();
    }
  }