@Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // Get the model IBundleModel model = getBundleModel(); // Ensure the model is defined if (model == null) { return; } // Get the bundle IBundle bundle = model.getBundle(); // Paste all source objects for (Object sourceObject : sourceObjects) { if (sourceObject instanceof ExportPackageObject) { ExportPackageObject exportPackageObject = (ExportPackageObject) sourceObject; // Export package object // Adjust all the source object transient field values to // acceptable values exportPackageObject.reconnect(model, fHeader, getVersionAttribute()); // Add the object to the header if (fHeader == null) { // Export package header not defined yet // Define one // Value will get inserted into a new export package object // created by a factory // Value needs to be empty string so no export package // object is created as the initial value bundle.setHeader(getExportedPackageHeader(), ""); // $NON-NLS-1$ } // Add the export package to the header fHeader.addPackage(exportPackageObject); } } }
private IBundle getBundle() { IBundleModel model = getBundleModel(); return (model != null) ? model.getBundle() : null; }