public void removeNodeFromParent(DatasetConfigTreeNode node) { Object child = node.getUserObject(); if (node.getParent() == null) return; // Can't remove root node. Object parent = ((DatasetConfigTreeNode) node.getParent()).getUserObject(); if (parent instanceof org.ensembl.mart.lib.config.DatasetConfig) { if (child instanceof org.ensembl.mart.lib.config.FilterPage) { config = (DatasetConfig) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); config.removeFilterPage((FilterPage) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.AttributePage) { config = (DatasetConfig) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); config.removeAttributePage((AttributePage) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.Exportable) { config = (DatasetConfig) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); config.removeExportable((Exportable) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.Importable) { config = (DatasetConfig) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); config.removeImportable((Importable) node.getUserObject()); } } else if (node.getUserObject() instanceof DynamicDataset) { config = (DatasetConfig) ((DatasetConfigTreeNode) node.getParent().getParent()).getUserObject(); config.removeDynamicDataset((DynamicDataset) node.getUserObject()); } else if (parent instanceof org.ensembl.mart.lib.config.FilterPage) { if (child instanceof org.ensembl.mart.lib.config.FilterGroup) { FilterPage fp = (FilterPage) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); fp.removeFilterGroup((FilterGroup) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.FilterGroup) { if (child instanceof org.ensembl.mart.lib.config.FilterCollection) { FilterGroup fg = (FilterGroup) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); fg.removeFilterCollection((FilterCollection) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.FilterCollection) { if (child instanceof org.ensembl.mart.lib.config.FilterDescription) { FilterCollection fc = (FilterCollection) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); fc.removeFilterDescription((FilterDescription) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.FilterDescription) { if (child instanceof org.ensembl.mart.lib.config.Option) { FilterDescription fd = (FilterDescription) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); fd.removeOption((Option) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.SpecificFilterContent) { FilterDescription ad = (FilterDescription) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ad.removeSpecificFilterContent((SpecificFilterContent) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.Option) { if (child instanceof org.ensembl.mart.lib.config.SpecificOptionContent) { Option ad = (Option) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ad.removeSpecificOptionContent((SpecificOptionContent) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.PushAction) { Option op = (Option) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); op.removePushAction((PushAction) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.Option) { Option fd = (Option) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); fd.removeOption((Option) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.PushAction) { if (child instanceof org.ensembl.mart.lib.config.Option) { PushAction pa = (PushAction) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); pa.removeOption((Option) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.AttributePage) { if (child instanceof org.ensembl.mart.lib.config.AttributeGroup) { AttributePage ap = (AttributePage) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ap.removeAttributeGroup((AttributeGroup) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.AttributeGroup) { if (child instanceof org.ensembl.mart.lib.config.AttributeCollection) { AttributeGroup ag = (AttributeGroup) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ag.removeAttributeCollection((AttributeCollection) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.AttributeCollection) { if (child instanceof org.ensembl.mart.lib.config.AttributeDescription) { AttributeCollection ac = (AttributeCollection) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ac.removeAttributeDescription((AttributeDescription) node.getUserObject()); } else if (child instanceof org.ensembl.mart.lib.config.AttributeList) { AttributeCollection ac = (AttributeCollection) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ac.removeAttributeList((AttributeList) node.getUserObject()); } } else if (parent instanceof org.ensembl.mart.lib.config.AttributeDescription) { if (child instanceof org.ensembl.mart.lib.config.SpecificAttributeContent) { AttributeDescription ad = (AttributeDescription) ((DatasetConfigTreeNode) node.getParent()).getUserObject(); ad.removeSpecificAttributeContent((SpecificAttributeContent) node.getUserObject()); } } super.removeNodeFromParent(node); }