protected void createChange(IPluginModelBase model) { Object node = findNode(model); if (!(node instanceof IPluginObject)) return; try { IPluginObject pluginObject = (IPluginObject) node; IPluginObject parent = pluginObject.getParent(); if (parent instanceof IPluginParent) ((IPluginParent) parent).remove(pluginObject); else if (parent instanceof PluginBaseNode) ((PluginBaseNode) parent).remove(pluginObject); else if (pluginObject instanceof PluginAttribute) { PluginAttribute attr = (PluginAttribute) pluginObject; attr.getEnclosingElement().setXMLAttribute(attr.getName(), null); } } catch (CoreException e) { } }
@Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.CHANGE) { Object changedObject = event.getChangedObjects()[0]; if (changedObject instanceof IPluginObject) { IPluginObject obj = (IPluginObject) event.getChangedObjects()[0]; // Ignore events from objects that are not yet in the model. if (!(obj instanceof IPluginBase) && obj.isInTheModel() == false) return; } if (changedObject instanceof IBuildObject) { IBuildObject obj = (IBuildObject) event.getChangedObjects()[0]; // Ignore events from objects that are not yet in the model. if (obj.isInTheModel() == false) return; } } super.modelChanged(event); }