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) { } }
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(); } }