Пример #1
0
  public void drop(DropTargetDropEvent dtde) {
    logger.info("Drop: " + dtde);
    if (dtde.isDataFlavorSupported(OWLObjectDataFlavor.OWL_OBJECT_DATA_FLAVOR)) {
      try {
        List<OWLObject> objects =
            (List<OWLObject>)
                dtde.getTransferable().getTransferData(OWLObjectDataFlavor.OWL_OBJECT_DATA_FLAVOR);
        List<OWLClass> clses = new ArrayList<OWLClass>();
        for (OWLObject obj : objects) {
          if (obj instanceof OWLClass) {
            clses.add((OWLClass) obj);
          }
        }

        if (!clses.isEmpty()) {
          getAssertedGraphComponent().getVisualisedObjectManager().showObjects(clses.toArray());
          dtde.dropComplete(true);
        }
      } catch (UnsupportedFlavorException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }
Пример #2
0
  public void drop(DropTargetDropEvent dtde) {
    dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
    if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
      try {
        content =
            (java.util.List) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);
        repaint();
      } catch (UnsupportedFlavorException e) {
        e.printStackTrace();
      } catch (IOException e) {
        e.printStackTrace();
      }
      dtde.dropComplete(true);

      boolean listsAreEqual = true;

      for (int i = 0; i < content.size(); i++) {
        if (!FileListTransferable.files[i].getName().equals(content.get(i).getName())) {
          listsAreEqual = false;
        }
      }

      if (listsAreEqual) {
        System.err.println(InterprocessMessages.EXECUTION_IS_SUCCESSFULL);
        System.exit(0);
      }
    }
    dtde.rejectDrop();
    System.err.println(InterprocessMessages.FILES_ON_TARGET_ARE_CORRUPTED);
    System.exit(1);
  }
Пример #3
0
 @Override
 public void drop(DropTargetDropEvent dtde) {
   try {
     if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
       dtde.acceptDrop(DnDConstants.ACTION_COPY);
       Transferable t = dtde.getTransferable();
       List list = (List) t.getTransferData(DataFlavor.javaFileListFlavor);
       for (Object o : list) {
         if (o instanceof File) {
           File f = (File) o;
           System.out.println(f.getAbsolutePath());
         }
       }
       dtde.dropComplete(true);
       return;
     }
   } catch (UnsupportedFlavorException | IOException ex) {
     ex.printStackTrace();
   }
   dtde.rejectDrop();
 }