private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed ClasspathInfo cpInfo = ClasspathInfo.create(config.getPrimaryFile()); final ElementHandle<TypeElement> handle = TypeElementFinder.find( cpInfo, new TypeElementFinder.Customizer() { public Set<ElementHandle<TypeElement>> query( ClasspathInfo classpathInfo, String textForQuery, NameKind nameKind, Set<SearchScope> searchScopes) { return classpathInfo .getClassIndex() .getDeclaredTypes(textForQuery, nameKind, searchScopes); } public boolean accept(ElementHandle<TypeElement> typeHandle) { return true; } }); if (handle != null) { jComboBoxPropertyType.setSelectedItem(handle.getQualifiedName()); } } // GEN-LAST:event_jButton1ActionPerformed
/** * Tests that POM doesn't fire events if it was initialized temporarily. This is important to * avoid issues like 119767, where a client getting an event reacts by initializing the model * again, which fires an event, which initializes the model, etc. */ public void testNoEventsIfTemporary() throws Exception { IndexingManager.getDefault().refreshIndexAndWait(srcFO.getURL(), null); ClasspathInfo cpi = ClasspathInfo.create(srcFO); final AnnotationModelHelper helper = AnnotationModelHelper.create(cpi); final MockChangeListener listener = new MockChangeListener(); final ObjectProvider<PersistentObject> provider = new InterruptibleObjectProviderImpl(true); final List<PersistentObjectManager<PersistentObject>> manager = new ArrayList<PersistentObjectManager<PersistentObject>>(); helper.runJavaSourceTask( new Runnable() { public void run() { PersistentObjectManager<PersistentObject> newManager = helper.createPersistentObjectManager(provider); newManager.addChangeListener(listener); newManager.getObjects(); assertTrue(newManager.temporary); manager.add(newManager); } }); // just check the manager has was deinitialized by now (as we are out of the java context) assertFalse(manager.get(0).initialized); // there should have been no events whatsoever listener.assertNoEvents(); }