/** Opens the change class dialog. */ public void changeClass() { // JPanel mainPanel /* * MINOR MAGIC * * This code reuses the 'new entry window'. In order to make things * sane, we prompt the user to save any serious changes before continuing. * (Things can get really wierd if the user changes the name and then * tries to change the objectclass - best to avoid the whole issue.) */ myEditor.stopCellEditing(); if (virtualEntry) { doVirtualEntryDisplay(); return; } /* * classChangedOriginalEntry saves the original state of the entry * between visits to NewEntryWin. (- I wonder if it would be neater * to just reset the 'oldEntry' state of the table every time? ). * Check it's not been set already (i.e. Pathological User is paying * multiple visits to the NewEntryWin.) */ if (classChangedOriginalEntry == null) classChangedOriginalEntry = tableData.getOldEntry(); DXEntry newEntry = tableData.getNewEntry(); DN newDN = newEntry.getDN(); /* * Pathalogical user has messed with the name, *and* wants to * change the object classes... */ if (newDN.equals(classChangedOriginalEntry.getDN()) == false) { checkForUnsavedChanges(); /* if (promptForSave() == false) // we may need to reset the 'newEntry' data { // if the user discards their changes. tableData.reset(); // resets the table before going on. newEntry = tableData.getNewEntry(); newDN = newEntry.getDN(); } else // user has saved data - so now we need to reset the 'classChangedOriginalEntry' { */ // to the changed (and hopefully saved!) data. // NB: If the directory write fails, then the change classes will also fail... classChangedOriginalEntry = tableData.getNewEntry(); } /* * Open NewEntryWin, allowing the user to reset the objectclass attribute. */ /* NewEntryWin userData = new NewEntryWin(newDN.parentDN(), newDN, dataSource, newEntry.getAsNonNullAttributes(), newDN.getLowestRDN().toString(), TableAttributeEditor.this, CBUtility.getParentFrame(mainPanel)); */ if (dataSource.getSchemaOps() == null) { JOptionPane.showMessageDialog( owner, CBIntText.get( "Because there is no schema currently published by the\ndirectory, changing an entry's object class is unavailable."), CBIntText.get("No Schema"), JOptionPane.INFORMATION_MESSAGE); return; } else { ChangeObjectClassWin userData = new ChangeObjectClassWin( dataSource, newDN, newEntry.getAsNonNullAttributes(), this, CBUtility.getParentFrame(this), false); userData.setSize(400, 250); CBUtility.center(userData, owner); // TE: centres window. userData.setVisible(true); } }