/** * Inspects the currently edited object and clones plugins if they are needed. * * @throws EClassEditorMissing Will be thrown if there is no EditPlugin registered for a certain * class but the currently edited object has an attribute of that class. Note that this won' t * happen in this implementation because by default an editor for missing classes is * registered. */ private void inspectEditedObject() throws EClassEditorMissing { Method[] tempMethods = editedObject.getClass().getDeclaredMethods(); // methods = new HashMap<GSMethod, EditPlugin>(); methods = new HashMap<GSMethod, EditPlugin>(); Map<String, GSMethod> map = this.editedObject.getAllAttribs(); Set<String> set = map.keySet(); Iterator<String> iter = set.iterator(); while (iter.hasNext()) { String key = iter.next(); GSMethod x = map.get(key); EditPlugin plug = this.getNewPlugin(x.getMethod.getReturnType()); if (!x.show) continue; if (plug == null) plug = this.getNewPlugin(Object.class); plug.setName(key); try { Object obj = null; try { obj = x.getMethod.invoke(this.editedObject, new Object[] {}); } catch (Exception e) { obj = null; } plug.setValue(obj); } catch (Exception e) { JOptionPane.showMessageDialog( null, "Error: " + e.toString(), "Error!", JOptionPane.ERROR_MESSAGE); } if (x instanceof GSMethodForeign) { EditPlugin original = plug; plug = new ForeignKeyEditPlugin(); ((ForeignKeyEditPlugin) plug).setEditPlugin(original); ((ForeignKeyEditPlugin) plug).setEditedTable(((GSMethodForeign) x).tableName); ((ForeignKeyEditPlugin) plug).setEditedAttrib(((GSMethodForeign) x).attribName); ((ForeignKeyEditPlugin) plug).setEditedClass(((GSMethodForeign) x).objectClass); ((ForeignKeyEditPlugin) plug).setParentFrame(this.parentFrame); } if (x instanceof GSMethodPrimary) { // do nothing } methods.put(x, plug); } }