if (tRem != mainPkg && !tRem.isTransient()) {
pkgsToRemove.add(tRem);
}
}
ExternalPackages eps = mainPkg.getExternalPackages();
ExternalPackage ep = mainPkg.getExternalPackage(toRemove.getId());
if (pkgsToRemove.size() > 0) {
boolean warningMessage = false;
it = pkgsToRemove.iterator();
while (it.hasNext()) {
Package tRem = (Package) it.next();
List refs = JaWEManager.getInstance().getXPDLUtils().getReferences(mainPkg,
tRem);
if (refs.size() > 0) {
warningMessage = true;
break;
}
}
if (warningMessage) {
int yn = JOptionPane.showConfirmDialog(getJaWEFrame(),
settings.getLanguageDependentString("MessageReferencedDoYouReallyWantToDeleteSelectedItem"),
settings.getLanguageDependentString("DeletingKey"),
JOptionPane.YES_NO_OPTION);
if (yn != JOptionPane.YES_OPTION) {
return;
}
}
}
try {
if (ep != null) {
mainPkg.removeExternalPackageMapping(ep.getHref());
}
if (pkgsToRemove.size() > 0) {
it = pkgsToRemove.iterator();
while (it.hasNext()) {
Package pkg = (Package) it.next();
XPDLListenerAndObservable xpdllo = getXPDLListenerObservable(pkg);
xpdllo.unregisterFromXPDL();
xpdlListenerObservables.remove(xpdllo);
xpdlh.closePackageVersion(pkg.getId(), pkg.getInternalVersion());
}
setChanged();
notifyObservers(createInfo(mainPkg,
new ArrayList(pkgsToRemove),
XMLElementChangeInfo.REMOVED));
}
if (ep != null) {
eps.remove(ep);
List remove = new ArrayList();
remove.add(ep);
setChanged();
notifyObservers(createInfo(eps, remove, XMLElementChangeInfo.REMOVED));
}