Пример #1
0
  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) {
    }
  }
Пример #2
0
 @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);
 }
Пример #3
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (obj instanceof IPluginParent) {
     IPluginParent target = (IPluginParent) obj;
     if (target.getChildCount() != getChildCount()) return false;
     IPluginObject[] tchildren = target.getChildren();
     for (int i = 0; i < tchildren.length; i++) {
       IPluginObject tchild = tchildren[i];
       IPluginObject child = getChildrenList().get(i);
       if (child == null || child.equals(tchild) == false) return false;
     }
     return true;
   }
   return false;
 }