@Override
 protected boolean canPaste(Object targetObject, Object[] sourceObjects) {
   HashMap<?, ?> currentPackageFragments = null;
   // Only export package objects that represent existing package
   // fragments within the Java project that this plugin.xml is stored
   // can be pasted
   for (Object sourceObject : sourceObjects) {
     // Only export package objects are allowed
     if ((sourceObject instanceof ExportPackageObject) == false) {
       return false;
     }
     // Get the package fragments that are allowed and store them to
     // assist in searching
     if (currentPackageFragments == null) {
       currentPackageFragments = createCurrentExportPackageMap();
     }
     // Only export packages that are in the list of allowed package
     // fragments are allowed
     ExportPackageObject exportPackageObject = (ExportPackageObject) sourceObject;
     if (currentPackageFragments.containsKey(exportPackageObject.getName()) == false) {
       return false;
     }
   }
   return true;
 }
예제 #2
0
  private ArrayList convertPkgList(ArrayList pkgList) {
    ArrayList conList = new ArrayList();
    Iterator it = pkgList.iterator();
    while (it.hasNext()) {
      CallData cd = (CallData) it.next();
      TestNode tn = null;
      if (alreadyDone.containsKey(cd)) {
        tn = (TestNode) alreadyDone.get(cd);
      } else {
        tn = new TestNode();
        tn.setData(cd.getData());
        alreadyDone.put(cd, tn);
        if (cd.getChildren().size() != 0) {
          tn.setChildren(convertPkgList(cd.getChildren()));
        }
        if (cd.getOutputs().size() != 0) {
          tn.setOutputs(convertPkgList(cd.getOutputs()));
        }
      }
      conList.add(tn);
    }

    return conList;
  }