@Override
  public void resultChanged(LookupEvent lookupEvent) {
    nameField.setText("[no name]");
    cityField.setText("[no city]");

    // Get the query:
    Collection allQueries = customerQueryResult.allInstances();
    Iterator it1 = allQueries.iterator();
    while (it1.hasNext()) {
      query = (CustomerCollection) it1.next();
      setDisplayName("Customers");
    }
    // Get the customer:
    Collection allCustomers = customerResult.allInstances();
    Iterator it2 = allCustomers.iterator();
    while (it2.hasNext()) {
      customer = (Customer) it2.next();
      nameField.setText(customer.getName());
      cityField.setText(customer.getCity());
    }
    // Get the node:
    Collection allNodes = customerNodeResult.allInstances();
    Iterator it3 = allNodes.iterator();
    while (it3.hasNext()) {
      customerNode = (Node) it3.next();
    }
    // Need to Clear Save and Undo here
    nameText = nameField.getText();
    cityText = cityField.getText();

    // Remove New Type?
    Lookup.Result<NewType> newTypeResult = getLookup().lookupResult(NewType.class);
    Collection allNewTypes = newTypeResult.allInstances();
    Iterator it4 = allNewTypes.iterator();
    while (it4.hasNext()) {
      instanceContent.remove(it4.next());
    }

    if (customerNode != null) {
      this.setActivatedNodes(new Node[] {customerNode});
      for (NewType nt : customerNode.getNewTypes()) {
        instanceContent.add(nt);
      }
    }
    manager.discardAllEdits();
    modify();
  }
Esempio n. 2
0
 /**
  * Unregisters the object <code>o</code> with this lookup.
  *
  * @see org.openide.util.Lookup.Provider.
  * @param o the object to be registered.
  */
 public void remove(Object o) {
   ic.remove(o);
 }
Esempio n. 3
0
 public void remove(Object instance) {
   content.remove(instance);
 }